Raising proper error in case of router-interface addition

Currently when user tries to add a logical switch to 2nd
router a proper error message is not generated. This patch
takes care of it.

Change-Id: If81aea2c11235df71498ea2d68e03c7c7176445e
This commit is contained in:
vishala 2016-10-18 23:36:40 -07:00
parent 455bb910d2
commit 8dd65f08d5

View File

@ -2584,14 +2584,13 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
"to router %(router_id)s") % {
'net_id': net_id,
'router_id': router_ids[0]}
LOG.error(err_msg)
if router_id in router_ids:
LOG.error(err_msg)
# attach to the same router again
raise n_exc.InvalidInput(error_message=err_msg)
else:
LOG.error(err_msg)
# attach to multiple routers
raise n_exc.Conflict(error_message=err_msg)
raise l3.RouterInterfaceAttachmentConflict(reason=err_msg)
def _add_router_interface_wrapper(self, context, router_id,
interface_info):