
On Tue, Jul 16, 2024 at 10:27:29 +0200, Denis V. Lunev via Devel wrote:
On 7/16/24 00:42, Nikolai Barybin wrote:
The usage of HMP commands are highly discouraged by qemu. Moreover, current snapshot creation routine does not provide flexibility in choosing target device for VM state snapshot.
This patch makes use of QMP commands snapshot-save/delete and by default chooses first writable disk (if present) as target for VM state, NVRAM - otherwise.
Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com> --- src/qemu/qemu_snapshot.c | 158 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 148 insertions(+), 10 deletions(-)
[...]
@@ -342,15 +432,17 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver, } } - if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_SNAPSHOT) < 0) { + if ((ret = qemuSnapshotCreateActiveInternalStart(vm, snap->def->name)) < 0) { resume = false; goto cleanup; } - ret = qemuMonitorCreateSnapshot(priv->mon, snap->def->name); - qemuDomainObjExitMonitor(vm); - if (ret < 0) - goto cleanup;
'snapshot-save' has been added in QEMU 6.0. Right now we are at 8.2
Should we still support pre 6.0 versions, i.e. check the availability of the command via proper capability?
Libvirt currently supports qemu-5.2 as the oldest version, and since that does not yet support the new commands we will need to use capabilities and retain the old code. This also means that patch 4/4 must be dropped as it's required for that one release unfortunately. qemu-5.2 seems to be currently the version in Debian 11 and openSUSE Leap 15.3 per commit 073bf167843ca2e788cbc581781c729ff26c80f5 which bumped it recently