Merge "NSX|V3: ensure that metadata works with windows instances"

This commit is contained in:
Zuul 2017-12-10 09:17:19 +00:00 committed by Gerrit Code Review
commit 5d71e0423c
2 changed files with 32 additions and 0 deletions

View File

@ -2153,6 +2153,8 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
# Always add option121.
net_az = self.get_network_az_by_net_id(context, net_id)
options = {'option121': {'static_routes': [
{'network': '%s' % net_az.native_metadata_route,
'next_hop': '0.0.0.0'},
{'network': '%s' % net_az.native_metadata_route,
'next_hop': ip}]}}
if subnet:

View File

@ -402,6 +402,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},
@ -441,6 +444,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},
@ -478,6 +484,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},
@ -610,6 +619,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},
@ -629,6 +641,9 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
update_data = {'port': {'mac_address': new_mac}}
assert_data = {'mac_address': new_mac,
'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': mock.ANY},
@ -654,6 +669,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},
@ -682,6 +700,9 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
assert_data = {'mac_address': mac_address,
'ip_address': ip_addr,
'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_addr},
@ -711,6 +732,9 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
assert_data = {'mac_address': mac_address,
'ip_address': ip_addr,
'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_addr},
@ -743,6 +767,9 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
assert_data = {'mac_address': mac_address,
'ip_address': ip_addr,
'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_addr},
@ -851,6 +878,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' %
self.az_metadata_route,
'next_hop': '0.0.0.0'},
{'network': '%s' %
self.az_metadata_route,
'next_hop': ip},