]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: set jobinfo type to CANCELLED if migration is cancelled in all conditions
authorWang Rui <moon.wangrui@huawei.com>
Mon, 1 Dec 2014 07:05:32 +0000 (15:05 +0800)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 1 Dec 2014 07:17:24 +0000 (08:17 +0100)
The migration job status is traced in qemuMigrationUpdateJobStatus
which is called in qemuMigrationRun. But if migration is cancelled
before the trace such as in qemuMigrationDriveMirror, the jobinfo
type won't be updated to CANCELLED. After this patch, we can get
jobinfo type CANCELLED if migration is cancelled during drive
mirror.  Moreover, we can't use qemuMigrationUpdateJobStatus
because from qemu's point of view it's just the drive mirror being
cancelled and the migration hasn't even started yet.

Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
src/qemu/qemu_migration.c

index 74cda96cd6bf8eb47413da3846a2939ebf072419..3c47d7c90cb4ffe824aa913c7a52e84d7b642601 100644 (file)
@@ -1504,6 +1504,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
                  * as this is a critical section so we are guaranteed
                  * priv->job.asyncAbort will not change */
                 qemuDomainObjExitMonitor(driver, vm);
+                priv->job.current->type = VIR_DOMAIN_JOB_CANCELLED;
                 virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"),
                                qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
                                _("canceled by client"));
@@ -3611,6 +3612,7 @@ qemuMigrationRun(virQEMUDriverPtr driver,
          * as this is a critical section so we are guaranteed
          * priv->job.asyncAbort will not change */
         qemuDomainObjExitMonitor(driver, vm);
+        priv->job.current->type = VIR_DOMAIN_JOB_CANCELLED;
         virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"),
                        qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
                        _("canceled by client"));