mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virtManager: object: domain: Add timeout config
Make the guest agent wait timeout and sleep interval properties of the thread manager class better visibility and easier adjustment. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
This commit is contained in:
parent
bfafe1e4b2
commit
9aa5997dd7
@ -191,6 +191,8 @@ class _vmmDomainSetTimeThread(vmmGObject):
|
|||||||
self._do_cancel = threading.Event()
|
self._do_cancel = threading.Event()
|
||||||
self._do_cancel.clear()
|
self._do_cancel.clear()
|
||||||
self._thread = None
|
self._thread = None
|
||||||
|
self._maxwait = 5
|
||||||
|
self._sleep = 0.5
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""
|
"""
|
||||||
@ -239,17 +241,15 @@ class _vmmDomainSetTimeThread(vmmGObject):
|
|||||||
# Setting time of a qemu domain can only work if an agent is
|
# 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
|
# defined and online. We only get here if one is defined. So wait
|
||||||
# for it to come online now.
|
# for it to come online now.
|
||||||
maxwait = 5
|
|
||||||
sleep = 0.5
|
|
||||||
waited = 0
|
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...")
|
log.debug("Waiting for qemu guest agent to come online...")
|
||||||
|
|
||||||
# sleep some time and potentially abort
|
# sleep some time and potentially abort
|
||||||
if self._do_cancel.wait(sleep):
|
if self._do_cancel.wait(self._sleep):
|
||||||
return
|
return
|
||||||
|
|
||||||
waited += sleep
|
waited += self._sleep
|
||||||
|
|
||||||
if not self._domain.agent_ready():
|
if not self._domain.agent_ready():
|
||||||
log.debug("Giving up on qemu guest agent for time sync")
|
log.debug("Giving up on qemu guest agent for time sync")
|
||||||
|
Loading…
Reference in New Issue
Block a user