Skip to content

Commit 8850773

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Handle creation of Port_Binding with chassis set" into unmaintained/zed
2 parents 127ce0f + 7bfbd4c commit 8850773

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

neutron/agent/ovn/metadata/agent.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ class PortBindingChassisCreatedEvent(PortBindingChassisEvent):
106106
LOG_MSG = "Port %s in datapath %s bound to our chassis"
107107

108108
def __init__(self, metadata_agent):
109-
events = (self.ROW_UPDATE,)
109+
events = (self.ROW_CREATE, self.ROW_UPDATE,)
110110
super(PortBindingChassisCreatedEvent, self).__init__(
111111
metadata_agent, events)
112112

113113
def match_fn(self, event, row, old):
114114
try:
115115
return (row.chassis[0].name == self.agent.chassis and
116-
not old.chassis)
116+
(event == self.ROW_CREATE or not old.chassis))
117117
except (IndexError, AttributeError):
118118
return False
119119

@@ -297,8 +297,9 @@ def start(self):
297297
self.conf, self.chassis, sb_idl=self.sb_idl)
298298
self._proxy.run()
299299

300-
# Do the initial sync.
301-
self.sync()
300+
# Do the initial sync. Provisioning handled by
301+
# PortBindingChassisCreatedEvent on initial db dump
302+
self.sync(provision=False)
302303

303304
# Register the agent with its corresponding Chassis
304305
self.register_metadata_agent()
@@ -349,7 +350,7 @@ def get_networks_port_bindings(self):
349350
return list(self._vif_ports(ports))
350351

351352
@_sync_lock
352-
def sync(self):
353+
def sync(self, provision=True):
353354
"""Agent sync.
354355
355356
This function will make sure that all networks with ports in our
@@ -379,8 +380,9 @@ def sync(self):
379380
# resync all network namespaces based on the associated datapaths,
380381
# even those that are already running. This is to make sure
381382
# everything within each namespace is up to date.
382-
for port_binding in net_port_bindings:
383-
self.provision_datapath(port_binding)
383+
if provision:
384+
for port_binding in net_port_bindings:
385+
self.provision_datapath(port_binding)
384386

385387
@staticmethod
386388
def _get_veth_name(datapath):

0 commit comments

Comments
 (0)