[libvirt] [PATCH] qemuProcessHandleMigrationStatus: Update migration status on ASYNC_JOB_SAVE too

Michal Privoznik mprivozn at redhat.com
Mon Jul 13 12:20:50 UTC 2015

After Jirka's migration patches libvirt is listening on migration
events from qemu instead of actively polling on the monitor. There is,
however, a little regression (introduced in 6d2edb6a42d0d41). The
problem is, the current status of migration job is updated in
qemuProcessHandleMigrationStatus if and only if migration job was
started. But we have a separate job type for saving a domain into a
file: QEMU_ASYNC_JOB_SAVE. Therefore, since this job is not strictly a
migration job, internal state was not updated and later checks failed:

  virsh # save fedora22 /tmp/fedora22_ble.save
  error: Failed to save domain fedora22 to /tmp/fedora22_ble.save
  error: operation failed: domain save job: is not active

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
 src/qemu/qemu_process.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2a529f7..16d39b2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1521,29 +1521,30 @@ static int
 qemuProcessHandleMigrationStatus(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
                                  virDomainObjPtr vm,
                                  int status,
                                  void *opaque ATTRIBUTE_UNUSED)
     qemuDomainObjPrivatePtr priv;
     VIR_DEBUG("Migration of domain %p %s changed state to %s",
               vm, vm->def->name,
     priv = vm->privateData;
     if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT &&
-        priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_IN) {
+        priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_IN &&
+        priv->job.asyncJob != QEMU_ASYNC_JOB_SAVE) {
         VIR_DEBUG("got MIGRATION event without a migration job");
         goto cleanup;
     priv->job.current->status.status = status;
     return 0;

More information about the libvir-list mailing list