qemu: domain: Repurpose and export helper for saving domain status XML

Rename qemuDomainObjSaveJob and create a wrapper for it which does not
require 'driver' to be passed and export it so that other palces can
easily save the status XML without having to invoke virDomainSaveStatus
which has unpleasing parameters.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-06-27 15:40:39 +02:00
parent c1a1975e49
commit 997746b2df
2 changed files with 18 additions and 7 deletions

View File

@ -7238,7 +7238,8 @@ virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = {
static void
qemuDomainObjSaveJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
qemuDomainObjSaveStatus(virQEMUDriverPtr driver,
virDomainObjPtr obj)
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
@ -7250,6 +7251,14 @@ qemuDomainObjSaveJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
virObjectUnref(cfg);
}
void
qemuDomainSaveStatus(virDomainObjPtr obj)
{
qemuDomainObjSaveStatus(QEMU_DOMAIN_PRIVATE(obj)->driver, obj);
}
void
qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
virDomainObjPtr obj,
@ -7273,7 +7282,7 @@ qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
priv->job.phase = phase;
priv->job.asyncOwner = me;
qemuDomainObjSaveJob(driver, obj);
qemuDomainObjSaveStatus(driver, obj);
}
void
@ -7296,7 +7305,7 @@ qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
if (priv->job.active == QEMU_JOB_ASYNC_NESTED)
qemuDomainObjResetJob(priv);
qemuDomainObjResetAsyncJob(priv);
qemuDomainObjSaveJob(driver, obj);
qemuDomainObjSaveStatus(driver, obj);
}
void
@ -7479,7 +7488,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
}
if (qemuDomainTrackJob(job))
qemuDomainObjSaveJob(driver, obj);
qemuDomainObjSaveStatus(driver, obj);
virObjectUnref(cfg);
return 0;
@ -7723,7 +7732,7 @@ qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
qemuDomainObjResetJob(priv);
if (qemuDomainTrackJob(job))
qemuDomainObjSaveJob(driver, obj);
qemuDomainObjSaveStatus(driver, obj);
/* We indeed need to wake up ALL threads waiting because
* grabbing a job requires checking more variables. */
virCondBroadcast(&priv->job.cond);
@ -7767,7 +7776,7 @@ qemuDomainObjEndJobWithAgent(virQEMUDriverPtr driver,
qemuDomainObjResetJob(priv);
qemuDomainObjResetAgentJob(priv);
if (qemuDomainTrackJob(job))
qemuDomainObjSaveJob(driver, obj);
qemuDomainObjSaveStatus(driver, obj);
/* We indeed need to wake up ALL threads waiting because
* grabbing a job requires checking more variables. */
virCondBroadcast(&priv->job.cond);
@ -7785,7 +7794,7 @@ qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
obj, obj->def->name);
qemuDomainObjResetAsyncJob(priv);
qemuDomainObjSaveJob(driver, obj);
qemuDomainObjSaveStatus(driver, obj);
virCondBroadcast(&priv->job.asyncCond);
}

View File

@ -206,6 +206,8 @@ typedef void (*qemuDomainCleanupCallback)(virQEMUDriverPtr driver,
#define QEMU_DOMAIN_MASTER_KEY_LEN 32 /* 32 bytes for 256 bit random key */
void qemuDomainSaveStatus(virDomainObjPtr obj);
/* helper data types for async device unplug */
typedef enum {