@@ -3610,6 +3610,7 @@ def _get_subnets_from_port(self, context, port, client=None):
3610
3610
'gateway' : network_model .IP (
3611
3611
address = subnet ['gateway_ip' ],
3612
3612
type = 'gateway' ),
3613
+ 'enable_dhcp' : False ,
3613
3614
}
3614
3615
if subnet .get ('ipv6_address_mode' ):
3615
3616
subnet_dict ['ipv6_address_mode' ] = subnet ['ipv6_address_mode' ]
@@ -3626,22 +3627,14 @@ def _get_subnets_from_port(self, context, port, client=None):
3626
3627
subnet_dict ['dhcp_server' ] = ip_pair ['ip_address' ]
3627
3628
break
3628
3629
3629
- # NOTE(arnaudmorin): If enable_dhcp is set on subnet, but, for
3630
- # some reason neutron did not have any DHCP port yet, we still
3631
- # want the network_info to be populated with a valid dhcp_server
3632
- # value. This is mostly useful for the metadata API (which is
3633
- # relying on this value to give network_data to the instance).
3634
- #
3635
- # This will also help some providers which are using external
3636
- # DHCP servers not handled by neutron.
3637
- # In this case, neutron will never create any DHCP port in the
3638
- # subnet.
3639
- #
3640
- # Also note that we cannot set the value to None because then the
3641
- # value would be discarded by the metadata API.
3642
- # So the subnet gateway will be used as fallback.
3643
- if subnet .get ('enable_dhcp' ) and 'dhcp_server' not in subnet_dict :
3644
- subnet_dict ['dhcp_server' ] = subnet ['gateway_ip' ]
3630
+ # NOTE(stblatzheim): If enable_dhcp is set on subnet, but subnet
3631
+ # has ovn native dhcp and no dhcp-agents. Network owner will be
3632
+ # network:distributed
3633
+ # Just rely on enable_dhcp flag given by neutron
3634
+ # Fix for https://bugs.launchpad.net/nova/+bug/2055245
3635
+
3636
+ if subnet .get ('enable_dhcp' ):
3637
+ subnet_dict ['enable_dhcp' ] = True
3645
3638
3646
3639
subnet_object = network_model .Subnet (** subnet_dict )
3647
3640
for dns in subnet .get ('dns_nameservers' , []):
0 commit comments