This patch moves qemuDomainObjResetJob() as
virDomainObjResetJob() into hypervisor in order to be used by
other hypervisors as well.
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
src/hypervisor/domain_job.c | 9 +++++++++
src/hypervisor/domain_job.h | 2 ++
src/libvirt_private.syms | 1 +
src/qemu/qemu_domainjob.c | 20 +++++---------------
4 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/src/hypervisor/domain_job.c b/src/hypervisor/domain_job.c
index 1ee70ea11e..5b97624287 100644
--- a/src/hypervisor/domain_job.c
+++ b/src/hypervisor/domain_job.c
@@ -137,3 +137,12 @@ virDomainObjInitJob(virDomainJobObj *job,
return 0;
}
+
+void
+virDomainObjResetJob(virDomainJobObj *job)
+{
+ job->active = VIR_JOB_NONE;
+ job->owner = 0;
+ g_clear_pointer(&job->ownerAPI, g_free);
+ job->started = 0;
+}
diff --git a/src/hypervisor/domain_job.h b/src/hypervisor/domain_job.h
index 7c65c4f8cd..4c32296117 100644
--- a/src/hypervisor/domain_job.h
+++ b/src/hypervisor/domain_job.h
@@ -208,3 +208,5 @@ struct _virDomainObjPrivateJobCallbacks {
int virDomainObjInitJob(virDomainJobObj *job,
virDomainObjPrivateJobCallbacks *cb);
+
+void virDomainObjResetJob(virDomainJobObj *job);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6a5c5600df..d5046604dd 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1591,6 +1591,7 @@ virDomainJobStatusToType;
virDomainJobTypeFromString;
virDomainJobTypeToString;
virDomainObjInitJob;
+virDomainObjResetJob;
# hypervisor/virclosecallbacks.h
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 74ea975e44..a45103256a 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -150,16 +150,6 @@ qemuDomainEventEmitJobCompleted(virQEMUDriver *driver,
}
-static void
-qemuDomainObjResetJob(virDomainJobObj *job)
-{
- job->active = VIR_JOB_NONE;
- job->owner = 0;
- g_clear_pointer(&job->ownerAPI, g_free);
- job->started = 0;
-}
-
-
static void
qemuDomainObjResetAgentJob(virDomainJobObj *job)
{
@@ -219,7 +209,7 @@ qemuDomainObjPreserveJob(virDomainObj *obj,
return -1;
job->cb = priv->job.cb;
- qemuDomainObjResetJob(&priv->job);
+ virDomainObjResetJob(&priv->job);
qemuDomainObjResetAsyncJob(&priv->job);
return 0;
}
@@ -263,7 +253,7 @@ qemuDomainObjRestoreAsyncJob(virDomainObj *vm,
void
qemuDomainObjClearJob(virDomainJobObj *job)
{
- qemuDomainObjResetJob(job);
+ virDomainObjResetJob(job);
qemuDomainObjResetAsyncJob(job);
g_clear_pointer(&job->current, virDomainJobDataFree);
g_clear_pointer(&job->completed, virDomainJobDataFree);
@@ -772,7 +762,7 @@ qemuDomainObjDiscardAsyncJob(virDomainObj *obj)
qemuDomainObjPrivate *priv = obj->privateData;
if (priv->job.active == VIR_JOB_ASYNC_NESTED)
- qemuDomainObjResetJob(&priv->job);
+ virDomainObjResetJob(&priv->job);
qemuDomainObjResetAsyncJob(&priv->job);
qemuDomainSaveStatus(obj);
}
@@ -919,7 +909,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
ignore_value(virTimeMillisNow(&now));
if (job) {
- qemuDomainObjResetJob(&priv->job);
+ virDomainObjResetJob(&priv->job);
if (job != VIR_JOB_ASYNC) {
VIR_DEBUG("Started job: %s (async=%s vm=%p name=%s)",
@@ -1180,7 +1170,7 @@ qemuDomainObjEndJob(virDomainObj *obj)
virDomainAsyncJobTypeToString(priv->job.asyncJob),
obj, obj->def->name);
- qemuDomainObjResetJob(&priv->job);
+ virDomainObjResetJob(&priv->job);
if (qemuDomainTrackJob(job))
qemuDomainSaveStatus(obj);
/* We indeed need to wake up ALL threads waiting because
--
2.35.3