Browse Source

NSX|V3: honor host routes

If host routes are configured on a subnet then we need to make
sure that they are part of the 121 options on the DHCP static
binding.

Change-Id: Iec37c96ddae17622fc26d4ae1961a14afcea566c
changes/18/485518/2
Gary Kotton 4 years ago
parent
commit
743a082102
  1. 9
      vmware_nsx/plugins/nsx_v3/plugin.py

9
vmware_nsx/plugins/nsx_v3/plugin.py

@ -1825,11 +1825,16 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
ip, port):
try:
hostname = 'host-%s' % ip.replace('.', '-')
gateway_ip = self.get_subnet(
context, subnet_id).get('gateway_ip')
subnet = self.get_subnet(context, subnet_id)
gateway_ip = subnet.get('gateway_ip')
options = self._get_dhcp_options(
context, ip, port.get(ext_edo.EXTRADHCPOPTS),
port['network_id'])
# update static routes
for hr in subnet['host_routes']:
options['option121']['static_routes'].append(
{'network': hr['destination'],
'next_hop': hr['nexthop']})
binding = self.nsxlib.dhcp_server.create_binding(
dhcp_service_id, port['mac_address'], ip, hostname,
cfg.CONF.nsx_v3.dhcp_lease_time, options, gateway_ip)

Loading…
Cancel
Save