Rather than remove the frontend first and then the backend, let's swap the
order. The order of addition is add the chardev backend if EGD being used,
then add the RNG object. So there's a dependency there. When we remove,
unplug the backend first, then remove the object would seem to be a more
logical step. This would then follow similar processing for disk removal
where dependent objects (secret and encryption) of the drive are removed
before the drive is removed.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 31b5876..e287aaf 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3623,11 +3623,11 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
goto cleanup;
qemuDomainObjEnterMonitor(driver, vm);
- rc = qemuMonitorDelObject(priv->mon, objAlias);
-
- if (rc == 0 && rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD)
+ if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD)
ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias));
+ rc = qemuMonitorDelObject(priv->mon, objAlias);
+
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup;
--
2.7.4