On 2/12/21 8:18 AM, Philippe Mathieu-Daudé wrote:
Interesting idea. Does it make sense to have a similar (optional?) check
done in QEMUMachine? This could benefit integration tests, quicker exit
on failure.


That might be the wrong layer to do it in. I am trying to keep QEMUMachine be the mechanisms, not the policy. Not all QEMUMachine instances even have a QMP socket, either.

Having shared code (somewhere) that allows you to do stuff like issue a query status every sec to do a more pro-active heartbeat check on-demand is probably a good idea, though:

e.g.

vm = QEMUManagedMachine(...)
with vm.start_heartbeat() as heartbeat:
    ... do things prone to failure here ...
    ...
    ...
# as of here, the heartbeat has been stopped


It might be worth looking into creating a "value-added" version of QEMUMachine that offers stuff like this, in a manner similar to how iotests has its own extended versions of the QEMUMachine to offer test-specific behavior.

(Patches welcome!)

--js


Reply via email to