qemuDomainBlockJobAbort: Don't use 'job-cancel' instead of 'block-job-cancel'

'block-job-cancel' has one very important semantic difference to
'job-cancel', docummented in qemu as:

  Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
  (via the event BLOCK_JOB_READY) that the source and destination are
  synchronized, then the event triggered by this command changes to
  BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
  destination now has a point-in-time copy tied to the time of the cancellation.

Since libvirt advertises the block copy job as having the synchronous
abort feature we must not use 'job-cancel' here.

Fixes: 4817b5ca1d
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-04-21 15:47:59 +02:00
parent 2716d53ee6
commit 59543dfad6

View File

@ -14461,7 +14461,6 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
g_autoptr(qemuBlockJobData) job = NULL;
virDomainObj *vm;
qemuDomainObjPrivate *priv = NULL;
bool blockdev = false;
int ret = -1;
virCheckFlags(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC |
@ -14489,7 +14488,6 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
}
priv = vm->privateData;
blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
if (job->state == QEMU_BLOCKJOB_STATE_ABORTING ||
job->state == QEMU_BLOCKJOB_STATE_PIVOTING) {
@ -14507,9 +14505,6 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
goto endjob;
} else {
qemuDomainObjEnterMonitor(driver, vm);
if (blockdev)
ret = qemuMonitorJobCancel(priv->mon, job->name, false);
else
ret = qemuMonitorBlockJobCancel(priv->mon, job->name, false);
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
ret = -1;