Error out if the domain has disappeared in the meantime.
Explicitly check if the domain is alive
in qemuDomain{Attach,Detach}Live, where the return value
is ignored.
This prevents writing the persistent definition as the domain
status and calling qemuDomainRemoveDevice on devices
that already have been dealt with in qemuProcessStop.
---
src/qemu/qemu_domain.c | 3 ++-
src/qemu/qemu_driver.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d074429..d9c22da 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2763,7 +2763,8 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
qemuDomainObjExitMonitor(driver, vm);
return -1;
}
- qemuDomainObjExitMonitor(driver, vm);
+ if (qemuDomainObjExitMonitorAlive(driver, vm) < 0)
+ return -1;
virStringFreeList(priv->qemuDevices);
priv->qemuDevices = aliases;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7211d42..99eb7c3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7058,6 +7058,8 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
if (ret == 0)
qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE);
+ if (!virDomainObjIsActive(vm))
+ return -1;
return ret;
}
@@ -7134,6 +7136,8 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
if (ret == 0)
qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE);
+ if (!virDomainObjIsActive(vm))
+ return -1;
return ret;
}
--
2.0.4