提交 997746b2 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 c1a1975e
...@@ -7238,7 +7238,8 @@ virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = { ...@@ -7238,7 +7238,8 @@ virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = {
static void static void
qemuDomainObjSaveJob(virQEMUDriverPtr driver, virDomainObjPtr obj) qemuDomainObjSaveStatus(virQEMUDriverPtr driver,
virDomainObjPtr obj)
{ {
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
...@@ -7250,6 +7251,14 @@ qemuDomainObjSaveJob(virQEMUDriverPtr driver, virDomainObjPtr obj) ...@@ -7250,6 +7251,14 @@ qemuDomainObjSaveJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
virObjectUnref(cfg); virObjectUnref(cfg);
} }
void
qemuDomainSaveStatus(virDomainObjPtr obj)
{
qemuDomainObjSaveStatus(QEMU_DOMAIN_PRIVATE(obj)->driver, obj);
}
void void
qemuDomainObjSetJobPhase(virQEMUDriverPtr driver, qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
virDomainObjPtr obj, virDomainObjPtr obj,
...@@ -7273,7 +7282,7 @@ qemuDomainObjSetJobPhase(virQEMUDriverPtr driver, ...@@ -7273,7 +7282,7 @@ qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
priv->job.phase = phase; priv->job.phase = phase;
priv->job.asyncOwner = me; priv->job.asyncOwner = me;
qemuDomainObjSaveJob(driver, obj); qemuDomainObjSaveStatus(driver, obj);
} }
void void
...@@ -7296,7 +7305,7 @@ qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver, virDomainObjPtr obj) ...@@ -7296,7 +7305,7 @@ qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
if (priv->job.active == QEMU_JOB_ASYNC_NESTED) if (priv->job.active == QEMU_JOB_ASYNC_NESTED)
qemuDomainObjResetJob(priv); qemuDomainObjResetJob(priv);
qemuDomainObjResetAsyncJob(priv); qemuDomainObjResetAsyncJob(priv);
qemuDomainObjSaveJob(driver, obj); qemuDomainObjSaveStatus(driver, obj);
} }
void void
...@@ -7479,7 +7488,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, ...@@ -7479,7 +7488,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
} }
if (qemuDomainTrackJob(job)) if (qemuDomainTrackJob(job))
qemuDomainObjSaveJob(driver, obj); qemuDomainObjSaveStatus(driver, obj);
virObjectUnref(cfg); virObjectUnref(cfg);
return 0; return 0;
...@@ -7723,7 +7732,7 @@ qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomainObjPtr obj) ...@@ -7723,7 +7732,7 @@ qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
qemuDomainObjResetJob(priv); qemuDomainObjResetJob(priv);
if (qemuDomainTrackJob(job)) if (qemuDomainTrackJob(job))
qemuDomainObjSaveJob(driver, obj); qemuDomainObjSaveStatus(driver, obj);
/* We indeed need to wake up ALL threads waiting because /* We indeed need to wake up ALL threads waiting because
* grabbing a job requires checking more variables. */ * grabbing a job requires checking more variables. */
virCondBroadcast(&priv->job.cond); virCondBroadcast(&priv->job.cond);
...@@ -7767,7 +7776,7 @@ qemuDomainObjEndJobWithAgent(virQEMUDriverPtr driver, ...@@ -7767,7 +7776,7 @@ qemuDomainObjEndJobWithAgent(virQEMUDriverPtr driver,
qemuDomainObjResetJob(priv); qemuDomainObjResetJob(priv);
qemuDomainObjResetAgentJob(priv); qemuDomainObjResetAgentJob(priv);
if (qemuDomainTrackJob(job)) if (qemuDomainTrackJob(job))
qemuDomainObjSaveJob(driver, obj); qemuDomainObjSaveStatus(driver, obj);
/* We indeed need to wake up ALL threads waiting because /* We indeed need to wake up ALL threads waiting because
* grabbing a job requires checking more variables. */ * grabbing a job requires checking more variables. */
virCondBroadcast(&priv->job.cond); virCondBroadcast(&priv->job.cond);
...@@ -7785,7 +7794,7 @@ qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver, virDomainObjPtr obj) ...@@ -7785,7 +7794,7 @@ qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
obj, obj->def->name); obj, obj->def->name);
qemuDomainObjResetAsyncJob(priv); qemuDomainObjResetAsyncJob(priv);
qemuDomainObjSaveJob(driver, obj); qemuDomainObjSaveStatus(driver, obj);
virCondBroadcast(&priv->job.asyncCond); virCondBroadcast(&priv->job.asyncCond);
} }
......
...@@ -206,6 +206,8 @@ typedef void (*qemuDomainCleanupCallback)(virQEMUDriverPtr driver, ...@@ -206,6 +206,8 @@ typedef void (*qemuDomainCleanupCallback)(virQEMUDriverPtr driver,
#define QEMU_DOMAIN_MASTER_KEY_LEN 32 /* 32 bytes for 256 bit random key */ #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 */ /* helper data types for async device unplug */
typedef enum { typedef enum {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册