On Tue, Aug 04, 2020 at 08:06:47PM +0530, Prathamesh Chavan wrote:
To remove dependency of funcitons to access the `privateData` of
qemu-domain, we introduce this callback funciton so that funcitons
get exactly what they need.
Signed-off-by: Prathamesh Chavan <pc44800(a)gmail.com>
---
src/qemu/qemu_domain.c | 8 ++++++++
src/qemu/qemu_domainjob.c | 4 ++--
src/qemu/qemu_domainjob.h | 2 ++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d7a944a886..2e16c8e5fe 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -629,12 +629,20 @@ qemuDomainParseJobPrivate(xmlXPathContextPtr ctxt,
return 0;
}
+static virDomainXMLOptionPtr
+qemuGetDomainXMLOptionPtr(virDomainObjPtr vm)
+{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ return priv->driver->xmlopt;
+
+}
static qemuDomainObjPrivateJobCallbacks qemuPrivateJobCallbacks = {
.allocJobPrivate = qemuJobAllocPrivate,
.freeJobPrivate = qemuJobFreePrivate,
.resetJobPrivate = qemuJobResetPrivate,
.saveStatus = qemuDomainSaveStatus,
+ .getDomainXMLOptionPtr = qemuGetDomainXMLOptionPtr,
.formatJob = qemuDomainFormatJobPrivate,
.parseJob = qemuDomainParseJobPrivate,
.setJobInfoOperation = qemuDomainJobInfoSetOperation,
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 19c847dffc..3eff45fd17 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -765,7 +765,7 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
if (diskPriv->migrSource &&
qemuDomainObjPrivateXMLFormatNBDMigrationSource(&childBuf,
diskPriv->migrSource,
- priv->driver->xmlopt)
< 0)
+
priv->job.cb->getDomainXMLOptionPtr(vm)) < 0)
NBD migration is very much QEMU specific at the moment, so if you move
qemuDomainObjPrivateXMLFormatNBDMigrationSource and functions alike out of the
qemu_domainjob module which we're planning on using as a base for the
hypervisor-agnostic job handling module, you won't need this patch.
Erik