From 2ed841f58d931bc9a2d29172d26c03d7cb6862e6 Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Mon, 28 Sep 2015 17:42:25 -0500 Subject: [PATCH] Check idl.run() return value before blocking The IDL change_seqno can change as a result of running idl.run(), and it returns True if there has been a change. The existing code would block without checking the return value, and therefor could block until another change occurred, or the timeout was reached. Closes-Bug: #1501090 Change-Id: I9b7aac2755e6e6b69165023e01583337f9d30f15 (cherry picked from commit 5dba2ac71c16cfd11937cf4becbaabd5b807678d) --- neutron/agent/ovsdb/native/idlutils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/neutron/agent/ovsdb/native/idlutils.py b/neutron/agent/ovsdb/native/idlutils.py index 22aa0008a..b02acd305 100644 --- a/neutron/agent/ovsdb/native/idlutils.py +++ b/neutron/agent/ovsdb/native/idlutils.py @@ -115,8 +115,7 @@ def wait_for_change(_idl, timeout, seqno=None): if seqno is None: seqno = _idl.change_seqno stop = time.time() + timeout - while _idl.change_seqno == seqno: - _idl.run() + while _idl.change_seqno == seqno and not _idl.run(): ovs_poller = poller.Poller() _idl.wait(ovs_poller) ovs_poller.timer_wait(timeout * 1000) -- 2.45.2