[libvirt] [PATCH] qemu: migration: Don't crash on access to 'current' job

Peter Krempa pkrempa at redhat.com
Fri Apr 27 14:26:36 UTC 2018


When a VM is destroyed while being migrated (waiting in
qemuMigrationSrcWaitForCompletion) the private object cleanup code frees
the 'current' job info. Since the migration code attempts to setup
various aspects of the current job even on failure this results into a
crash.

Job data is cleared in qemuDomainObjPrivateDataClear since commit
888aa4b6b9db

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
I'm not certain that there isn't any other bigger root cause for this,
but if the job is not present due to the VM being destroyed, it does not
make much sense to set any data.

 src/qemu/qemu_migration.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 88b8253fa9..9f4de08d46 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3552,6 +3552,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
     orig_err = virSaveLastError();

     if (cancel &&
+        priv->job.current &&
         priv->job.current->status != QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED &&
         virDomainObjIsActive(vm) &&
         qemuDomainObjEnterMonitorAsync(driver, vm,
@@ -3569,7 +3570,8 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
     if (iothread)
         qemuMigrationSrcStopTunnel(iothread, true);

-    if (priv->job.current->status != QEMU_DOMAIN_JOB_STATUS_CANCELED)
+    if (priv->job.current &&
+        priv->job.current->status != QEMU_DOMAIN_JOB_STATUS_CANCELED)
         priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_FAILED;

     goto cleanup;
-- 
2.16.2




More information about the libvir-list mailing list