6ae9ed
From 75d5905470fc64bff87e0e76d8a958a9f2f94f5e Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <75d5905470fc64bff87e0e76d8a958a9f2f94f5e@dist-git>
6ae9ed
From: Martin Kletzander <mkletzan@redhat.com>
6ae9ed
Date: Tue, 2 Aug 2016 13:38:58 +0200
6ae9ed
Subject: [PATCH] qemu: Fix domain state after reset
6ae9ed
6ae9ed
When reset was called from a domain that crashed we didn't change the
6ae9ed
crashed state into a paused one which could confuse users.
6ae9ed
6ae9ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1269575
6ae9ed
6ae9ed
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
6ae9ed
(cherry picked from commit daf01a61254cc21d90e15dae8080f13e9a34b489)
6ae9ed
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
6ae9ed
---
6ae9ed
 src/qemu/qemu_driver.c | 5 +++++
6ae9ed
 1 file changed, 5 insertions(+)
6ae9ed
6ae9ed
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
6ae9ed
index aed5e80..2fe217d 100644
6ae9ed
--- a/src/qemu/qemu_driver.c
6ae9ed
+++ b/src/qemu/qemu_driver.c
6ae9ed
@@ -2139,6 +2139,7 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags)
6ae9ed
     virDomainObjPtr vm;
6ae9ed
     int ret = -1;
6ae9ed
     qemuDomainObjPrivatePtr priv;
6ae9ed
+    virDomainState state;
6ae9ed
 
6ae9ed
     virCheckFlags(0, -1);
6ae9ed
 
6ae9ed
@@ -2165,6 +2166,10 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags)
6ae9ed
 
6ae9ed
     priv->fakeReboot = false;
6ae9ed
 
6ae9ed
+    state = virDomainObjGetState(vm, NULL);
6ae9ed
+    if (state == VIR_DOMAIN_CRASHED)
6ae9ed
+        virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_CRASHED);
6ae9ed
+
6ae9ed
  endjob:
6ae9ed
     qemuDomainObjEndJob(driver, vm);
6ae9ed
 
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed