On Fri, 2009-07-31 at 15:52 +0100, Daniel P. Berrange wrote:
If the virDomainShutdown() op was run on an active QEMu vm,
it would crash, since the def->monitor_chr was NULL.
Daniel
commit 49ec121fd806aaa07bbcba9668a8f9dd43dda9c4
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Fri Jul 31 15:50:46 2009 +0100
Fix crash when attempting to shutdown inactive QEMU vm
* src/qemu_driver.c: Add check that QEMU is active before attemting
to shutdown. Fix error code for check in destroy method
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 26897d3..cebbafb 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2940,6 +2940,12 @@ static int qemudDomainShutdown(virDomainPtr dom) {
goto cleanup;
}
+ if (!virDomainIsActive(vm)) {
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
+ goto cleanup;
+ }
+
Good catch. Perhaps add a NULL check in qemudMonitorSend(), since it's
pretty hard to go through all the callers and be sure we're checking the
domain is active for each one
In any case, ACK
Cheers,
Mark.