Merge "Update network_data.json to include dns nameservers"

This commit is contained in:
Zuul 2024-08-26 21:05:11 +00:00 committed by Gerrit Code Review
commit d6188b752c
5 changed files with 43 additions and 2 deletions

View File

@ -557,6 +557,10 @@ def get_neutron_port_data(port_id, vif_id, client=None, context=None):
],
'networks': [
],
'services': [
]
}
@ -624,6 +628,14 @@ def get_neutron_port_data(port_id, vif_id, client=None, context=None):
network_data['networks'].append(network)
for dns_nameserver in subnet_config['dns_nameservers']:
service = {
'type': 'dns',
'address': dns_nameserver
}
network_data['services'].append(service)
return network_data

View File

@ -6,7 +6,7 @@
"segment_id": null,
"project_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
"tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
"dns_nameservers": [],
"dns_nameservers": ["192.0.2.253","192.0.2.254"],
"dns_publish_fixed_ip": false,
"allocation_pools": [
{

View File

@ -6,7 +6,7 @@
"segment_id": null,
"project_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
"tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
"dns_nameservers": [],
"dns_nameservers": ["2001:db8::ffff:c000:2fe"],
"dns_publish_fixed_ip": false,
"allocation_pools": [
{

View File

@ -646,6 +646,19 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
self.assertEqual(expected_network, network_data['networks'][0])
expected_services = [
{
'type': 'dns',
'address': '192.0.2.253'
},
{
'type': 'dns',
'address': '192.0.2.254'
}
]
self.assertEqual(expected_services, network_data['services'])
def load_ipv6_files(self):
port_show_file = os.path.join(
os.path.dirname(__file__), 'json_samples',
@ -705,6 +718,13 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
self.assertEqual(expected_network, network_data['networks'][0])
expected_service = {
'type': 'dns',
'address': '2001:db8::ffff:c000:2fe'
}
self.assertEqual(expected_service, network_data['services'][0])
def test_get_node_portmap(self):
with task_manager.acquire(self.context, self.node.uuid) as task:
portmap = neutron.get_node_portmap(task)

View File

@ -0,0 +1,9 @@
---
fixes:
- |
The network_data fetched from Neutron contained 'links',
'networks' but was missing 'services'. This patch brings
in 'services' to include dns nameservers that can be
configured by Glean or cloud-init during cleaning and
provisioning operations, especially when virtual media
boot is used without DHCP.