NSXv: only configure DHCP on backend if subnet is configured
Only create a DHCP binding for a port if DHCP is enabled on the subnet. Change-Id: I9217b9f6a8e335eb037373b18aab3ff757075740 Closes-bug: #1476602
This commit is contained in:
parent
d186c36403
commit
5b9672240d
|
@ -1255,7 +1255,6 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||
static_config['leaseTime'] = cfg.CONF.nsxv.dhcp_lease_time
|
||||
|
||||
for fixed_ip in port['fixed_ips']:
|
||||
static_config['ipAddress'] = fixed_ip['ip_address']
|
||||
# Query the subnet to get gateway and DNS
|
||||
try:
|
||||
subnet_id = fixed_ip['subnet_id']
|
||||
|
@ -1263,6 +1262,10 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||
except n_exc.SubnetNotFound:
|
||||
LOG.debug("No related subnet for port %s", port['id'])
|
||||
continue
|
||||
# Only configure if subnet has DHCP support
|
||||
if not subnet['enable_dhcp']:
|
||||
continue
|
||||
static_config['ipAddress'] = fixed_ip['ip_address']
|
||||
# Set gateway for static binding
|
||||
static_config['defaultGateway'] = subnet['gateway_ip']
|
||||
# set primary and secondary dns
|
||||
|
|
Loading…
Reference in New Issue