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@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 23 ++++++++++++++++------- src/qemu/qemu_domain.h | 2 ++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0f1fda2384..2c0096d2ac 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7198,7 +7198,8 @@ virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = { static void -qemuDomainObjSaveJob(virQEMUDriverPtr driver, virDomainObjPtr obj) +qemuDomainObjSaveStatus(virQEMUDriverPtr driver, + virDomainObjPtr obj) { virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); @@ -7210,6 +7211,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, @@ -7233,7 +7242,7 @@ qemuDomainObjSetJobPhase(virQEMUDriverPtr driver, priv->job.phase = phase; priv->job.asyncOwner = me; - qemuDomainObjSaveJob(driver, obj); + qemuDomainObjSaveStatus(driver, obj); } void @@ -7256,7 +7265,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 @@ -7439,7 +7448,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, } if (qemuDomainTrackJob(job)) - qemuDomainObjSaveJob(driver, obj); + qemuDomainObjSaveStatus(driver, obj); virObjectUnref(cfg); return 0; @@ -7683,7 +7692,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); @@ -7727,7 +7736,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); @@ -7745,7 +7754,7 @@ qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver, virDomainObjPtr obj) obj, obj->def->name); qemuDomainObjResetAsyncJob(priv); - qemuDomainObjSaveJob(driver, obj); + qemuDomainObjSaveStatus(driver, obj); virCondBroadcast(&priv->job.asyncCond); } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 3eea8b0f96..5853852880 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -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 { -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list