mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
qemu_snapshot: fix reverting external snapshot when not all disks are included
We need to skip all disks that have snapshot type other than 'external'. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
2f3e582a1a
commit
2300e38e18
@ -2054,6 +2054,9 @@ qemuSnapshotRevertExternalPrepare(virDomainObj *vm,
|
||||
virDomainSnapshotDiskDef *snapdisk = &tmpsnapdef->disks[i];
|
||||
virDomainDiskDef *domdisk = domdef->disks[i];
|
||||
|
||||
if (snapdisk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
|
||||
continue;
|
||||
|
||||
if (qemuSnapshotPrepareDiskExternal(domdisk, snapdisk, active, false) < 0)
|
||||
return -1;
|
||||
}
|
||||
@ -2094,6 +2097,9 @@ qemuSnapshotRevertExternalActive(virDomainObj *vm,
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < tmpsnapdef->ndisks; i++) {
|
||||
if (tmpsnapdef->disks[i].snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
|
||||
continue;
|
||||
|
||||
if (qemuSnapshotDiskPrepareOne(snapctxt,
|
||||
vm->def->disks[i],
|
||||
tmpsnapdef->disks + i,
|
||||
@ -2184,6 +2190,9 @@ qemuSnapshotRevertExternalFinish(virDomainObj *vm,
|
||||
for (i = 0; i < curdef->nrevertdisks; i++) {
|
||||
virDomainSnapshotDiskDef *snapdisk = &(curdef->revertdisks[i]);
|
||||
|
||||
if (snapdisk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
|
||||
continue;
|
||||
|
||||
if (virStorageSourceInit(snapdisk->src) < 0 ||
|
||||
virStorageSourceUnlink(snapdisk->src) < 0) {
|
||||
VIR_WARN("Failed to remove snapshot image '%s'",
|
||||
@ -2199,6 +2208,9 @@ qemuSnapshotRevertExternalFinish(virDomainObj *vm,
|
||||
for (i = 0; i < curdef->ndisks; i++) {
|
||||
virDomainSnapshotDiskDef *snapdisk = &(curdef->disks[i]);
|
||||
|
||||
if (snapdisk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
|
||||
continue;
|
||||
|
||||
if (virStorageSourceInit(snapdisk->src) < 0 ||
|
||||
virStorageSourceUnlink(snapdisk->src) < 0) {
|
||||
VIR_WARN("Failed to remove snapshot image '%s'",
|
||||
|
Loading…
x
Reference in New Issue
Block a user