Extend the QEMU private domain structure with virFdSet.
Persist the virFdSet using XML and parse its XML.
Free the FdSet upon domain stop.
Stefan Berger <stefanb(a)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 +++
2 files changed, 14 insertions(+)
Index: libvirt/src/qemu/qemu_domain.c
===================================================================
--- libvirt.orig/src/qemu/qemu_domain.c
+++ libvirt/src/qemu/qemu_domain.c
@@ -251,6 +251,7 @@ static void qemuDomainObjPrivateFree(voi
qemuAgentClose(priv->agent);
}
VIR_FREE(priv->cleanupCallbacks);
+ virObjectUnref(priv->fdset);
VIR_FREE(priv);
}
@@ -325,6 +326,10 @@ static int qemuDomainObjPrivateXMLFormat
if (priv->fakeReboot)
virBufferAsprintf(buf, " <fakereboot/>\n");
+ virBufferAdjustIndent(buf, 2);
+ virFdSetFormatXML(priv->fdset, buf);
+ virBufferAdjustIndent(buf, -2);
+
return 0;
}
@@ -470,6 +475,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:
@@ -477,6 +486,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) | \
@@ -160,6 +161,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
@@ -4255,6 +4255,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|