mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 07:36:19 +00:00
qemu: snapshot: Forbid partial internal snapshots
qemu's savevm command does a snapshot of all non readonly disks of a VM. Libvirt though allowed disabling snapshot for certain disk of a VM.
This commit is contained in:
parent
68c15a4f8b
commit
03b4da131a
@ -12621,6 +12621,7 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
|
|||||||
bool reuse = (*flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0;
|
bool reuse = (*flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0;
|
||||||
bool atomic = (*flags & VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC) != 0;
|
bool atomic = (*flags & VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC) != 0;
|
||||||
bool found_internal = false;
|
bool found_internal = false;
|
||||||
|
bool forbid_internal = false;
|
||||||
int external = 0;
|
int external = 0;
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
|
||||||
@ -12689,6 +12690,9 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_SNAPSHOT_LOCATION_NONE:
|
case VIR_DOMAIN_SNAPSHOT_LOCATION_NONE:
|
||||||
|
/* Remember seeing a disk that has snapshot disabled */
|
||||||
|
if (!dom_disk->readonly)
|
||||||
|
forbid_internal = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT:
|
case VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT:
|
||||||
@ -12699,12 +12703,13 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* internal snapshot requires a disk image to store the memory image to */
|
/* internal snapshot requires a disk image to store the memory image to, and
|
||||||
if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL &&
|
* also disks can't be excluded from an internal snapshot*/
|
||||||
!found_internal) {
|
if ((def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL && !found_internal) ||
|
||||||
|
(found_internal && forbid_internal)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("internal checkpoints require at least "
|
_("internal snapshots and checkpoints require all "
|
||||||
"one disk to be selected for snapshot"));
|
"disks to be selected for snapshot"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user