[virt-tools-list] [virt-manager PATCH v2 4/6] virtManager: object: domain: Add timeout config

Michael Weiser michael.weiser at gmx.de
Fri Jan 3 20:12:34 UTC 2020


Make the guest agent wait timeout and sleep interval properties of the
thread manager class better visibility and easier adjustment.

Signed-off-by: Michael Weiser <michael.weiser at gmx.de>
---
 virtManager/object/domain.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
index 584a57a0..a7350f03 100644
--- a/virtManager/object/domain.py
+++ b/virtManager/object/domain.py
@@ -191,6 +191,8 @@ class _vmmDomainSetTimeThread(vmmGObject):
         self._do_cancel = threading.Event()
         self._do_cancel.clear()
         self._thread = None
+        self._maxwait = 5
+        self._sleep = 0.5
 
     def start(self):
         """
@@ -239,17 +241,15 @@ class _vmmDomainSetTimeThread(vmmGObject):
             # Setting time of a qemu domain can only work if an agent is
             # defined and online. We only get here if one is defined. So wait
             # for it to come online now.
-            maxwait = 5
-            sleep = 0.5
             waited = 0
-            while waited < maxwait and not self._domain.agent_ready():
+            while waited < self._maxwait and not self._domain.agent_ready():
                 log.debug("Waiting for qemu guest agent to come online...")
 
                 # sleep some time and potentially abort
-                if self._do_cancel.wait(sleep):
+                if self._do_cancel.wait(self._sleep):
                     return
 
-                waited += sleep
+                waited += self._sleep
 
             if not self._domain.agent_ready():
                 log.debug("Giving up on qemu guest agent for time sync")
-- 
2.24.1





More information about the virt-tools-list mailing list