From 997746b2df53587a2ee4f67ca2449aefc775324f Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 27 Jun 2019 15:40:39 +0200 Subject: [PATCH] qemu: domain: Repurpose and export helper for saving domain status XML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- 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 d2dbef6ad0..b56a5620c9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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); } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index c684b4cad9..43f5dd9a7b 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 {