When the VM is inactive the 'virStorageSource' struct doesn't have the
necessary data pointing to the actual storage. This is a problem for
inactive snapshot operations on VMs which use disk type='volume'.
Add the translation steps for reversion and deletion of snapshots.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
1977155
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/202
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
if (!metadata_only) {
if (!virDomainObjIsActive(vm)) {
+ size_t i;
/* Ignore any skipped disks */
/* Prefer action on the disks in use at the time the snapshot was
if (!def)
def = vm->def;
+ for (i = 0; i < def->ndisks; i++) {
+ if (virDomainDiskTranslateSourcePool(def->disks[i]) < 0)
+ return -1;
+ }
+
if (qemuDomainSnapshotForEachQcow2(driver, def, snap, "-d", true) < 0)
return -1;
} else {
virDomainObj *vm,
virDomainMomentObj *snap)
{
+ size_t i;
+
/* Prefer action on the disks in use at the time the snapshot was
* created; but fall back to current definition if dealing with a
* snapshot created prior to libvirt 0.9.5. */
if (!def)
def = vm->def;
+ for (i = 0; i < def->ndisks; i++) {
+ if (virDomainDiskTranslateSourcePool(def->disks[i]) < 0)
+ return -1;
+ }
+
/* Try all disks, but report failure if we skipped any. */
if (qemuDomainSnapshotForEachQcow2(driver, def, snap, "-a", true) != 0)
return -1;