mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
qemu: driver: Blockdevize qemuDomainBlockJobAbort/Pivot
Use job-complete/job-abort instead of the blockjob-* variants for blockdev. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4ed4e35772
commit
4817b5ca1d
@ -16978,6 +16978,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
||||||
|
|
||||||
switch ((qemuBlockJobType) job->type) {
|
switch ((qemuBlockJobType) job->type) {
|
||||||
case QEMU_BLOCKJOB_TYPE_NONE:
|
case QEMU_BLOCKJOB_TYPE_NONE:
|
||||||
@ -17017,6 +17018,9 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
|||||||
* that pivot failed, we need to reflect that failure into the
|
* that pivot failed, we need to reflect that failure into the
|
||||||
* overall return value. */
|
* overall return value. */
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
|
if (blockdev)
|
||||||
|
ret = qemuMonitorJobComplete(priv->mon, job->name);
|
||||||
|
else
|
||||||
ret = qemuMonitorDrivePivot(priv->mon, job->name);
|
ret = qemuMonitorDrivePivot(priv->mon, job->name);
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
|
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -17158,6 +17162,8 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
|
|||||||
bool async = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC);
|
bool async = !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC);
|
||||||
qemuBlockJobDataPtr job = NULL;
|
qemuBlockJobDataPtr job = NULL;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
|
qemuDomainObjPrivatePtr priv = NULL;
|
||||||
|
bool blockdev = false;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC |
|
virCheckFlags(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC |
|
||||||
@ -17184,6 +17190,9 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
|
|||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv = vm->privateData;
|
||||||
|
blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
||||||
|
|
||||||
if (job->state == QEMU_BLOCKJOB_STATE_ABORTING ||
|
if (job->state == QEMU_BLOCKJOB_STATE_ABORTING ||
|
||||||
job->state == QEMU_BLOCKJOB_STATE_PIVOTING) {
|
job->state == QEMU_BLOCKJOB_STATE_PIVOTING) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
@ -17200,7 +17209,10 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
|
|||||||
goto endjob;
|
goto endjob;
|
||||||
} else {
|
} else {
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
ret = qemuMonitorBlockJobCancel(qemuDomainGetMonitor(vm), job->name);
|
if (blockdev)
|
||||||
|
ret = qemuMonitorJobCancel(priv->mon, job->name, false);
|
||||||
|
else
|
||||||
|
ret = qemuMonitorBlockJobCancel(priv->mon, job->name);
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
|
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
Loading…
Reference in New Issue
Block a user