From 03d16f3006f93d63a0ffa14dec9fccba13473e95 Mon Sep 17 00:00:00 2001 From: linb Date: Wed, 4 May 2016 13:32:20 +0800 Subject: [PATCH] Backup edge put enhance When we try to collect one edge to backup edge pool, we need to first update edge at the backend and then fresh vnic binding db info. If all above ops are executed successfully, we can finally collect it to edge pool. Change-Id: I7ae90c2c802aa2584b470a7e15c2624618e15c88 --- vmware_nsx/plugins/nsx_v/vshield/edge_utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py b/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py index 7cd8b23618..014cb27b70 100644 --- a/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py +++ b/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py @@ -650,7 +650,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']: - LOG.debug("Collect edge: %s to pool", binding['edge_id']) nsxv_db.delete_nsxv_router_binding( context.session, router_id) backup_router_id = (vcns_const.BACKUP_ROUTER_PREFIX + @@ -660,7 +659,7 @@ class EdgeManager(object): backup_router_id, binding['edge_id'], None, - plugin_const.ACTIVE, + plugin_const.PENDING_UPDATE, appliance_size=binding['appliance_size'], edge_type=binding['edge_type']) # change edge's name at backend @@ -676,6 +675,12 @@ class EdgeManager(object): if not dist and binding['edge_id']: nsxv_db.init_edge_vnic_binding( context.session, binding['edge_id']) + + if task.status == task_const.TaskStatus.COMPLETED: + nsxv_db.update_nsxv_router_binding( + context.session, backup_router_id, + status=plugin_const.ACTIVE) + LOG.debug("Collect edge: %s to pool", binding['edge_id']) else: nsxv_db.update_nsxv_router_binding( context.session, router_id,