[libvirt] [PATCH] qemu: Don't try to fetch migration stats on destination

Jiri Denemark jdenemar at redhat.com
Mon Feb 29 12:01:54 UTC 2016


Migration statistics are not available on the destination host and
starting a query job during incoming migration is not allowed. Trying to
do that would result in

    Timed out during operation: cannot acquire state change lock (held
    by remoteDispatchDomainMigratePrepare3Params)

error. We should not even try to start the job.

https://bugzilla.redhat.com/show_bug.cgi?id=1278727

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_driver.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 45ff3c0..241de67 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12901,9 +12901,16 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
     if (!priv->job.current || !priv->job.current->stats.status)
         fetch = false;
 
-    if (fetch &&
-        qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
-        return -1;
+    if (fetch) {
+        if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) {
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                           _("migration statistics are available only on "
+                             "the source host"));
+            return -1;
+        }
+        if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
+            return -1;
+    }
 
     if (!completed &&
         !virDomainObjIsActive(vm)) {
-- 
2.7.2




More information about the libvir-list mailing list