Skip to content

Commit e7f84e1

Browse files
authored
Merge pull request #707 from rackerlabs/fix-nova-trunk-details
fix(nova): fix trunk details patch and use correct container
2 parents 9dfaeb6 + eae327b commit e7f84e1

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

components/openstack-2024.2-jammy.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ images:
4949
neutron_netns_cleanup_cron: "ghcr.io/rackerlabs/understack/neutron:2024.2-ubuntu_jammy"
5050

5151
# nova
52-
nova_api: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
53-
nova_cell_setup: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
52+
nova_api: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
53+
nova_cell_setup: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
5454
nova_cell_setup_init: "docker.io/openstackhelm/heat:2024.2-ubuntu_jammy"
55-
nova_compute: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
56-
nova_compute_ironic: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
57-
nova_compute_ssh: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
58-
nova_conductor: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
59-
nova_db_sync: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
60-
nova_novncproxy: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
61-
nova_novncproxy_assets: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
62-
nova_scheduler: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
63-
nova_spiceproxy: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
64-
nova_spiceproxy_assets: "docker.io/openstackhelm/nova:2024.2-ubuntu_jammy"
55+
nova_compute: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
56+
nova_compute_ironic: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
57+
nova_compute_ssh: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
58+
nova_conductor: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
59+
nova_db_sync: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
60+
nova_novncproxy: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
61+
nova_novncproxy_assets: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
62+
nova_scheduler: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
63+
nova_spiceproxy: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
64+
nova_spiceproxy_assets: "ghcr.io/rackerlabs/understack/nova:2024.2-ubuntu_jammy"
6565
nova_service_cleaner: "docker.io/openstackhelm/ceph-config-helper:latest-ubuntu_jammy"
6666

6767
# placement

containers/nova/patches/0001_trunk_details_metadata.patch

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ index c59161daaf..22869c2fda 100644
3232
VIF_TYPE_VIF = 'vif'
3333
VIF_TYPE_UNBOUND = 'unbound'
3434
+VIF_TYPE_TRUNK_SUBPORT = 'trunk-subport'
35-
36-
35+
36+
3737
# Constants for dictionary keys in the 'vif_details' field in the VIF
3838
@@ -413,7 +414,7 @@ class VIF(Model):
3939
qbh_params=None, qbg_params=None, active=False,
@@ -42,16 +42,16 @@ index c59161daaf..22869c2fda 100644
4242
- **kwargs):
4343
+ trunk_vifs=None, **kwargs):
4444
super(VIF, self).__init__()
45-
45+
4646
self['id'] = id
4747
@@ -431,6 +432,7 @@ class VIF(Model):
4848
self['profile'] = profile
4949
self['preserve_on_delete'] = preserve_on_delete
5050
self['delegate_create'] = delegate_create
5151
+ self['trunk_vifs'] = trunk_vifs or []
52-
52+
5353
self._set_meta(kwargs)
54-
54+
5555
@@ -438,7 +440,8 @@ class VIF(Model):
5656
keys = ['id', 'address', 'network', 'vnic_type',
5757
'type', 'profile', 'details', 'devname',
@@ -60,12 +60,12 @@ index c59161daaf..22869c2fda 100644
6060
+ 'active', 'preserve_on_delete', 'delegate_create',
6161
+ 'trunk_vifs']
6262
return all(self[k] == other[k] for k in keys)
63-
63+
6464
def __ne__(self, other):
6565
@@ -509,9 +512,17 @@ class VIF(Model):
6666
phy_network = self['details'].get(VIF_DETAILS_PHYSICAL_NETWORK)
6767
return phy_network
68-
68+
6969
+ def add_trunk_vif(self, vif):
7070
+ for _vif in self['trunk_vifs']:
7171
+ if vif["id"] == _vif["id"]:
@@ -75,19 +75,19 @@ index c59161daaf..22869c2fda 100644
7575
@classmethod
7676
def hydrate(cls, vif):
7777
vif = cls(**vif)
78-
+ vif['trunk_vifs'] = [VIF.hydrate(**trunk_vif) for trunk_vif
78+
+ vif['trunk_vifs'] = [VIF.hydrate(trunk_vif) for trunk_vif
7979
+ in vif.get('trunk_vifs', [])]
8080
vif['network'] = Network.hydrate(vif['network'])
8181
return vif
82-
82+
8383
diff --git a/nova/network/neutron.py b/nova/network/neutron.py
8484
index f24177de15..da2ae27555 100644
8585
--- a/nova/network/neutron.py
8686
+++ b/nova/network/neutron.py
8787
@@ -3420,13 +3420,17 @@ class API:
8888
preserve_on_delete = (current_neutron_port['id'] in
8989
preexisting_port_ids)
90-
90+
9191
+ vif_type = current_neutron_port.get('binding:vif_type')
9292
+ if current_neutron_port.get('device_owner') == 'trunk:subport':
9393
+ vif_type = network_model.VIF_TYPE_TRUNK_SUBPORT
@@ -106,7 +106,7 @@ index f24177de15..da2ae27555 100644
106106
@@ -3455,6 +3459,20 @@ class API:
107107
instance=instance
108108
)
109-
109+
110110
+ def _populate_trunk_info(self, vif, current_neutron_port, context, client):
111111
+ trunk_details = current_neutron_port.get("trunk_details", {})
112112
+ for subport in trunk_details.get("sub_ports", []):
@@ -153,7 +153,7 @@ index 1c604975b0..089d5f655c 100644
153153
@@ -1081,6 +1081,38 @@ class TestNetworkMetadata(test.NoDBTestCase):
154154
def test_get_network_metadata_json_ipv6_addr_mode_stateless(self):
155155
self._test_get_network_metadata_json_ipv6_addr_mode('dhcpv6-stateless')
156-
156+
157157
+ def test_get_network_metadata_json_trunks(self):
158158
+
159159
+ parent_vif = fake_network_cache_model.new_vif(
@@ -196,7 +196,7 @@ index fa794cb012..f974e84f47 100644
196196
@@ -3345,6 +3345,85 @@ class TestAPI(TestAPIBase):
197197
mock_get_physnet.assert_has_calls([
198198
mock.call(self.context, mocked_client, 'net-id')] * 6)
199-
199+
200200
+ @mock.patch.object(neutronapi.API, '_get_physnet_tunneled_info',
201201
+ return_value=(None, False))
202202
+ @mock.patch.object(neutronapi.API, '_get_preexisting_port_ids',
@@ -285,8 +285,8 @@ index 2bc78134a1..9bc3381027 100644
285285
+++ b/nova/virt/netutils.py
286286
@@ -165,6 +165,12 @@ def get_injected_network_template(network_info, template=None,
287287
'libvirt_virt_type': libvirt_virt_type})
288-
289-
288+
289+
290290
+def get_vif_from_network_info(vif_id, network_info):
291291
+ for vif in network_info:
292292
+ if vif["id"] == vif_id:
@@ -295,11 +295,11 @@ index 2bc78134a1..9bc3381027 100644
295295
+
296296
def get_network_metadata(network_info):
297297
"""Gets a more complete representation of the instance network information.
298-
298+
299299
@@ -186,10 +192,26 @@ def get_network_metadata(network_info):
300300
ifc_num = -1
301301
net_num = -1
302-
302+
303303
+ trunk_vifs = []
304304
for vif in network_info:
305305
+ for trunk_vif in vif['trunk_vifs']:
@@ -308,7 +308,7 @@ index 2bc78134a1..9bc3381027 100644
308308
+ for vif in network_info + trunk_vifs:
309309
if not vif.get('network') or not vif['network'].get('subnets'):
310310
continue
311-
311+
312312
+ parent_vif = None
313313
+ if vif['type'] == 'trunk-subport':
314314
+ vif_profile = vif.get("profile")
@@ -324,22 +324,22 @@ index 2bc78134a1..9bc3381027 100644
324324
# NOTE(JoshNang) currently, only supports the first IPv4 and first
325325
# IPv6 subnet on network, a limitation that also exists in the
326326
@@ -202,7 +224,7 @@ def get_network_metadata(network_info):
327-
327+
328328
# Get the VIF or physical NIC data
329329
if subnet_v4 or subnet_v6:
330330
- link = _get_eth_link(vif, ifc_num)
331331
+ link = _get_eth_link(vif, ifc_num, parent_vif)
332332
links.append(link)
333-
333+
334334
# Add IPv4 and IPv6 networks if they exist
335335
@@ -240,7 +262,7 @@ def get_ec2_ip_info(network_info):
336336
return ip_info
337-
338-
337+
338+
339339
-def _get_eth_link(vif, ifc_num):
340340
+def _get_eth_link(vif, ifc_num, parent_vif=None):
341341
"""Get a VIF or physical NIC representation.
342-
342+
343343
:param vif: Neutron VIF
344344
@@ -256,6 +278,8 @@ def _get_eth_link(vif, ifc_num):
345345
# Use 'phy' for physical links. Ethernet can be confusing
@@ -349,7 +349,7 @@ index 2bc78134a1..9bc3381027 100644
349349
+ nic_type = 'vlan'
350350
else:
351351
nic_type = 'phy'
352-
352+
353353
@@ -266,6 +290,15 @@ def _get_eth_link(vif, ifc_num):
354354
'mtu': _get_link_mtu(vif),
355355
'ethernet_mac_address': vif.get('address'),
@@ -364,8 +364,8 @@ index 2bc78134a1..9bc3381027 100644
364364
+ })
365365
+
366366
return link
367-
368-
367+
368+
369369
diff --git a/releasenotes/notes/vlan-aware-network-data-9b9b5e8c0fd191ba.yaml b/releasenotes/notes/vlan-aware-network-data-9b9b5e8c0fd191ba.yaml
370370
new file mode 100644
371371
index 0000000000..dfa4e9394d
@@ -377,5 +377,5 @@ index 0000000000..dfa4e9394d
377377
+ - |
378378
+ When deploing instance with trunks generate required
379379
+ network_data for cloudinit.
380-
--
380+
--
381381
2.39.5 (Apple Git-154)

0 commit comments

Comments
 (0)