mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
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:
parent
84e96866ac
commit
5d3e02aaa2
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user