2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

python: idl: Handle monitor_canceled.

Currently python-ovs claims to be "db change aware" but does not
parse the "monitor_canceled" notification. Transactions can continue
being made, but the monitor updates will not be sent. This handles
monitor_cancel similarly to how ovsdb-cs currently does.

Fixes: c39751e445 ("python: Monitor Database table to manage lifecycle of IDL client.")
Signed-off-by: Terry Wilson <twilson@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
This commit is contained in:
Terry Wilson
2023-12-18 17:31:24 -06:00
committed by Simon Horman
parent c8d85a0e45
commit ac04dfa7ec

View File

@@ -299,6 +299,7 @@ class Idl(object):
self._server_schema_request_id = None
self._server_monitor_request_id = None
self._db_change_aware_request_id = None
self._monitor_cancel_request_id = None
self._server_db_name = '_Server'
self._server_db_table = 'Database'
self.server_tables = None
@@ -481,6 +482,10 @@ class Idl(object):
break
else:
self.__parse_update(msg.params[1], OVSDB_UPDATE)
elif self.handle_monitor_canceled(msg):
break
elif self.handle_monitor_cancel_reply(msg):
break
elif (msg.type == ovs.jsonrpc.Message.T_REPLY
and self._monitor_request_id is not None
and self._monitor_request_id == msg.id):
@@ -616,6 +621,33 @@ class Idl(object):
return initial_change_seqno != self.change_seqno
def handle_monitor_canceled(self, msg):
if msg.type != msg.T_NOTIFY:
return False
if msg.method != "monitor_canceled":
return False
if msg.params[0] == str(self.uuid):
params = [str(self.server_monitor_uuid)]
elif msg.params[0] == str(self.server_monitor_uuid):
params = [str(self.uuid)]
else:
return False
mc_msg = ovs.jsonrpc.Message.create_request("monitor_cancel", params)
self._monitor_cancel_request_id = mc_msg.id
self.send_request(mc_msg)
self.restart_fsm()
return True
def handle_monitor_cancel_reply(self, msg):
if msg.type != msg.T_REPLY:
return False
if msg.id != self._monitor_cancel_request_id:
return False
self._monitor_cancel_request_id = None
return True
def compose_cond_change(self):
if not self.cond_changed:
return