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
This commit is contained in:
Daniel P. Berrange 2009-07-31 15:50:46 +01:00
parent 84e96866ac
commit 5d3e02aaa2

View File

@ -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;
}
if (qemudMonitorCommand(vm, "system_powerdown", &info) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("shutdown operation failed"));
@ -2971,7 +2977,7 @@ static int qemudDomainDestroy(virDomainPtr dom) {
goto cleanup;
}
if (!virDomainIsActive(vm)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto cleanup;
}