[PATCH 02/11] qemu & hypervisor: move qemuDomainObjResetAsyncJob() into hypervisor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch moves qemuDomainObjResetAsyncJob() as
virDomainObjResetAsyncJob() into hypervisor.

Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
 src/hypervisor/domain_job.c | 19 +++++++++++++++++++
 src/hypervisor/domain_job.h |  2 ++
 src/libvirt_private.syms    |  1 +
 src/qemu/qemu_domainjob.c   | 29 +++++------------------------
 4 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/src/hypervisor/domain_job.c b/src/hypervisor/domain_job.c
index 9fbea500c4..1cd9b8d728 100644
--- a/src/hypervisor/domain_job.c
+++ b/src/hypervisor/domain_job.c
@@ -9,6 +9,7 @@
 #include <string.h>
 
 #include "domain_job.h"
+#include "viralloc.h"
 
 
 VIR_ENUM_IMPL(virDomainJob,
@@ -155,3 +156,21 @@ virDomainObjResetAgentJob(virDomainJobObj *job)
     g_clear_pointer(&job->agentOwnerAPI, g_free);
     job->agentStarted = 0;
 }
+
+void
+virDomainObjResetAsyncJob(virDomainJobObj *job)
+{
+    job->asyncJob = VIR_ASYNC_JOB_NONE;
+    job->asyncOwner = 0;
+    g_clear_pointer(&job->asyncOwnerAPI, g_free);
+    job->asyncStarted = 0;
+    job->phase = 0;
+    job->mask = VIR_JOB_DEFAULT_MASK;
+    job->abortJob = false;
+    VIR_FREE(job->error);
+    g_clear_pointer(&job->current, virDomainJobDataFree);
+    job->apiFlags = 0;
+
+    if (job->cb)
+        job->cb->resetJobPrivate(job->privateData);
+}
diff --git a/src/hypervisor/domain_job.h b/src/hypervisor/domain_job.h
index 7a9197cbde..f857fccce2 100644
--- a/src/hypervisor/domain_job.h
+++ b/src/hypervisor/domain_job.h
@@ -212,3 +212,5 @@ int virDomainObjInitJob(virDomainJobObj *job,
 void virDomainObjResetJob(virDomainJobObj *job);
 
 void virDomainObjResetAgentJob(virDomainJobObj *job);
+
+void virDomainObjResetAsyncJob(virDomainJobObj *job);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a50f9aea28..a8b9d5249f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1592,6 +1592,7 @@ virDomainJobTypeFromString;
 virDomainJobTypeToString;
 virDomainObjInitJob;
 virDomainObjResetAgentJob;
+virDomainObjResetAsyncJob;
 virDomainObjResetJob;
 
 
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 0f3b38108c..132f2a0025 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -150,25 +150,6 @@ qemuDomainEventEmitJobCompleted(virQEMUDriver *driver,
 }
 
 
-static void
-qemuDomainObjResetAsyncJob(virDomainJobObj *job)
-{
-    job->asyncJob = VIR_ASYNC_JOB_NONE;
-    job->asyncOwner = 0;
-    g_clear_pointer(&job->asyncOwnerAPI, g_free);
-    job->asyncStarted = 0;
-    job->phase = 0;
-    job->mask = VIR_JOB_DEFAULT_MASK;
-    job->abortJob = false;
-    VIR_FREE(job->error);
-    g_clear_pointer(&job->current, virDomainJobDataFree);
-    job->apiFlags = 0;
-
-    if (job->cb)
-        job->cb->resetJobPrivate(job->privateData);
-}
-
-
 /**
  * qemuDomainObjPreserveJob
  * @param obj domain with a job that needs to be preserved
@@ -200,7 +181,7 @@ qemuDomainObjPreserveJob(virDomainObj *obj,
     job->cb = priv->job.cb;
 
     virDomainObjResetJob(&priv->job);
-    qemuDomainObjResetAsyncJob(&priv->job);
+    virDomainObjResetAsyncJob(&priv->job);
     return 0;
 }
 
@@ -244,7 +225,7 @@ void
 qemuDomainObjClearJob(virDomainJobObj *job)
 {
     virDomainObjResetJob(job);
-    qemuDomainObjResetAsyncJob(job);
+    virDomainObjResetAsyncJob(job);
     g_clear_pointer(&job->current, virDomainJobDataFree);
     g_clear_pointer(&job->completed, virDomainJobDataFree);
     virCondDestroy(&job->cond);
@@ -753,7 +734,7 @@ qemuDomainObjDiscardAsyncJob(virDomainObj *obj)
 
     if (priv->job.active == VIR_JOB_ASYNC_NESTED)
         virDomainObjResetJob(&priv->job);
-    qemuDomainObjResetAsyncJob(&priv->job);
+    virDomainObjResetAsyncJob(&priv->job);
     qemuDomainSaveStatus(obj);
 }
 
@@ -914,7 +895,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
             VIR_DEBUG("Started async job: %s (vm=%p name=%s)",
                       virDomainAsyncJobTypeToString(asyncJob),
                       obj, obj->def->name);
-            qemuDomainObjResetAsyncJob(&priv->job);
+            virDomainObjResetAsyncJob(&priv->job);
             priv->job.current = virDomainJobDataInit(&qemuJobDataPrivateDataCallbacks);
             priv->job.current->status = VIR_DOMAIN_JOB_STATUS_ACTIVE;
             priv->job.asyncJob = asyncJob;
@@ -1198,7 +1179,7 @@ qemuDomainObjEndAsyncJob(virDomainObj *obj)
               virDomainAsyncJobTypeToString(priv->job.asyncJob),
               obj, obj->def->name);
 
-    qemuDomainObjResetAsyncJob(&priv->job);
+    virDomainObjResetAsyncJob(&priv->job);
     qemuDomainSaveStatus(obj);
     virCondBroadcast(&priv->job.asyncCond);
 }
-- 
2.37.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux