mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: snapshot: Fix return value of external checkpoint with no disks
When doing an external checkpoint of a VM with no disk selected we'd return failure but not set error code. This was a result of ret not being set to 0 during walking of the disk array. Rework early failure checking and set the error code to success before iterating the array of disks so that we return success if no disks are snapshotted. Fixes the following symptom (or without --diskspec for diskless VMs) $ virsh snapshot-create-as snapshot-test --memspec /tmp/asdf --diskspec hda,snapshot=no error: An error occurred, but the cause is unknown
This commit is contained in:
parent
91b7e06865
commit
cb6681ff1d
@ -13010,17 +13010,17 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virJSONValuePtr actions = NULL;
|
||||
int ret = -1;
|
||||
int ret = 0;
|
||||
size_t i;
|
||||
bool persist = false;
|
||||
bool reuse = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0;
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
virQEMUDriverConfigPtr cfg = NULL;
|
||||
virErrorPtr orig_err = NULL;
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
|
||||
@ -13030,9 +13030,11 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("live disk snapshot not supported with this "
|
||||
"QEMU binary"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
cfg = virQEMUDriverGetConfig(driver);
|
||||
|
||||
/* No way to roll back if first disk succeeds but later disks
|
||||
* fail, unless we have transaction support.
|
||||
* Based on earlier qemuDomainSnapshotPrepare, all
|
||||
|
Loading…
x
Reference in New Issue
Block a user