Skip to content

Commit b992d63

Browse files
otherwiseguyralonsoh
authored andcommitted
Handle creation of Port_Binding with chassis set
When there is a backlog of notifications to be sent, it is possible that ovsdb-server will merge insert and update notifications. Due to this, we need to handle the situation where we see a Port_Binding created with the chassis set. Closes-Bug: #2017748 Change-Id: Idfae87cf6c60e9e18ede91ea20857cea5322738c (cherry picked from commit a641e8a)
1 parent 6205158 commit b992d63

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

neutron/agent/ovn/extensions/qos_hwol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ class PortBindingChassisCreatedEvent(_PortBindingChassisEvent):
158158
LOG_MSG = 'Port ID %s, datapath %s, OVS port name: %s (event: %s)'
159159

160160
def __init__(self, ovn_agent):
161-
events = (self.ROW_UPDATE,)
161+
events = (self.ROW_CREATE, self.ROW_UPDATE,)
162162
super().__init__(ovn_agent, events)
163163

164164
def match_fn(self, event, row, old):
165165
try:
166166
return (row.chassis[0].name == self.ovn_agent.chassis and
167-
not old.chassis)
167+
(event == self.ROW_CREATE or not old.chassis))
168168
except (IndexError, AttributeError):
169169
return False
170170

neutron/agent/ovn/metadata/agent.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ def run(self, event, row, old):
109109
self.agent.resync()
110110

111111

112+
class PortBindingCreateWithChassis(PortBindingEvent):
113+
EVENT = PortBindingEvent.ROW_CREATE
114+
115+
def match_fn(self, event, row, old):
116+
self._log_msg = "Port %s in datapath %s bound to our chassis on insert"
117+
if not (super().match_fn(event, row, old) and row.chassis):
118+
return False
119+
return row.chassis[0].name == self.agent.chassis
120+
121+
112122
class PortBindingUpdatedEvent(PortBindingEvent):
113123
EVENT = PortBindingEvent.ROW_UPDATE
114124

@@ -316,6 +326,7 @@ def start(self):
316326
tables = ('Encap', 'Port_Binding', 'Datapath_Binding', 'SB_Global',
317327
'Chassis')
318328
events = (PortBindingUpdatedEvent(self),
329+
PortBindingCreateWithChassis(self),
319330
PortBindingDeletedEvent(self),
320331
SbGlobalUpdateEvent(self),
321332
)
@@ -345,7 +356,8 @@ def start(self):
345356
self._proxy.run()
346357

347358
# Do the initial sync.
348-
self.sync()
359+
# Provisioning handled by PortBindingCreateWithChassis
360+
self.sync(provision=False)
349361

350362
# Register the agent with its corresponding Chassis
351363
self.register_metadata_agent()
@@ -396,7 +408,7 @@ def get_networks_datapaths(self):
396408
return set(p.datapath for p in self._vif_ports(ports))
397409

398410
@_sync_lock
399-
def sync(self):
411+
def sync(self, provision=True):
400412
"""Agent sync.
401413
402414
This function will make sure that all networks with ports in our
@@ -423,8 +435,9 @@ def sync(self):
423435
# resync all network namespaces based on the associated datapaths,
424436
# even those that are already running. This is to make sure
425437
# everything within each namespace is up to date.
426-
for datapath in net_datapaths:
427-
self.provision_datapath(datapath)
438+
if provision:
439+
for datapath in net_datapaths:
440+
self.provision_datapath(datapath)
428441

429442
@staticmethod
430443
def _get_veth_name(datapath):

0 commit comments

Comments
 (0)