2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-05 08:45:23 +00:00

python: Fix Idl.run change_seqno update.

Fix an issue where Idl.run() returned False even if there was a change.
If Idl.run() reads multiple messages from the database server, some
may constitute changes and some may not. Changed the way change_seqno
is reset: if a message is not a change, reset change_seqno only to the
value before reading this message, not to the value before reading the
first message.
This will fix the return value in a scenario where some message was a
change and the last one wasn't. The new change_seqno will now be the
value after handling the message with the last change.

Fixes: c39751e445 ("python: Monitor Database table to manage lifecycle of IDL client.")
Signed-off-by: Bodo Petermann <b.petermann@syseleven.de>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Bodo Petermann
2021-06-16 12:32:14 +02:00
committed by Ilya Maximets
parent b57b062f5d
commit 154983c592

View File

@@ -246,6 +246,7 @@ class Idl(object):
i = 0
while i < 50:
i += 1
previous_change_seqno = self.change_seqno
if not self._session.is_connected():
break
@@ -274,7 +275,7 @@ class Idl(object):
if msg.params[0] == str(self.server_monitor_uuid):
self.__parse_update(msg.params[1], OVSDB_UPDATE,
tables=self.server_tables)
self.change_seqno = initial_change_seqno
self.change_seqno = previous_change_seqno
if not self.__check_server_db():
self.force_reconnect()
break
@@ -317,7 +318,7 @@ class Idl(object):
self.__error()
break
else:
self.change_seqno = initial_change_seqno
self.change_seqno = previous_change_seqno
self.__send_monitor_request()
elif (msg.type == ovs.jsonrpc.Message.T_REPLY
and self._server_monitor_request_id is not None
@@ -327,7 +328,7 @@ class Idl(object):
self._server_monitor_request_id = None
self.__parse_update(msg.result, OVSDB_UPDATE,
tables=self.server_tables)
self.change_seqno = initial_change_seqno
self.change_seqno = previous_change_seqno
if self.__check_server_db():
self.__send_monitor_request()
self.__send_db_change_aware()
@@ -341,7 +342,7 @@ class Idl(object):
self.__error()
break
else:
self.change_seqno = initial_change_seqno
self.change_seqno = previous_change_seqno
self.__send_monitor_request()
elif (msg.type == ovs.jsonrpc.Message.T_REPLY
and self._db_change_aware_request_id is not None
@@ -377,7 +378,7 @@ class Idl(object):
self.force_reconnect()
break
else:
self.change_seqno = initial_change_seqno
self.change_seqno = previous_change_seqno
self.__send_monitor_request()
elif (msg.type in (ovs.jsonrpc.Message.T_ERROR,
ovs.jsonrpc.Message.T_REPLY)