Fix dhcp bindings missing problems

When adding interface on vdr or update subnet, we would update the
present dhcp edge's static bindings by DB query. But we lose some static
bindings since not elevate the query right to admin right.

Change-Id: Ic23262c48913c9fbda0cc1295908692590ea9ef6
Fixes-bug: #1502401
This commit is contained in:
linb 2015-08-21 11:33:07 +08:00 committed by Kobi Samoray
parent 924eecd968
commit 9c371a965a

View File

@ -672,14 +672,15 @@ class EdgeManager(object):
dhcp_networks = [edge_vnic_binding.network_id dhcp_networks = [edge_vnic_binding.network_id
for edge_vnic_binding in edge_vnic_bindings] for edge_vnic_binding in edge_vnic_bindings]
ports = self.nsxv_plugin.get_ports( ports = self.nsxv_plugin.get_ports(
context, filters={'network_id': dhcp_networks}) context.elevated(), filters={'network_id': dhcp_networks})
inst_ports = [port inst_ports = [port
for port in ports for port in ports
if port['device_owner'].startswith("compute")] if port['device_owner'].startswith("compute")]
static_bindings = [] static_bindings = []
for port in inst_ports: for port in inst_ports:
static_bindings.extend( static_bindings.extend(
self.nsxv_plugin._create_static_binding(context, port)) self.nsxv_plugin._create_static_binding(
context.elevated(), port))
dhcp_request = { dhcp_request = {
'featureType': "dhcp_4.0", 'featureType': "dhcp_4.0",
'enabled': True, 'enabled': True,