NSX|V3: ensure that metadata works with windows instances
The 121 support required that we add a route for the metadata
to be via the interface. There are some operting systems that
do not support this. This needs to be '0.0.0.0'. we pass both
options and the OS will decide which one to use.
Change-Id: Id5d43c7b5eb7c7b7a12c47dc31f7f52af804494c
(cherry picked from commit 520758a1c2
)
This commit is contained in:
parent
56376f0943
commit
692f04d5f3
|
@ -1804,6 +1804,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||
subnet = self.get_subnet(context, subnet_id)
|
||||
gateway_ip = subnet.get('gateway_ip')
|
||||
options = {'option121': {'static_routes': [
|
||||
{'network': '%s' % cfg.CONF.nsx_v3.native_metadata_route,
|
||||
'next_hop': '0.0.0.0'},
|
||||
{'network': '%s' % cfg.CONF.nsx_v3.native_metadata_route,
|
||||
'next_hop': ip}]}}
|
||||
# update static routes
|
||||
|
@ -1972,6 +1974,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||
if ip != binding['ip_address']:
|
||||
data['host_name'] = 'host-%s' % ip.replace('.', '-')
|
||||
data['options'] = {'option121': {'static_routes': [
|
||||
{'network': '%s' % cfg.CONF.nsx_v3.native_metadata_route,
|
||||
'next_hop': '0.0.0.0'},
|
||||
{'network': '%s' % cfg.CONF.nsx_v3.native_metadata_route,
|
||||
'next_hop': ip}]}}
|
||||
if gateway_ip is not False:
|
||||
|
|
|
@ -372,6 +372,9 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
|
|||
ip = port['port']['fixed_ips'][0]['ip_address']
|
||||
hostname = 'host-%s' % ip.replace('.', '-')
|
||||
options = {'option121': {'static_routes': [
|
||||
{'network': '%s' %
|
||||
cfg.CONF.nsx_v3.native_metadata_route,
|
||||
'next_hop': '0.0.0.0'},
|
||||
{'network': '%s' %
|
||||
cfg.CONF.nsx_v3.native_metadata_route,
|
||||
'next_hop': ip}]}}
|
||||
|
@ -468,6 +471,9 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
|
|||
assert_data = {'host_name': 'host-%s' % new_ip.replace('.', '-'),
|
||||
'ip_address': new_ip,
|
||||
'options': {'option121': {'static_routes': [
|
||||
{'network': '%s' %
|
||||
cfg.CONF.nsx_v3.native_metadata_route,
|
||||
'next_hop': '0.0.0.0'},
|
||||
{'network': '%s' %
|
||||
cfg.CONF.nsx_v3.native_metadata_route,
|
||||
'next_hop': new_ip}]}}}
|
||||
|
@ -500,6 +506,9 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
|
|||
'mac_address': new_mac,
|
||||
'ip_address': new_ip,
|
||||
'options': {'option121': {'static_routes': [
|
||||
{'network': '%s' %
|
||||
cfg.CONF.nsx_v3.native_metadata_route,
|
||||
'next_hop': '0.0.0.0'},
|
||||
{'network': '%s' %
|
||||
cfg.CONF.nsx_v3.native_metadata_route,
|
||||
'next_hop': new_ip}]}}}
|
||||
|
|
Loading…
Reference in New Issue