Merge "NSXv: Update DHCP binding configurations"

This commit is contained in:
Jenkins 2015-05-27 13:24:49 +00:00 committed by Gerrit Code Review
commit 8b54c1c412

View File

@ -1229,11 +1229,15 @@ def create_dhcp_bindings(context, nsxv_manager, network_id, bindings):
nsxv_manager.vcns.create_dhcp_binding(edge_id, binding) nsxv_manager.vcns.create_dhcp_binding(edge_id, binding)
bindings_get = get_dhcp_binding_mappings(nsxv_manager, edge_id) bindings_get = get_dhcp_binding_mappings(nsxv_manager, edge_id)
mac_address_list = [binding['macAddress'] for binding in bindings] mac_address_list = [binding['macAddress'] for binding in bindings]
for mac_address, binding_id in bindings_get.items(): for mac_address in mac_address_list:
if mac_address in mac_address_list: binding_id = bindings_get.get(mac_address)
if binding_id:
nsxv_db.create_edge_dhcp_static_binding( nsxv_db.create_edge_dhcp_static_binding(
context.session, edge_id, context.session, edge_id,
mac_address, binding_id) mac_address, binding_id)
else:
LOG.warning(_LW("Unable to configure binding for: %s"),
mac_address)
def get_dhcp_binding_mappings(nsxv_manager, edge_id): def get_dhcp_binding_mappings(nsxv_manager, edge_id):