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 87b2f34a98
)
This commit is contained in:
parent
d6ee668cc3
commit
9a537fdf6c
@ -339,7 +339,8 @@ class MetadataAgent(object):
|
||||
for ns in ip_lib.list_network_namespaces())
|
||||
net_datapaths = self.get_networks_datapaths()
|
||||
metadata_namespaces = [
|
||||
self._get_namespace_name(str(datapath.uuid))
|
||||
self._get_namespace_name(
|
||||
ovn_utils.get_network_name_from_datapath(datapath))
|
||||
for datapath in net_datapaths
|
||||
]
|
||||
unused_namespaces = [ns for ns in system_namespaces if
|
||||
@ -348,8 +349,9 @@ class MetadataAgent(object):
|
||||
for ns in unused_namespaces:
|
||||
self.teardown_datapath(self._get_datapath_name(ns))
|
||||
|
||||
# now that all obsolete namespaces are cleaned up, deploy required
|
||||
# networks
|
||||
# resync all network namespaces based on the associated datapaths,
|
||||
# even those that are already running. This is to make sure
|
||||
# everything within each namespace is up to date.
|
||||
for datapath in net_datapaths:
|
||||
self.provision_datapath(datapath)
|
||||
|
||||
|
@ -83,7 +83,8 @@ class TestMetadataAgent(base.BaseTestCase):
|
||||
|
||||
self.ports = []
|
||||
for i in range(0, 3):
|
||||
self.ports.append(makePort(datapath=DatapathInfo(uuid=str(i),
|
||||
self.ports.append(makePort(
|
||||
datapath=DatapathInfo(uuid=str(uuid.uuid4()),
|
||||
external_ids={'name': 'neutron-%d' % i})))
|
||||
self.agent.sb_idl.get_ports_on_chassis.return_value = self.ports
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user