@@ -106,14 +106,14 @@ class PortBindingChassisCreatedEvent(PortBindingChassisEvent):
106
106
LOG_MSG = "Port %s in datapath %s bound to our chassis"
107
107
108
108
def __init__ (self , metadata_agent ):
109
- events = (self .ROW_UPDATE ,)
109
+ events = (self .ROW_CREATE , self . ROW_UPDATE ,)
110
110
super (PortBindingChassisCreatedEvent , self ).__init__ (
111
111
metadata_agent , events )
112
112
113
113
def match_fn (self , event , row , old ):
114
114
try :
115
115
return (row .chassis [0 ].name == self .agent .chassis and
116
- not old .chassis )
116
+ ( event == self . ROW_CREATE or not old .chassis ) )
117
117
except (IndexError , AttributeError ):
118
118
return False
119
119
@@ -297,8 +297,9 @@ def start(self):
297
297
self .conf , self .chassis , sb_idl = self .sb_idl )
298
298
self ._proxy .run ()
299
299
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 )
302
303
303
304
# Register the agent with its corresponding Chassis
304
305
self .register_metadata_agent ()
@@ -349,7 +350,7 @@ def get_networks_port_bindings(self):
349
350
return list (self ._vif_ports (ports ))
350
351
351
352
@_sync_lock
352
- def sync (self ):
353
+ def sync (self , provision = True ):
353
354
"""Agent sync.
354
355
355
356
This function will make sure that all networks with ports in our
@@ -379,8 +380,9 @@ def sync(self):
379
380
# resync all network namespaces based on the associated datapaths,
380
381
# even those that are already running. This is to make sure
381
382
# 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 )
384
386
385
387
@staticmethod
386
388
def _get_veth_name (datapath ):
0 commit comments