[PATCH v2 17/17] qemu & conf: move BeginNestedJob & BeginJobNowait into src/conf

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

 



Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
 src/conf/virdomainjob.c   | 44 +++++++++++++++++++++++++++++++++++++++
 src/conf/virdomainjob.h   |  6 ++++++
 src/libvirt_private.syms  |  2 ++
 src/qemu/qemu_domain.c    |  2 +-
 src/qemu/qemu_domainjob.c | 44 ---------------------------------------
 src/qemu/qemu_domainjob.h |  7 -------
 src/qemu/qemu_driver.c    |  2 +-
 src/qemu/qemu_process.c   |  2 +-
 8 files changed, 55 insertions(+), 54 deletions(-)

diff --git a/src/conf/virdomainjob.c b/src/conf/virdomainjob.c
index feb8c0e971..7915faa125 100644
--- a/src/conf/virdomainjob.c
+++ b/src/conf/virdomainjob.c
@@ -559,6 +559,50 @@ int virDomainObjBeginAsyncJob(virDomainObj *obj,
     return 0;
 }
 
+int
+virDomainObjBeginNestedJob(virDomainObj *obj,
+                            virDomainAsyncJob asyncJob)
+{
+    if (asyncJob != obj->job->asyncJob) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("unexpected async job %d type expected %d"),
+                       asyncJob, obj->job->asyncJob);
+        return -1;
+    }
+
+    if (obj->job->asyncOwner != virThreadSelfID()) {
+        VIR_WARN("This thread doesn't seem to be the async job owner: %llu",
+                 obj->job->asyncOwner);
+    }
+
+    return virDomainObjBeginJobInternal(obj, obj->job,
+                                        VIR_JOB_ASYNC_NESTED,
+                                        VIR_AGENT_JOB_NONE,
+                                        VIR_ASYNC_JOB_NONE,
+                                        false);
+}
+
+/**
+ * virDomainObjBeginJobNowait:
+ *
+ * @obj: domain object
+ * @job: virDomainJob to start
+ *
+ * Acquires job for a domain object which must be locked before
+ * calling. If there's already a job running it returns
+ * immediately without any error reported.
+ *
+ * Returns: see virDomainObjBeginJobInternal
+ */
+int
+virDomainObjBeginJobNowait(virDomainObj *obj,
+                           virDomainJob job)
+{
+    return virDomainObjBeginJobInternal(obj, obj->job, job,
+                                        VIR_AGENT_JOB_NONE,
+                                        VIR_ASYNC_JOB_NONE, true);
+}
+
 /*
  * obj must be locked and have a reference before calling
  *
diff --git a/src/conf/virdomainjob.h b/src/conf/virdomainjob.h
index 3cd02ef4ae..c101334596 100644
--- a/src/conf/virdomainjob.h
+++ b/src/conf/virdomainjob.h
@@ -257,6 +257,12 @@ int virDomainObjBeginAsyncJob(virDomainObj *obj,
                               virDomainJobOperation operation,
                               unsigned long apiFlags)
     G_GNUC_WARN_UNUSED_RESULT;
+int virDomainObjBeginNestedJob(virDomainObj *obj,
+                               virDomainAsyncJob asyncJob)
+    G_GNUC_WARN_UNUSED_RESULT;
+int virDomainObjBeginJobNowait(virDomainObj *obj,
+                               virDomainJob job)
+    G_GNUC_WARN_UNUSED_RESULT;
 
 void virDomainObjEndJob(virDomainObj *obj);
 void virDomainObjEndAgentJob(virDomainObj *obj);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 254abd5084..25794bc2f4 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1191,6 +1191,8 @@ virDomainObjBeginAgentJob;
 virDomainObjBeginAsyncJob;
 virDomainObjBeginJob;
 virDomainObjBeginJobInternal;
+virDomainObjBeginJobNowait;
+virDomainObjBeginNestedJob;
 virDomainObjCanSetJob;
 virDomainObjClearJob;
 virDomainObjEndAgentJob;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 83d78900a6..d7ef23f493 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5968,7 +5968,7 @@ qemuDomainObjEnterMonitorInternal(virDomainObj *obj,
 
     if (asyncJob != VIR_ASYNC_JOB_NONE) {
         int ret;
-        if ((ret = qemuDomainObjBeginNestedJob(obj, asyncJob)) < 0)
+        if ((ret = virDomainObjBeginNestedJob(obj, asyncJob)) < 0)
             return ret;
         if (!virDomainObjIsActive(obj)) {
             virReportError(VIR_ERR_OPERATION_FAILED, "%s",
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 99dcdb49b9..a170fdd97d 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -655,50 +655,6 @@ qemuDomainObjReleaseAsyncJob(virDomainObj *obj)
     obj->job->asyncOwner = 0;
 }
 
-int
-qemuDomainObjBeginNestedJob(virDomainObj *obj,
-                            virDomainAsyncJob asyncJob)
-{
-    if (asyncJob != obj->job->asyncJob) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("unexpected async job %d type expected %d"),
-                       asyncJob, obj->job->asyncJob);
-        return -1;
-    }
-
-    if (obj->job->asyncOwner != virThreadSelfID()) {
-        VIR_WARN("This thread doesn't seem to be the async job owner: %llu",
-                 obj->job->asyncOwner);
-    }
-
-    return virDomainObjBeginJobInternal(obj, obj->job,
-                                        VIR_JOB_ASYNC_NESTED,
-                                        VIR_AGENT_JOB_NONE,
-                                        VIR_ASYNC_JOB_NONE,
-                                        false);
-}
-
-/**
- * qemuDomainObjBeginJobNowait:
- *
- * @obj: domain object
- * @job: virDomainJob to start
- *
- * Acquires job for a domain object which must be locked before
- * calling. If there's already a job running it returns
- * immediately without any error reported.
- *
- * Returns: see qemuDomainObjBeginJobInternal
- */
-int
-qemuDomainObjBeginJobNowait(virDomainObj *obj,
-                            virDomainJob job)
-{
-    return virDomainObjBeginJobInternal(obj, obj->job, job,
-                                        VIR_AGENT_JOB_NONE,
-                                        VIR_ASYNC_JOB_NONE, true);
-}
-
 void
 qemuDomainObjAbortAsyncJob(virDomainObj *obj)
 {
diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h
index 1cf9fcc113..c3de401aa5 100644
--- a/src/qemu/qemu_domainjob.h
+++ b/src/qemu/qemu_domainjob.h
@@ -69,13 +69,6 @@ int qemuDomainAsyncJobPhaseFromString(virDomainAsyncJob job,
 void qemuDomainEventEmitJobCompleted(virQEMUDriver *driver,
                                      virDomainObj *vm);
 
-int qemuDomainObjBeginNestedJob(virDomainObj *obj,
-                                virDomainAsyncJob asyncJob)
-    G_GNUC_WARN_UNUSED_RESULT;
-int qemuDomainObjBeginJobNowait(virDomainObj *obj,
-                                virDomainJob job)
-    G_GNUC_WARN_UNUSED_RESULT;
-
 void qemuDomainObjAbortAsyncJob(virDomainObj *obj);
 void qemuDomainObjSetJobPhase(virDomainObj *obj,
                               int phase);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 379ec95dc5..838ce8e9bd 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18841,7 +18841,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
             int rv;
 
             if (flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT)
-                rv = qemuDomainObjBeginJobNowait(vm, VIR_JOB_QUERY);
+                rv = virDomainObjBeginJobNowait(vm, VIR_JOB_QUERY);
             else
                 rv = virDomainObjBeginJob(vm, VIR_JOB_QUERY);
 
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c0338d25d2..0d11cabf2d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8102,7 +8102,7 @@ void qemuProcessStop(virQEMUDriver *driver,
     virErrorPreserveLast(&orig_err);
 
     if (asyncJob != VIR_ASYNC_JOB_NONE) {
-        if (qemuDomainObjBeginNestedJob(vm, asyncJob) < 0)
+        if (virDomainObjBeginNestedJob(vm, asyncJob) < 0)
             goto cleanup;
     } else if (vm->job->asyncJob != VIR_ASYNC_JOB_NONE &&
                vm->job->asyncOwner == virThreadSelfID() &&
-- 
2.37.2




[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