mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 23:37:42 +00:00
qemu: fix return value of qemuDomainBlockPivot on errors
If qemuMonitorBlockJob returned 0, qemuDomainBlockPivot might return 0 even if an error occured. https://bugzilla.redhat.com/show_bug.cgi?id=977678 (cherry picked from commit c34107dfd3a25232255e6d6f559b1306ef99bb3b)
This commit is contained in:
parent
92ea2fe0ad
commit
914fedaa6b
@ -13154,7 +13154,7 @@ qemuDomainBlockPivot(virConnectPtr conn,
|
|||||||
virQEMUDriverPtr driver, virDomainObjPtr vm,
|
virQEMUDriverPtr driver, virDomainObjPtr vm,
|
||||||
const char *device, virDomainDiskDefPtr disk)
|
const char *device, virDomainDiskDefPtr disk)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1, rc;
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
virDomainBlockJobInfo info;
|
virDomainBlockJobInfo info;
|
||||||
const char *format = virStorageFileFormatTypeToString(disk->mirrorFormat);
|
const char *format = virStorageFileFormatTypeToString(disk->mirrorFormat);
|
||||||
@ -13167,17 +13167,17 @@ qemuDomainBlockPivot(virConnectPtr conn,
|
|||||||
/* Probe the status, if needed. */
|
/* Probe the status, if needed. */
|
||||||
if (!disk->mirroring) {
|
if (!disk->mirroring) {
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
ret = qemuMonitorBlockJob(priv->mon, device, NULL, 0, &info,
|
rc = qemuMonitorBlockJob(priv->mon, device, NULL, 0, &info,
|
||||||
BLOCK_JOB_INFO, true);
|
BLOCK_JOB_INFO, true);
|
||||||
qemuDomainObjExitMonitor(driver, vm);
|
qemuDomainObjExitMonitor(driver, vm);
|
||||||
if (ret < 0)
|
if (rc < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (!virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("domain is not running"));
|
_("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (ret == 1 && info.cur == info.end &&
|
if (rc == 1 && info.cur == info.end &&
|
||||||
info.type == VIR_DOMAIN_BLOCK_JOB_TYPE_COPY)
|
info.type == VIR_DOMAIN_BLOCK_JOB_TYPE_COPY)
|
||||||
disk->mirroring = true;
|
disk->mirroring = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user