mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: blockjob: Call qemuDomainSupportsBlockJobs only on online VMs
Since the qemu capabilities are not initialized for offline VMs the caller might get suboptimal error message: $ virsh blockjob VM PATH --bandwidth 1 error: unsupported configuration: block jobs not supported with this QEMU binary Move the checks after we make sure that the VM is alive.
This commit is contained in:
parent
6280294574
commit
f06d7daaa9
@ -16555,25 +16555,6 @@ qemuDomainBlockPullCommon(virQEMUDriverPtr driver,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuDomainSupportsBlockJobs(vm, &modern) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!modern) {
|
||||
if (base) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("partial block pull not supported with this "
|
||||
"QEMU binary"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (bandwidth) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("setting bandwidth at start of block pull not "
|
||||
"supported with this QEMU binary"));
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -16583,6 +16564,25 @@ qemuDomainBlockPullCommon(virQEMUDriverPtr driver,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (qemuDomainSupportsBlockJobs(vm, &modern) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (!modern) {
|
||||
if (base) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("partial block pull not supported with this "
|
||||
"QEMU binary"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (bandwidth) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("setting bandwidth at start of block pull not "
|
||||
"supported with this QEMU binary"));
|
||||
goto endjob;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(device = qemuDiskPathToAlias(vm, path, &idx)))
|
||||
goto endjob;
|
||||
disk = vm->def->disks[idx];
|
||||
@ -16682,9 +16682,6 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
|
||||
if (virDomainBlockJobAbortEnsureACL(dom->conn, vm->def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainSupportsBlockJobs(vm, &modern) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -16694,6 +16691,9 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (qemuDomainSupportsBlockJobs(vm, &modern) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (!(device = qemuDiskPathToAlias(vm, path, &idx)))
|
||||
goto endjob;
|
||||
disk = vm->def->disks[idx];
|
||||
@ -16896,9 +16896,6 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom,
|
||||
if (virDomainBlockJobSetSpeedEnsureACL(dom->conn, vm->def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainSupportsBlockJobs(vm, &modern) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -16908,6 +16905,9 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (qemuDomainSupportsBlockJobs(vm, &modern) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (!(device = qemuDiskPathToAlias(vm, path, NULL)))
|
||||
goto endjob;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user