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
This commit is contained in:
parent
19ab990dc2
commit
952e960414
@ -106,14 +106,14 @@ class PortBindingChassisCreatedEvent(PortBindingChassisEvent):
|
||||
LOG_MSG = "Port %s in datapath %s bound to our chassis"
|
||||
|
||||
def __init__(self, metadata_agent):
|
||||
events = (self.ROW_UPDATE,)
|
||||
events = (self.ROW_CREATE, self.ROW_UPDATE,)
|
||||
super(PortBindingChassisCreatedEvent, self).__init__(
|
||||
metadata_agent, events)
|
||||
|
||||
def match_fn(self, event, row, old):
|
||||
try:
|
||||
return (row.chassis[0].name == self.agent.chassis and
|
||||
not old.chassis)
|
||||
(event == self.ROW_CREATE or not old.chassis))
|
||||
except (IndexError, AttributeError):
|
||||
return False
|
||||
|
||||
@ -297,8 +297,9 @@ class MetadataAgent(object):
|
||||
self.conf, self.chassis, sb_idl=self.sb_idl)
|
||||
self._proxy.run()
|
||||
|
||||
# Do the initial sync.
|
||||
self.sync()
|
||||
# Do the initial sync. Provisioning handled by
|
||||
# PortBindingChassisCreatedEvent on initial db dump
|
||||
self.sync(provision=False)
|
||||
|
||||
# Register the agent with its corresponding Chassis
|
||||
self.register_metadata_agent()
|
||||
@ -349,7 +350,7 @@ class MetadataAgent(object):
|
||||
return set(p.datapath for p in self._vif_ports(ports))
|
||||
|
||||
@_sync_lock
|
||||
def sync(self):
|
||||
def sync(self, provision=True):
|
||||
"""Agent sync.
|
||||
|
||||
This function will make sure that all networks with ports in our
|
||||
@ -379,8 +380,9 @@ class MetadataAgent(object):
|
||||
# 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)
|
||||
if provision:
|
||||
for datapath in net_datapaths:
|
||||
self.provision_datapath(datapath)
|
||||
|
||||
@staticmethod
|
||||
def _get_veth_name(datapath):
|
||||
|
Loading…
x
Reference in New Issue
Block a user