Skip to content

Commit be0cb06

Browse files
committed
Fix ovn-metadata agent sync of unused namespaces
metadata_namespaces contained datapath uuid and not the neutron network uuid. This broke the logic for namespaces clean up, resulting in all namespaces getting torn down and recreated at each metadata agent sync. Closes-Bug: #2031184 Change-Id: I58dd1973b73aa006234e7b808b6a3f357182a4b3 (cherry picked from commit 87b2f34)
1 parent 98c4ae5 commit be0cb06

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

neutron/agent/ovn/metadata/agent.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ def sync(self):
396396
for ns in ip_lib.list_network_namespaces())
397397
net_datapaths = self.get_networks_datapaths()
398398
metadata_namespaces = [
399-
self._get_namespace_name(str(datapath.uuid))
399+
self._get_namespace_name(
400+
ovn_utils.get_network_name_from_datapath(datapath))
400401
for datapath in net_datapaths
401402
]
402403
unused_namespaces = [ns for ns in system_namespaces if
@@ -405,8 +406,9 @@ def sync(self):
405406
for ns in unused_namespaces:
406407
self.teardown_datapath(self._get_datapath_name(ns))
407408

408-
# now that all obsolete namespaces are cleaned up, deploy required
409-
# networks
409+
# resync all network namespaces based on the associated datapaths,
410+
# even those that are already running. This is to make sure
411+
# everything within each namespace is up to date.
410412
for datapath in net_datapaths:
411413
self.provision_datapath(datapath)
412414

neutron/tests/unit/agent/ovn/metadata/test_agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ def setUp(self):
8383

8484
self.ports = []
8585
for i in range(0, 3):
86-
self.ports.append(makePort(datapath=DatapathInfo(uuid=str(i),
86+
self.ports.append(makePort(
87+
datapath=DatapathInfo(uuid=str(uuid.uuid4()),
8788
external_ids={'name': 'neutron-%d' % i})))
8889
self.agent.sb_idl.get_ports_on_chassis.return_value = self.ports
8990

0 commit comments

Comments
 (0)