diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py index 1ef602f2b0..ddea2ae5b8 100644 --- a/vmware_nsx/plugins/nsx_v3/plugin.py +++ b/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)