[NSX-P/NSX-v3] Metadata route: make windows route optional

Introduce a new configuration option - windows_metadata_route.
Specifies whether an explicit route for metadata proxy access
on windows should be added.

The default value will be True for backward compatibility.
This option will need to be set to False for some guest OSes such
as RHEL8 as a duplicate metadata route can cause failures while
setting up networking.

Change-Id: If7507d0d4242cce2c73c7a2239149ec35fef232f
This commit is contained in:
Salvatore Orlando 2021-10-18 08:25:32 -07:00
parent 819c74ef30
commit 31bd496e31
5 changed files with 18 additions and 4 deletions

View File

@ -318,6 +318,10 @@ nsx_v3_and_p = [
default="169.254.169.254/31", default="169.254.169.254/31",
help=_("The metadata route used for native metadata proxy " help=_("The metadata route used for native metadata proxy "
"service.")), "service.")),
cfg.BoolOpt('windows_metadata_route',
default=True,
help=_("Inject a route for allowing windows guest access NSX "
"native metadata proxy service")),
cfg.StrOpt('dns_domain', cfg.StrOpt('dns_domain',
default='openstacklocal', default='openstacklocal',
help=_("Domain to use for building the hostnames.")), help=_("Domain to use for building the hostnames.")),

View File

@ -60,6 +60,10 @@ class NsxV3AvailabilityZone(common_az.ConfiguredAvailabilityZone):
native_metadata_route = az_info.get('native_metadata_route') native_metadata_route = az_info.get('native_metadata_route')
if native_metadata_route: if native_metadata_route:
self.native_metadata_route = native_metadata_route self.native_metadata_route = native_metadata_route
windows_metadata_route = az_info.get('windows_metadata_route')
# Careful - this is a boolean
if windows_metadata_route is not None:
self.windows_metadata_route = windows_metadata_route
else: else:
self.metadata_proxy = None self.metadata_proxy = None
self.dhcp_profile = None self.dhcp_profile = None

View File

@ -2617,11 +2617,15 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
subnet): subnet):
# Always add option121. # Always add option121.
net_az = self.get_network_az_by_net_id(context, net_id) net_az = self.get_network_az_by_net_id(context, net_id)
options = {'option121': {'static_routes': [ static_routes = []
options = {'option121': {'static_routes': static_routes}}
if net_az.windows_metadata_route:
static_routes.append(
{'network': '%s' % net_az.native_metadata_route,
'next_hop': '0.0.0.0'})
static_routes.append(
{'network': '%s' % net_az.native_metadata_route, {'network': '%s' % net_az.native_metadata_route,
'next_hop': '0.0.0.0'}, 'next_hop': ip})
{'network': '%s' % net_az.native_metadata_route,
'next_hop': ip}]}}
if subnet: if subnet:
sr, gateway_ip = self._build_static_routes( sr, gateway_ip = self._build_static_routes(
subnet.get('gateway_ip'), subnet.get('cidr'), subnet.get('gateway_ip'), subnet.get('cidr'),

View File

@ -40,6 +40,7 @@ class NsxPAvailabilityZone(v3_az.NsxV3AvailabilityZone):
self.metadata_proxy = cfg.CONF.nsx_p.metadata_proxy self.metadata_proxy = cfg.CONF.nsx_p.metadata_proxy
self.dhcp_profile = cfg.CONF.nsx_p.dhcp_profile self.dhcp_profile = cfg.CONF.nsx_p.dhcp_profile
self.native_metadata_route = cfg.CONF.nsx_p.native_metadata_route self.native_metadata_route = cfg.CONF.nsx_p.native_metadata_route
self.windows_metadata_route = cfg.CONF.nsx_p.windows_metadata_route
self.default_overlay_tz = cfg.CONF.nsx_p.default_overlay_tz self.default_overlay_tz = cfg.CONF.nsx_p.default_overlay_tz
self.default_vlan_tz = cfg.CONF.nsx_p.default_vlan_tz self.default_vlan_tz = cfg.CONF.nsx_p.default_vlan_tz
self.default_tier0_router = cfg.CONF.nsx_p.default_tier0_router self.default_tier0_router = cfg.CONF.nsx_p.default_tier0_router

View File

@ -49,6 +49,7 @@ class NsxV3AvailabilityZone(v3_az.NsxV3AvailabilityZone):
self.metadata_proxy = cfg.CONF.nsx_v3.metadata_proxy self.metadata_proxy = cfg.CONF.nsx_v3.metadata_proxy
self.dhcp_profile = cfg.CONF.nsx_v3.dhcp_profile self.dhcp_profile = cfg.CONF.nsx_v3.dhcp_profile
self.native_metadata_route = cfg.CONF.nsx_v3.native_metadata_route self.native_metadata_route = cfg.CONF.nsx_v3.native_metadata_route
self.windows_metadata_route = cfg.CONF.nsx_v3.windows_metadata_route
self.dns_domain = cfg.CONF.nsx_v3.dns_domain self.dns_domain = cfg.CONF.nsx_v3.dns_domain
self.nameservers = cfg.CONF.nsx_v3.nameservers self.nameservers = cfg.CONF.nsx_v3.nameservers
self.default_overlay_tz = cfg.CONF.nsx_v3.default_overlay_tz self.default_overlay_tz = cfg.CONF.nsx_v3.default_overlay_tz