Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
src/hypervisor/domain_job.c | 8 ++++++++
src/hypervisor/domain_job.h | 2 ++
src/libvirt_private.syms | 1 +
src/qemu/qemu_domainjob.c | 14 +++-----------
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/hypervisor/domain_job.c b/src/hypervisor/domain_job.c
index 08e84d575f..6a7116fb2a 100644
--- a/src/hypervisor/domain_job.c
+++ b/src/hypervisor/domain_job.c
@@ -226,3 +226,11 @@ virDomainTrackJob(virDomainJob job)
{
return (VIR_DOMAIN_TRACK_JOBS & JOB_MASK(job)) != 0;
}
+
+bool
+virDomainNestedJobAllowed(virDomainJobObj *jobs, virDomainJob newJob)
+{
+ return !jobs->asyncJob ||
+ newJob == VIR_JOB_NONE ||
+ (jobs->mask & JOB_MASK(newJob));
+}
diff --git a/src/hypervisor/domain_job.h b/src/hypervisor/domain_job.h
index 824876b460..618fba45bd 100644
--- a/src/hypervisor/domain_job.h
+++ b/src/hypervisor/domain_job.h
@@ -222,3 +222,5 @@ void virDomainObjClearJob(virDomainJobObj *job);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virDomainJobObj, virDomainObjClearJob);
bool virDomainTrackJob(virDomainJob job);
+
+bool virDomainNestedJobAllowed(virDomainJobObj *jobs, virDomainJob newJob);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4c35e2a945..16117970f2 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1590,6 +1590,7 @@ virDomainJobDataInit;
virDomainJobStatusToType;
virDomainJobTypeFromString;
virDomainJobTypeToString;
+virDomainNestedJobAllowed;
virDomainObjClearJob;
virDomainObjInitJob;
virDomainObjPreserveJob;
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index f92ec44cb7..46fb2d704b 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -697,14 +697,6 @@ qemuDomainObjReleaseAsyncJob(virDomainObj *obj)
priv->job.asyncOwner = 0;
}
-static bool
-qemuDomainNestedJobAllowed(virDomainJobObj *jobs, virDomainJob newJob)
-{
- return !jobs->asyncJob ||
- newJob == VIR_JOB_NONE ||
- (jobs->mask & JOB_MASK(newJob)) != 0;
-}
-
static bool
qemuDomainObjCanSetJob(virDomainJobObj *job,
virDomainJob newJob,
@@ -787,7 +779,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
goto error;
}
- while (!nested && !qemuDomainNestedJobAllowed(&priv->job, job)) {
+ while (!nested && !virDomainNestedJobAllowed(&priv->job, job)) {
if (nowait)
goto cleanup;
@@ -807,7 +799,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
/* No job is active but a new async job could have been started while obj
* was unlocked, so we need to recheck it. */
- if (!nested && !qemuDomainNestedJobAllowed(&priv->job, job))
+ if (!nested && !virDomainNestedJobAllowed(&priv->job, job))
goto retry;
if (obj->removing) {
@@ -896,7 +888,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
duration / 1000, agentDuration / 1000, asyncDuration / 1000);
if (job) {
- if (nested || qemuDomainNestedJobAllowed(&priv->job, job))
+ if (nested || virDomainNestedJobAllowed(&priv->job, job))
blocker = priv->job.ownerAPI;
else
blocker = priv->job.asyncOwnerAPI;
--
2.37.1