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

Cole Robinson crobinso at redhat.com
Tue Jan 14 19:23:38 UTC 2020


On 1/3/20 3:12 PM, Michael Weiser wrote:
> 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.
> 

Looks good, I've pushed this now

I added one small patch on top to not log about checking guest agent
status on every loop, it's kinda spammy in the logs. It only logs on the
first check now

Thanks,
Cole




More information about the virt-tools-list mailing list