Extend the QEMU private domain structure with virFdSet. Persist the virFdSet using XML and parse its XML. Free the FdSet upon domain stop.
Signed-off-by: Stefan Berger <stef...@linux.vnet.ibm.com> --- v6->v7: - followed Eric's comments on v6 v5->v6: - change found in patch 3 moved to this patch --- src/qemu/qemu_domain.c | 11 +++++++++++ src/qemu/qemu_domain.h | 3 +++ src/qemu/qemu_process.c | 3 +++ 3 files changed, 17 insertions(+) Index: libvirt/src/qemu/qemu_domain.c =================================================================== --- libvirt.orig/src/qemu/qemu_domain.c +++ libvirt/src/qemu/qemu_domain.c @@ -252,6 +252,7 @@ static void qemuDomainObjPrivateFree(voi qemuAgentClose(priv->agent); } VIR_FREE(priv->cleanupCallbacks); + virObjectUnref(priv->fdset); VIR_FREE(priv); } @@ -326,6 +327,10 @@ static int qemuDomainObjPrivateXMLFormat if (priv->fakeReboot) virBufferAsprintf(buf, " <fakereboot/>\n"); + virBufferAdjustIndent(buf, 2); + virFdSetFormatXML(priv->fdset, buf); + virBufferAdjustIndent(buf, -2); + return 0; } @@ -471,6 +476,10 @@ static int qemuDomainObjPrivateXMLParse( priv->fakeReboot = virXPathBoolean("boolean(./fakereboot)", ctxt) == 1; + if (!(priv->fdset = virFdSetNew()) || + virFdSetParseXML(priv->fdset, "./fdset/entry", ctxt) < 0) + goto error; + return 0; error: @@ -478,6 +487,8 @@ error: priv->monConfig = NULL; VIR_FREE(nodes); virObjectUnref(qemuCaps); + virObjectUnref(priv->fdset); + priv->fdset = NULL; return -1; } Index: libvirt/src/qemu/qemu_domain.h =================================================================== --- libvirt.orig/src/qemu/qemu_domain.h +++ libvirt/src/qemu/qemu_domain.h @@ -32,6 +32,7 @@ # include "qemu_conf.h" # include "qemu_capabilities.h" # include "virchrdev.h" +# include "virfdset.h" # define QEMU_EXPECTED_VIRT_TYPES \ ((1 << VIR_DOMAIN_VIRT_QEMU) | \ @@ -162,6 +163,8 @@ struct _qemuDomainObjPrivate { qemuDomainCleanupCallback *cleanupCallbacks; size_t ncleanupCallbacks; size_t ncleanupCallbacks_max; + + virFdSetPtr fdset; }; struct qemuDomainWatchdogEvent Index: libvirt/src/qemu/qemu_process.c =================================================================== --- libvirt.orig/src/qemu/qemu_process.c +++ libvirt/src/qemu/qemu_process.c @@ -4224,6 +4224,9 @@ void qemuProcessStop(virQEMUDriverPtr dr priv->monConfig = NULL; } + virObjectUnref(priv->fdset); + priv->fdset = NULL; + /* shut it off for sure */ ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list