mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
qemu: snapshot: Reject internal active snapshot without memory state
A internal snapshot of a active VM with the memory snapshot disabled explicitly would actually still take the memory snapshot. Reject it explicitly. Before: $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=no Domain snapshot 1401353155 created After: $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=no error: Operation not supported: internal snapshot of a running VM must include the memory state Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1083345
This commit is contained in:
parent
4a051b807e
commit
d2e668e535
@ -13495,6 +13495,15 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
align_match = false;
|
align_match = false;
|
||||||
} else {
|
} else {
|
||||||
def->state = virDomainObjGetState(vm, NULL);
|
def->state = virDomainObjGetState(vm, NULL);
|
||||||
|
|
||||||
|
if (virDomainObjIsActive(vm) &&
|
||||||
|
def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE) {
|
||||||
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
|
_("internal snapshot of a running VM "
|
||||||
|
"must include the memory state"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
def->memory = (def->state == VIR_DOMAIN_SHUTOFF ?
|
def->memory = (def->state == VIR_DOMAIN_SHUTOFF ?
|
||||||
VIR_DOMAIN_SNAPSHOT_LOCATION_NONE :
|
VIR_DOMAIN_SNAPSHOT_LOCATION_NONE :
|
||||||
VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL);
|
VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user