after migration we should restore the ephemeral devices.
so we save them to qemuDomainObjPrivate.
Signed-off-by: Chen Fan <chen.fan.fnst(a)cn.fujitsu.com>
---
src/qemu/qemu_domain.c | 5 +++++
src/qemu/qemu_domain.h | 3 +++
2 files changed, 8 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d8a2087..5ce933d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -425,6 +425,7 @@ static void
qemuDomainObjPrivateFree(void *data)
{
qemuDomainObjPrivatePtr priv = data;
+ size_t i;
virObjectUnref(priv->qemuCaps);
@@ -441,6 +442,10 @@ qemuDomainObjPrivateFree(void *data)
virCondDestroy(&priv->unplugFinished);
virChrdevFree(priv->devs);
+ for (i = 0; i < priv->nEphemeralDevices; i++)
+ virDomainDeviceDefFree(priv->ephemeralDevices[i]);
+ VIR_FREE(priv->ephemeralDevices);
+
/* This should never be non-NULL if we get here, but just in case... */
if (priv->mon) {
VIR_ERROR(_("Unexpected QEMU monitor still active during domain
deletion"));
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index fe3e2b1..e75c828 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -180,6 +180,9 @@ struct _qemuDomainObjPrivate {
size_t ncleanupCallbacks;
size_t ncleanupCallbacks_max;
+ virDomainDeviceDefPtr *ephemeralDevices;
+ size_t nEphemeralDevices;
+
virCgroupPtr cgroup;
virCond unplugFinished; /* signals that unpluggingDevice was unplugged */
--
1.9.3