mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Refactor snapshot check for _LIVE vs. _REDEFINE
The current qemu code rejects the combination of the two flags VIR_DOMAIN_SNAPSHOT_CREATE_LIVE in tandem with VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, but rather late in the cycle (after the snapshot was already parsed), and with a rather confusing message (complaining that live snapshots require external storage, even if the redefined snapshot already declares external storage). Hoist the rejection message to occur earlier (before parsing any XML, which also aids upcoming patches that will implement bulk redefine), and with a more typical error message about mutually exclusive flags. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
bf72ee049e
commit
8532ee4a9c
@ -15696,6 +15696,9 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE,
|
VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE,
|
||||||
VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY,
|
VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY,
|
||||||
NULL);
|
NULL);
|
||||||
|
VIR_EXCLUSIVE_FLAGS_RET(VIR_DOMAIN_SNAPSHOT_CREATE_LIVE,
|
||||||
|
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if ((redefine && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) ||
|
if ((redefine && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) ||
|
||||||
(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA))
|
(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA))
|
||||||
@ -15756,8 +15759,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
/* reject the VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag where not supported */
|
/* reject the VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag where not supported */
|
||||||
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_LIVE &&
|
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_LIVE &&
|
||||||
(!virDomainObjIsActive(vm) ||
|
(!virDomainObjIsActive(vm) ||
|
||||||
def->memory != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL ||
|
def->memory != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)) {
|
||||||
redefine)) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
_("live snapshot creation is supported only "
|
_("live snapshot creation is supported only "
|
||||||
"during full system snapshots"));
|
"during full system snapshots"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user