render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 2726e0de1158ab7788f16cd91df53a48b882a716 Mon Sep 17 00:00:00 2001
Message-Id: <2726e0de1158ab7788f16cd91df53a48b882a716@dist-git>
From: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Date: Fri, 1 Sep 2017 09:49:27 +0300
Subject: [PATCH] qemu: start all async job with job status active

Setting status to none has little value - getting job status
will not return even elapsed time.

After this patch getting job stats stays correct in a sence
it will not fetch migration stats because it consults
stats.status before doing the fetch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit b6868c3cdd711e012c6cb1ec0e0a3cac4ea92a33)

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

Conflicts:
	src/qemu/qemu_migration.c
            - commit e87d4b9e2f is not backported

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_domain.c    | 1 +
 src/qemu/qemu_driver.c    | 2 --
 src/qemu/qemu_migration.c | 4 ----
 src/qemu/qemu_process.c   | 4 ----
 4 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 329ec6e2ce..4b1ead7d0a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3811,6 +3811,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
         qemuDomainObjResetAsyncJob(priv);
         if (VIR_ALLOC(priv->job.current) < 0)
             goto cleanup;
+        priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
         priv->job.asyncJob = asyncJob;
         priv->job.asyncOwner = virThreadSelfID();
         priv->job.asyncOwnerAPI = virThreadJobGet();
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ecba87a121..8972897a28 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3299,8 +3299,6 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
         goto endjob;
     }
 
-    priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
-
     /* Pause */
     if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
         was_running = true;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 1726349f94..9f7aad6680 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1563,7 +1563,6 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
 
     flags |= QEMU_MIGRATION_COMPLETED_UPDATE_STATS;
 
-    jobInfo->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
     while ((rv = qemuMigrationCompleted(driver, vm, asyncJob,
                                         dconn, flags)) != 1) {
         if (rv < 0)
@@ -5624,7 +5623,6 @@ qemuMigrationJobStart(virQEMUDriverPtr driver,
                       virDomainObjPtr vm,
                       qemuDomainAsyncJob job)
 {
-    qemuDomainObjPrivatePtr priv = vm->privateData;
     virDomainJobOperation op;
     unsigned long long mask;
 
@@ -5642,8 +5640,6 @@ qemuMigrationJobStart(virQEMUDriverPtr driver,
         return -1;
 
     qemuDomainObjSetAsyncJobMask(vm, mask);
-    priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
-
     return 0;
 }
 
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 25de367afc..1633652fdc 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3943,15 +3943,11 @@ qemuProcessBeginJob(virQEMUDriverPtr driver,
                     virDomainObjPtr vm,
                     virDomainJobOperation operation)
 {
-    qemuDomainObjPrivatePtr priv = vm->privateData;
-
     if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_START,
                                    operation) < 0)
         return -1;
 
     qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_NONE);
-    priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
-
     return 0;
 }
 
-- 
2.15.1