Merge "AdminUtils: Fix NSX-V dhcp-edge recreate"

This commit is contained in:
Jenkins 2017-05-01 14:55:19 +00:00 committed by Gerrit Code Review
commit cc7e2e336d

View File

@ -130,12 +130,8 @@ def nsx_update_dhcp_edge_binding(resource, event, trigger, **kwargs):
def delete_old_dhcp_edge(context, old_edge_id, bindings):
LOG.info("Deleting the old DHCP edge: %s", old_edge_id)
# using one of the router-ids in the bindings for the deleting
dhcp_names = [binding['router_id'] for binding in bindings]
dhcp_name = dhcp_names[0]
with locking.LockManager.get_lock(old_edge_id):
# Delete from NSXv backend
# (using the first dhcp name as the "router name")
# Note - If we will not delete the router, but free it - it will be
# immediately used as the new one, So it is better to delete it.
try:
@ -148,7 +144,7 @@ def delete_old_dhcp_edge(context, old_edge_id, bindings):
try:
# Remove bindings from Neutron DB
nsxv_db.delete_nsxv_router_binding(context.session, dhcp_name)
nsxv_db.clean_edge_router_binding(context.session, old_edge_id)
nsxv_db.clean_edge_vnic_binding(context.session, old_edge_id)
except Exception as e:
LOG.warning("Failed to delete the old edge %(id)s from the "