qemu & hypervisor: move qemuDomainObjClearJob() into hypervisor

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

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Kristina Hanicova 2022-08-03 14:43:16 +02:00 committed by Michal Privoznik
parent 635bb08025
commit d5b677792c
6 changed files with 19 additions and 18 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -1594,6 +1594,7 @@ virDomainJobDataInit;
virDomainJobStatusToType;
virDomainJobTypeFromString;
virDomainJobTypeToString;
virDomainObjClearJob;
virDomainObjInitJob;
virDomainObjPreserveJob;
virDomainObjResetAgentJob;

View File

@ -1719,7 +1719,7 @@ qemuDomainObjPrivateFree(void *data)
qemuDomainObjPrivateDataClear(priv);
virObjectUnref(priv->monConfig);
qemuDomainObjClearJob(&priv->job);
virDomainObjClearJob(&priv->job);
g_free(priv->lockState);
g_free(priv->origname);

View File

@ -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)
{

View File

@ -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);