]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: fail querying destination migration statistics always
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Fri, 1 Sep 2017 06:49:26 +0000 (09:49 +0300)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 7 Sep 2017 09:13:04 +0000 (11:13 +0200)
Querying destination migration statistics may result in getting
a failure or getting a elapsed time value depending on stats.status
value which is odd. Instead let's always fail. Clients should
be ready to handle this as currently getting failure period
can be considerable.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_driver.c

index 2cc5f4eb020df01cf90383e2c6ce63e9ca6cc664..852121b31170e5b26e728ecd3022ce7fe1a6499b 100644 (file)
@@ -12987,20 +12987,19 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
         return 0;
     }
 
+    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;
+    }
+
     /* Do not ask QEMU if migration is not even running yet  */
     if (!priv->job.current || !priv->job.current->stats.status)
         fetch = false;
 
-    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 (fetch && qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
+        return -1;
 
     if (!virDomainObjIsActive(vm)) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",