[PATCH 04/11] qemu & hypervisor: move qemuDomainObjPreserveJob() into hypervisor

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

 



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

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

diff --git a/src/hypervisor/domain_job.c b/src/hypervisor/domain_job.c
index 1cd9b8d728..804a58047f 100644
--- a/src/hypervisor/domain_job.c
+++ b/src/hypervisor/domain_job.c
@@ -174,3 +174,35 @@ virDomainObjResetAsyncJob(virDomainJobObj *job)
     if (job->cb)
         job->cb->resetJobPrivate(job->privateData);
 }
+
+/**
+ * virDomainObjPreserveJob
+ * @param currJob structure is a job that needs to be preserved
+ * @param job structure where to store job details from @currJob
+ *
+ * Saves the current job details from @currJob to @job and resets the job in @currJob.
+ *
+ * Returns 0 on success, -1 on failure.
+ */
+int
+virDomainObjPreserveJob(virDomainJobObj *currJob,
+                        virDomainJobObj *job)
+{
+    memset(job, 0, sizeof(*job));
+    job->active = currJob->active;
+    job->owner = currJob->owner;
+    job->asyncJob = currJob->asyncJob;
+    job->asyncOwner = currJob->asyncOwner;
+    job->phase = currJob->phase;
+    job->privateData = g_steal_pointer(&currJob->privateData);
+    job->apiFlags = currJob->apiFlags;
+
+    if (currJob->cb &&
+        !(currJob->privateData = currJob->cb->allocJobPrivate()))
+        return -1;
+    job->cb = currJob->cb;
+
+    virDomainObjResetJob(currJob);
+    virDomainObjResetAsyncJob(currJob);
+    return 0;
+}
diff --git a/src/hypervisor/domain_job.h b/src/hypervisor/domain_job.h
index f857fccce2..44e4bfdb4a 100644
--- a/src/hypervisor/domain_job.h
+++ b/src/hypervisor/domain_job.h
@@ -214,3 +214,6 @@ void virDomainObjResetJob(virDomainJobObj *job);
 void virDomainObjResetAgentJob(virDomainJobObj *job);
 
 void virDomainObjResetAsyncJob(virDomainJobObj *job);
+
+int virDomainObjPreserveJob(virDomainJobObj *currJob,
+                            virDomainJobObj *job);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a8b9d5249f..edfa38c857 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1591,6 +1591,7 @@ virDomainJobStatusToType;
 virDomainJobTypeFromString;
 virDomainJobTypeToString;
 virDomainObjInitJob;
+virDomainObjPreserveJob;
 virDomainObjResetAgentJob;
 virDomainObjResetAsyncJob;
 virDomainObjResetJob;
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 260717aa88..4b8ba3f0bc 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -150,39 +150,6 @@ qemuDomainEventEmitJobCompleted(virQEMUDriver *driver,
 }
 
 
-/**
- * qemuDomainObjPreserveJob
- * @param obj domain with a job that needs to be preserved
- * @param job structure where to store job details from @obj
- *
- * Saves the current job details from @obj to @job and resets the job in @obj.
- *
- * Returns 0 on success, -1 on failure.
- */
-int
-qemuDomainObjPreserveJob(virDomainJobObj *currJob,
-                         virDomainJobObj *job)
-{
-    memset(job, 0, sizeof(*job));
-    job->active = currJob->active;
-    job->owner = currJob->owner;
-    job->asyncJob = currJob->asyncJob;
-    job->asyncOwner = currJob->asyncOwner;
-    job->phase = currJob->phase;
-    job->privateData = g_steal_pointer(&currJob->privateData);
-    job->apiFlags = currJob->apiFlags;
-
-    if (currJob->cb &&
-        !(currJob->privateData = currJob->cb->allocJobPrivate()))
-        return -1;
-    job->cb = currJob->cb;
-
-    virDomainObjResetJob(currJob);
-    virDomainObjResetAsyncJob(currJob);
-    return 0;
-}
-
-
 void
 qemuDomainObjRestoreAsyncJob(virDomainObj *vm,
                              virDomainAsyncJob asyncJob,
diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h
index a0cd79c705..6272f9d845 100644
--- a/src/qemu/qemu_domainjob.h
+++ b/src/qemu/qemu_domainjob.h
@@ -105,8 +105,6 @@ qemuDomainObjStartJobPhase(virDomainObj *obj,
                            int phase);
 void qemuDomainObjSetAsyncJobMask(virDomainObj *obj,
                                   unsigned long long allowedJobs);
-int qemuDomainObjPreserveJob(virDomainJobObj *currJob,
-                             virDomainJobObj *job);
 void
 qemuDomainObjRestoreAsyncJob(virDomainObj *vm,
                              virDomainAsyncJob asyncJob,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index fc42434a0d..2010c013a6 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8874,7 +8874,7 @@ qemuProcessReconnect(void *opaque)
     cfg = virQEMUDriverGetConfig(driver);
     priv = obj->privateData;
 
-    qemuDomainObjPreserveJob(&priv->job, &oldjob);
+    virDomainObjPreserveJob(&priv->job, &oldjob);
     if (oldjob.asyncJob == VIR_ASYNC_JOB_MIGRATION_IN)
         stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
     if (oldjob.asyncJob == VIR_ASYNC_JOB_BACKUP && priv->backup)
-- 
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