provide interface-scoped nameserver information

DNS nameserver information is subnet-specific, but nova provides this
information globally, which makes it impossible for system
configuration tools to place the nameserver information in the right
place (e.g., in interface configuration files).  This commit modifies
nova to *also* provide the DNS information per-subnet, where it can be
accessed by tools that want to configure the system properly.

Change-Id: I003a25b0d60cb6cd16c3ee1ad1a43910825622be
Closes-bug: #1693265
This commit is contained in:
Lars Kellogg-Stedman 2017-05-24 12:40:13 -04:00
parent 15cac9d7e5
commit 4b333b989d
2 changed files with 22 additions and 0 deletions

View File

@ -906,6 +906,8 @@ class TestNetworkMetadata(test.NoDBTestCase):
'gateway': '192.168.1.1'
}
],
'services': [{'address': '1.2.3.4', 'type': 'dns'},
{'address': '2.3.4.5', 'type': 'dns'}],
'network_id': 1
},
net_metadata['networks'][0])
@ -929,6 +931,8 @@ class TestNetworkMetadata(test.NoDBTestCase):
'gateway': 'fd00::1:1'
}
],
'services': [{'address': '1:2:3:4::', 'type': 'dns'},
{'address': '2:3:4:5::', 'type': 'dns'}],
'network_id': 1
},
net_metadata['networks'][1])
@ -989,6 +993,10 @@ class TestNetworkMetadata(test.NoDBTestCase):
'gateway': 'fd00::1:1'
}
],
'services': [
{'address': '1:2:3:4::', 'type': 'dns'},
{'address': '2:3:4:5::', 'type': 'dns'}
],
'type': 'ipv6_%s' % mode,
'network_id': 1
},
@ -1019,6 +1027,10 @@ class TestNetworkMetadata(test.NoDBTestCase):
'gateway': '192.168.1.1',
'netmask': '255.255.255.0',
'network': '0.0.0.0'}],
'services': [
{'address': '1.2.3.4', 'type': 'dns'},
{'address': '2.3.4.5', 'type': 'dns'}
],
'type': 'ipv4'
}
net = netutils._get_nets(
@ -1123,6 +1135,8 @@ class TestNetworkMetadata(test.NoDBTestCase):
"network": "0.0.0.0"
}
],
'services': [{'address': '1.2.3.4', 'type': 'dns'},
{'address': '2.3.4.5', 'type': 'dns'}],
"type": "ipv4"
},
{
@ -1137,6 +1151,8 @@ class TestNetworkMetadata(test.NoDBTestCase):
{'gateway': 'fd00::1:1',
'netmask': 'ffff:ffff:ffff::',
'network': '::'}],
'services': [{'address': '1:2:3:4::', 'type': 'dns'},
{'address': '2:3:4:5::', 'type': 'dns'}],
'type': 'ipv6'
},
{
@ -1153,6 +1169,8 @@ class TestNetworkMetadata(test.NoDBTestCase):
"network": "0.0.0.0"
}
],
'services': [{'address': '1.2.3.4', 'type': 'dns'},
{'address': '2.3.4.5', 'type': 'dns'}],
"type": "ipv4"
}
],
@ -1218,6 +1236,8 @@ class TestNetworkMetadata(test.NoDBTestCase):
"gateway": "fd00::1:1"
}
],
'services': [{'address': '1:2:3:4::', 'type': 'dns'},
{'address': '2:3:4:5::', 'type': 'dns'}],
"ip_address": "fd00::2",
"id": "network0"
}

View File

@ -301,6 +301,8 @@ def _get_nets(vif, subnet, version, net_num, link_id):
}
net_info['routes'].append(new_route)
net_info['services'] = _get_dns_services(subnet)
return net_info