提交 5d3e02aa 编写于 作者: D Daniel P. Berrange

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
上级 84e96866
...@@ -2940,6 +2940,12 @@ static int qemudDomainShutdown(virDomainPtr dom) { ...@@ -2940,6 +2940,12 @@ static int qemudDomainShutdown(virDomainPtr dom) {
goto cleanup; 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) { if (qemudMonitorCommand(vm, "system_powerdown", &info) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("shutdown operation failed")); "%s", _("shutdown operation failed"));
...@@ -2971,7 +2977,7 @@ static int qemudDomainDestroy(virDomainPtr dom) { ...@@ -2971,7 +2977,7 @@ static int qemudDomainDestroy(virDomainPtr dom) {
goto cleanup; goto cleanup;
} }
if (!virDomainIsActive(vm)) { 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")); "%s", _("domain is not running"));
goto cleanup; goto cleanup;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册