qemuSnapshotForEachQcow2: Handle also NVRAM image for internal snapshots

The live VM snapshot code already does handle the NVRAM image when it's
in use, so we should also handle it when modifying/creating the
snapshots via qemu-img when inactive.

Add the handling to qemuSnapshotForEachQcow2 which is used for all
inactive operations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2024-11-12 13:22:39 +01:00
parent 5ca0552d31
commit c82dd60b2e

View File

@ -347,6 +347,26 @@ qemuSnapshotForEachQcow2(virDomainDef *def,
}
}
if (def->os.loader && def->os.loader->nvram) {
virStorageSource *nvram = def->os.loader->nvram;
if (virStorageSourceIsLocalStorage(nvram) &&
nvram->format == VIR_STORAGE_FILE_QCOW2) {
if (qemuSnapshotForEachQcow2One(nvram, op, snap->def->name) < 0) {
if (create) {
nrollback = def->ndisks;
virErrorPreserveLast(&orig_err);
goto rollback;
} else {
VIR_WARN("failed 'qemu-img snapshot %s' action on NVRAM image",
op);
skipped = true;
virResetLastError();
}
}
}
}
return skipped ? 1 : 0;
rollback: