[PATCH 05/11] qemu & hypervisor: move qemuDomainObjClearJob() into hypervisor

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

 



This patch moves qemuDomainObjClearJob() as
virDomainObjClearJob() into hypervisor in order to be used by
other hypervisors as well.

Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
 src/hypervisor/domain_job.c | 14 ++++++++++++++
 src/hypervisor/domain_job.h |  3 +++
 src/libvirt_private.syms    |  1 +
 src/qemu/qemu_domain.c      |  2 +-
 src/qemu/qemu_domainjob.c   | 14 --------------
 src/qemu/qemu_domainjob.h   |  3 ---
 6 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/src/hypervisor/domain_job.c b/src/hypervisor/domain_job.c
index 804a58047f..2a19811670 100644
--- a/src/hypervisor/domain_job.c
+++ b/src/hypervisor/domain_job.c
@@ -206,3 +206,17 @@ virDomainObjPreserveJob(virDomainJobObj *currJob,
     virDomainObjResetAsyncJob(currJob);
     return 0;
 }
+
+void
+virDomainObjClearJob(virDomainJobObj *job)
+{
+    virDomainObjResetJob(job);
+    virDomainObjResetAsyncJob(job);
+    g_clear_pointer(&job->current, virDomainJobDataFree);
+    g_clear_pointer(&job->completed, virDomainJobDataFree);
+    virCondDestroy(&job->cond);
+    virCondDestroy(&job->asyncCond);
+
+    if (job->cb)
+        g_clear_pointer(&job->privateData, job->cb->freeJobPrivate);
+}
diff --git a/src/hypervisor/domain_job.h b/src/hypervisor/domain_job.h
index 44e4bfdb4a..53ce6706d4 100644
--- a/src/hypervisor/domain_job.h
+++ b/src/hypervisor/domain_job.h
@@ -217,3 +217,6 @@ void virDomainObjResetAsyncJob(virDomainJobObj *job);
 
 int virDomainObjPreserveJob(virDomainJobObj *currJob,
                             virDomainJobObj *job);
+
+void virDomainObjClearJob(virDomainJobObj *job);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virDomainJobObj, virDomainObjClearJob);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index edfa38c857..0e355abd69 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1590,6 +1590,7 @@ virDomainJobDataInit;
 virDomainJobStatusToType;
 virDomainJobTypeFromString;
 virDomainJobTypeToString;
+virDomainObjClearJob;
 virDomainObjInitJob;
 virDomainObjPreserveJob;
 virDomainObjResetAgentJob;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a53c25f36e..8beb2f31c1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1716,7 +1716,7 @@ qemuDomainObjPrivateFree(void *data)
     qemuDomainObjPrivateDataClear(priv);
 
     virObjectUnref(priv->monConfig);
-    qemuDomainObjClearJob(&priv->job);
+    virDomainObjClearJob(&priv->job);
     g_free(priv->lockState);
     g_free(priv->origname);
 
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 4b8ba3f0bc..f323f28c77 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -185,20 +185,6 @@ qemuDomainObjRestoreAsyncJob(virDomainObj *vm,
 }
 
 
-void
-qemuDomainObjClearJob(virDomainJobObj *job)
-{
-    virDomainObjResetJob(job);
-    virDomainObjResetAsyncJob(job);
-    g_clear_pointer(&job->current, virDomainJobDataFree);
-    g_clear_pointer(&job->completed, virDomainJobDataFree);
-    virCondDestroy(&job->cond);
-    virCondDestroy(&job->asyncCond);
-
-    if (job->cb)
-        g_clear_pointer(&job->privateData, job->cb->freeJobPrivate);
-}
-
 bool
 qemuDomainTrackJob(virDomainJob job)
 {
diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h
index 6272f9d845..eed94cd87c 100644
--- a/src/qemu/qemu_domainjob.h
+++ b/src/qemu/qemu_domainjob.h
@@ -133,9 +133,6 @@ int qemuDomainJobDataToParams(virDomainJobData *jobData,
 
 bool qemuDomainTrackJob(virDomainJob job);
 
-void qemuDomainObjClearJob(virDomainJobObj *job);
-G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virDomainJobObj, qemuDomainObjClearJob);
-
 int
 qemuDomainObjPrivateXMLFormatJob(virBuffer *buf,
                                  virDomainObj *vm);
-- 
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