NSX|v Fix router type update to not update all the attributes
When changing the router type from shared to exclusive, we accidentally updated other attributes too, causing backend edge rename to be called and to fail Change-Id: Idf593df7591e639824efbdb46b391e74664db709
This commit is contained in:
parent
af8cd3f2ca
commit
b98bffcc07
@ -87,26 +87,24 @@ class RouterExclusiveDriver(router_driver.RouterBaseDriver):
|
|||||||
metadata_proxy_handler.cleanup_router_edge(router_id)
|
metadata_proxy_handler.cleanup_router_edge(router_id)
|
||||||
|
|
||||||
def _build_router_data_from_db(self, router_db, router):
|
def _build_router_data_from_db(self, router_db, router):
|
||||||
if 'status' not in router['router']:
|
"""Return a new dictionary with all DB & requested router attributes
|
||||||
router['router']['status'] = router_db.status
|
"""
|
||||||
if 'name' not in router['router']:
|
router_attr = router['router'].copy()
|
||||||
router['router']['name'] = router_db.name
|
fields = ['status', 'name', 'admin_state_up', 'tenant_id', 'id']
|
||||||
if 'admin_state_up' not in router['router']:
|
for field in fields:
|
||||||
router['router']['admin_state_up'] = router_db.admin_state_up
|
if field not in router['router']:
|
||||||
if 'tenant_id' not in router['router']:
|
router_attr[field] = getattr(router_db, field)
|
||||||
router['router']['tenant_id'] = router_db.tenant_id
|
return router_attr
|
||||||
if 'id' not in router['router']:
|
|
||||||
router['router']['id'] = router_db.id
|
|
||||||
|
|
||||||
def attach_router(self, context, router_id, router, appliance_size=None):
|
def attach_router(self, context, router_id, router, appliance_size=None):
|
||||||
router_db = self.plugin._get_router(context, router_id)
|
router_db = self.plugin._get_router(context, router_id)
|
||||||
|
|
||||||
# Add DB attributes to the router data structure
|
# Add DB attributes to the router data structure
|
||||||
# before creating it as an exclusive router
|
# before creating it as an exclusive router
|
||||||
self._build_router_data_from_db(router_db, router)
|
router_attr = self._build_router_data_from_db(router_db, router)
|
||||||
|
|
||||||
self.create_router(context,
|
self.create_router(context,
|
||||||
router['router'],
|
router_attr,
|
||||||
allow_metadata=False,
|
allow_metadata=False,
|
||||||
appliance_size=appliance_size)
|
appliance_size=appliance_size)
|
||||||
|
|
||||||
|
@ -2280,6 +2280,8 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
router,
|
router,
|
||||||
appliance_size=appliance_size)
|
appliance_size=appliance_size)
|
||||||
# continue to update the router with the new driver
|
# continue to update the router with the new driver
|
||||||
|
# but remove the router-size that was already updated
|
||||||
|
router['router'].pop(ROUTER_SIZE, None)
|
||||||
|
|
||||||
router_driver = self._find_router_driver(context, router_id)
|
router_driver = self._find_router_driver(context, router_id)
|
||||||
return router_driver.update_router(context, router_id, router)
|
return router_driver.update_router(context, router_id, router)
|
||||||
|
Loading…
Reference in New Issue
Block a user