Merge "Rename edge appliance before its deletion"
This commit is contained in:
commit
79de437e42
@ -675,6 +675,22 @@ class EdgeManager(object):
|
||||
res_pool = nsxv_db.get_edge_resource_pool(context.session, edge_id)
|
||||
edge_pool_range = self.edge_pool_dicts[binding['edge_type']].get(
|
||||
binding['appliance_size'])
|
||||
|
||||
nsxv_db.delete_nsxv_router_binding(
|
||||
context.session, router_id)
|
||||
backup_router_id = (vcns_const.BACKUP_ROUTER_PREFIX +
|
||||
_uuid())[:vcns_const.EDGE_NAME_LEN]
|
||||
nsxv_db.add_nsxv_router_binding(
|
||||
context.session,
|
||||
backup_router_id,
|
||||
edge_id,
|
||||
None,
|
||||
plugin_const.PENDING_UPDATE,
|
||||
appliance_size=binding['appliance_size'],
|
||||
edge_type=binding['edge_type'],
|
||||
resource_pool=res_pool)
|
||||
|
||||
router_id = backup_router_id
|
||||
if (binding['status'] == plugin_const.ERROR or
|
||||
not self.check_edge_active_at_backend(edge_id) or
|
||||
not edge_pool_range):
|
||||
@ -698,19 +714,6 @@ class EdgeManager(object):
|
||||
backup_num = len(backup_router_bindings)
|
||||
# collect the edge to pool if pool not full
|
||||
if backup_num < edge_pool_range['maximum_pooled_edges']:
|
||||
nsxv_db.delete_nsxv_router_binding(
|
||||
context.session, router_id)
|
||||
backup_router_id = (vcns_const.BACKUP_ROUTER_PREFIX +
|
||||
_uuid())[:vcns_const.EDGE_NAME_LEN]
|
||||
nsxv_db.add_nsxv_router_binding(
|
||||
context.session,
|
||||
backup_router_id,
|
||||
edge_id,
|
||||
None,
|
||||
plugin_const.PENDING_UPDATE,
|
||||
appliance_size=binding['appliance_size'],
|
||||
edge_type=binding['edge_type'],
|
||||
resource_pool=res_pool)
|
||||
# change edge's name at backend
|
||||
task = self.nsxv_manager.update_edge(
|
||||
backup_router_id, edge_id, backup_router_id, None,
|
||||
|
Loading…
Reference in New Issue
Block a user