Fix neutron_pg_drop-related startup issues
There is a python-ovs bug that allows transactions to be executed before it has started monitoring the db for changes. This breaks ovsdbapp's AddCommand behavior, which looks up a row in memory post-commit to return it to the caller, because we process the reply from ovsdb-server that has the UUID in it, but when we try to look it up in memory, it isn't there since that is handled via the monitor notifications. Since we don't care about the return value, we can just ignore the KeyError. In addition, the request to Idl.cond_change() to monitor only the neutron_pg_drop table was failing for a similar reason-- it is called before the initial monitor request is sent, so directly setting table.condition will allow the condition to be added to the initial monitor request. Closes-Bug: #1938766 Change-Id: I78af15970a86923fb810e903d38634b6e60a8fe4
This commit is contained in:
parent
7e5e6d4929
commit
76ee64f4a8
|
@ -270,6 +270,15 @@ class OVNMechanismDriver(api.MechanismDriver):
|
|||
impl_idl_ovn.OvsdbNbOvnIdl, idl) as pre_ovn_nb_api:
|
||||
try:
|
||||
create_default_drop_port_group(pre_ovn_nb_api)
|
||||
except KeyError:
|
||||
# Due to a bug in python-ovs, we can send transactions before
|
||||
# the initial OVSDB is populated in memory. This can break
|
||||
# the AddCommand post_commit method which tries to return a
|
||||
# row looked up by the newly commited row's uuid. Since we
|
||||
# don't care about the return value from the PgAddCommand, we
|
||||
# can just catch the KeyError and continue. This can be
|
||||
# removed when the python-ovs bug is resolved.
|
||||
pass
|
||||
except RuntimeError as re:
|
||||
# If we don't get the lock, and the port group didn't exist
|
||||
# when we tried to create it, it might still have been
|
||||
|
|
|
@ -690,9 +690,11 @@ class OvnInitPGNbIdl(OvnIdl):
|
|||
|
||||
def __init__(self, driver, remote, schema):
|
||||
super(OvnInitPGNbIdl, self).__init__(driver, remote, schema)
|
||||
self.cond_change(
|
||||
'Port_Group',
|
||||
[['name', '==', ovn_const.OVN_DROP_PORT_GROUP_NAME]])
|
||||
# self.cond_change() doesn't work here because we are setting the
|
||||
# condition *before an initial monitor request is made* so there is
|
||||
# no previous session whose condition we wish to change
|
||||
self.tables['Port_Group'].condition = [
|
||||
['name', '==', ovn_const.OVN_DROP_PORT_GROUP_NAME]]
|
||||
self.neutron_pg_drop_event = NeutronPgDropPortGroupCreated(
|
||||
timeout=ovn_conf.get_ovn_ovsdb_timeout())
|
||||
self.notify_handler.watch_event(self.neutron_pg_drop_event)
|
||||
|
|
Loading…
Reference in New Issue