[virt-tools-list] [virt-manager PATCH v2 0/6] Set guest time asynchronously

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


Hello Cole,

here's an updated series that reworks the time setting into a separate
thread.

>         while self._thread and self._thread.isAlive():
>            self._do_cancel = True
>        self._do_cancel = False

I've replaced that construct with threading.Event and threading.Thread.join():

+        self._do_cancel.set()
+        # thread may be in a loop waiting for an agent to come online or just
+        # waiting for a set time operation to finish
+        self._thread.join()
+        self._thread = None
+        self._do_cancel.clear()

With either I'm not sure what the fallout would be if the thread took
very long to terminate for whatever reason. I guess, the async job
dialog would stay on screen until it does. I can't think of any reaosn
why it wouldn't terminate though.

> You could probably do this refactoring first with the existing code,
> then second commit adds the thread usage. First pass stop() would be empty.

I've done my best to keep the individual patches contained, particularly
to have a refactor patch that just moves code but does not change
semantics. Let me know if there's anything that should be improved
still.

I've also added a final patch that wires up stopping of the time setting
operation in actions where it doesn't make any sense any more to
continue trying. I'm not too sure about e.g. migrate but just went with
all that also set self._install_abort plus suspend.

Michael Weiser (6):
  virtManager: object: domain: Simplify agent ready check
  virtManager: object: domain: Refactor guest time setting
  virtManager: object: domain: Spawn thread for set time
  virtManager: object: domain: Add timeout config
  virtManager: object: domain: Increase set time timeout
  virtManager: object: domain: Stop set time thread

 virtManager/object/domain.py | 149 +++++++++++++++++++++++++++--------
 1 file changed, 116 insertions(+), 33 deletions(-)

-- 
2.24.1





More information about the virt-tools-list mailing list