Skip to content

Commit 7034f4c

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 5d97b13 commit 7034f4c

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
@@ -339,7 +339,8 @@ def sync(self):
339339
for ns in ip_lib.list_network_namespaces())
340340
net_datapaths = self.get_networks_datapaths()
341341
metadata_namespaces = [
342-
self._get_namespace_name(str(datapath.uuid))
342+
self._get_namespace_name(
343+
ovn_utils.get_network_name_from_datapath(datapath))
343344
for datapath in net_datapaths
344345
]
345346
unused_namespaces = [ns for ns in system_namespaces if
@@ -348,8 +349,9 @@ def sync(self):
348349
for ns in unused_namespaces:
349350
self.teardown_datapath(self._get_datapath_name(ns))
350351

351-
# now that all obsolete namespaces are cleaned up, deploy required
352-
# networks
352+
# resync all network namespaces based on the associated datapaths,
353+
# even those that are already running. This is to make sure
354+
# everything within each namespace is up to date.
353355
for datapath in net_datapaths:
354356
self.provision_datapath(datapath)
355357

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)