[libvirt] [PATCH] qemuDomainResume: allow to resume domain with guest panicked

In case of guest panicked, preserved crashed domain has stopped CPUs. It's not possible to use tools like WinDbg for the problem investigation until we start CPUs back. --- src/qemu/qemu_driver.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e46404b..0930280 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1873,6 +1873,7 @@ static int qemuDomainResume(virDomainPtr dom) int ret = -1; virObjectEventPtr event = NULL; int state; + int reason; virQEMUDriverConfigPtr cfg = NULL; if (!(vm = qemuDomObjFromDomain(dom))) @@ -1892,12 +1893,14 @@ static int qemuDomainResume(virDomainPtr dom) goto endjob; } - state = virDomainObjGetState(vm, NULL); + state = virDomainObjGetState(vm, &reason); if (state == VIR_DOMAIN_PMSUSPENDED) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is pmsuspended")); goto endjob; - } else if (state == VIR_DOMAIN_PAUSED) { + } else if ((state == VIR_DOMAIN_CRASHED && + reason == VIR_DOMAIN_CRASHED_PANICKED) || + state == VIR_DOMAIN_PAUSED) { if (qemuProcessStartCPUs(driver, vm, dom->conn, VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_NONE) < 0) { -- 1.8.3.1

Ping. Thanks! Dmitry On 23.01.2016 19:08, Dmitry Andreev wrote:
In case of guest panicked, preserved crashed domain has stopped CPUs. It's not possible to use tools like WinDbg for the problem investigation until we start CPUs back. --- src/qemu/qemu_driver.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e46404b..0930280 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1873,6 +1873,7 @@ static int qemuDomainResume(virDomainPtr dom) int ret = -1; virObjectEventPtr event = NULL; int state; + int reason; virQEMUDriverConfigPtr cfg = NULL;
if (!(vm = qemuDomObjFromDomain(dom))) @@ -1892,12 +1893,14 @@ static int qemuDomainResume(virDomainPtr dom) goto endjob; }
- state = virDomainObjGetState(vm, NULL); + state = virDomainObjGetState(vm, &reason); if (state == VIR_DOMAIN_PMSUSPENDED) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is pmsuspended")); goto endjob; - } else if (state == VIR_DOMAIN_PAUSED) { + } else if ((state == VIR_DOMAIN_CRASHED && + reason == VIR_DOMAIN_CRASHED_PANICKED) || + state == VIR_DOMAIN_PAUSED) { if (qemuProcessStartCPUs(driver, vm, dom->conn, VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_NONE) < 0) {

On Sat, Jan 23, 2016 at 19:08:45 +0300, Dmitry Andreev wrote:
In case of guest panicked, preserved crashed domain has stopped CPUs. It's not possible to use tools like WinDbg for the problem investigation until we start CPUs back. --- src/qemu/qemu_driver.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e46404b..0930280 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1873,6 +1873,7 @@ static int qemuDomainResume(virDomainPtr dom) int ret = -1; virObjectEventPtr event = NULL; int state; + int reason; virQEMUDriverConfigPtr cfg = NULL;
if (!(vm = qemuDomObjFromDomain(dom))) @@ -1892,12 +1893,14 @@ static int qemuDomainResume(virDomainPtr dom) goto endjob; }
- state = virDomainObjGetState(vm, NULL); + state = virDomainObjGetState(vm, &reason); if (state == VIR_DOMAIN_PMSUSPENDED) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is pmsuspended")); goto endjob; - } else if (state == VIR_DOMAIN_PAUSED) { + } else if ((state == VIR_DOMAIN_CRASHED && + reason == VIR_DOMAIN_CRASHED_PANICKED) ||
"reason" should be lined up with "state" in the line above, i.e., this line needs to be indented by one more space.
+ state == VIR_DOMAIN_PAUSED) { if (qemuProcessStartCPUs(driver, vm, dom->conn, VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_NONE) < 0) {
ACK and pushed, thanks. Jirka
participants (2)
-
Dmitry Andreev
-
Jiri Denemark