qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Observing VM Status Changes


From: John Snow
Subject: Observing VM Status Changes
Date: Mon, 29 Nov 2021 14:42:42 -0500

Is there a generic event for observing VM state changes? I see we have a lot of bespoke events like "STOP", "RESUME", "SHUTDOWN" and so forth, but I can't quickly and at a glance determine if we have a 1:1 correlation for every QAPI RunState to a QMP Event announcing that state.

I'm looking at e.g. the PAUSED runstate and I can see it set in several places:

migration/migration.c:            runstate_set(RUN_STATE_PAUSED);
migration/savevm.c:        runstate_set(RUN_STATE_PAUSED);

but for, say, the migration/savevm.c route, it doesn't look like it's accompanied by a QMP event -- that appears to only be emitted by softmmu/cpus.c -- and only when the vcpus were already running. In this case, the savevm route only occurs before we've started the vCPUs.

So as far as I can tell, there's really no well-defined relationship between the various events in qapi/run-state.json and the RunState enumeration. This would make it hard for a client to keep track of the VM state without having to re-query it a lot. Am I mistaken?

(I was looking into adding VM state into the qmp-shell tool such that it spied on QMP events and updated a toolbar accordingly. However, not every state seems to be preceded by an event, and not every event gives a strong indication of what the resulting VM state would actually be. Some runstate changes don't appear to be announced by any event at all.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]