NSXv: prevent toggling of ditributed router

There are three types or routers:
- exclusive
- shared
- distributed

Once a router is created we cannot change the distributed flag.

Change-Id: I66d8bf1074eb69de6cfd6646517454e26e0cfa10
This commit is contained in:
Gary Kotton 2015-07-27 06:08:16 -07:00
parent bdc1d265ce
commit c3fb2aec15
1 changed files with 6 additions and 0 deletions

View File

@ -1317,6 +1317,12 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
return self.get_router(context, lrouter['id'])
def update_router(self, context, router_id, router):
# Toggling the distributed flag is not supported
if 'distributed' in router['router']:
r = self.get_router(context, router_id)
if r['distributed'] != router['router']['distributed']:
err_msg = _('Unable to update distributed mode')
raise n_exc.InvalidInput(error_message=err_msg)
router_driver = self._find_router_driver(context, router_id)
return router_driver.update_router(context, router_id, router)