qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] runstate: add more valid transitions
@ 2011-10-04 13:10 Paolo Bonzini
  2011-10-04 13:15 ` [Qemu-devel] [PATCH v2] " Paolo Bonzini
  0 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2011-10-04 13:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: lcapitulino

This patch adds more valid transitions to the table, and avoids
that the VM remains stuck in RSTATE_SAVEVM state when savevm is
done on a paused virtual machine.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 savevm.c |   11 ++++++++---
 vl.c     |    5 +++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/savevm.c b/savevm.c
index 46f2447..ba5beb0 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1599,7 +1599,7 @@ void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f)
 
 static int qemu_savevm_state(Monitor *mon, QEMUFile *f)
 {
-    int saved_vm_running;
+    int saved_vm_state;
     int ret;
 
     saved_vm_running = runstate_is_running();
@@ -1626,8 +1626,13 @@ out:
     if (qemu_file_has_error(f))
         ret = -EIO;
 
-    if (!ret && saved_vm_running)
-        vm_start();
+    if (!ret) {
+        if (saved_vm_running) {
+            vm_start();
+        } else {
+            runstate_set(RSTATE_PAUSED);
+        }
+    }
 
     return ret;
 }
diff --git a/vl.c b/vl.c
index bd4a5ce..165712e 100644
--- a/vl.c
+++ b/vl.c
@@ -346,8 +346,12 @@ static const RunStateTransition runstate_transitions_def[] = {
     { RSTATE_IO_ERROR, RSTATE_RUNNING },
 
     { RSTATE_PAUSED, RSTATE_RUNNING },
+    { RSTATE_PAUSED, RSTATE_PRE_MIGRATE },
+    { RSTATE_PAUSED, RSTATE_SAVEVM },
 
     { RSTATE_POST_MIGRATE, RSTATE_RUNNING },
+    { RSTATE_POST_MIGRATE, RSTATE_PRE_MIGRATE },
+    { RSTATE_POST_MIGRATE, RSTATE_SAVEVM },
 
     { RSTATE_PRE_LAUNCH, RSTATE_RUNNING },
     { RSTATE_PRE_LAUNCH, RSTATE_POST_MIGRATE },
@@ -368,6 +372,7 @@ static const RunStateTransition runstate_transitions_def[] = {
     { RSTATE_RUNNING, RSTATE_WATCHDOG },
 
     { RSTATE_SAVEVM, RSTATE_RUNNING },
+    { RSTATE_SAVEVM, RSTATE_PAUSED },
 
     { RSTATE_SHUTDOWN, RSTATE_PAUSED },
 
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-10-14 14:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-04 13:10 [Qemu-devel] [PATCH] runstate: add more valid transitions Paolo Bonzini
2011-10-04 13:15 ` [Qemu-devel] [PATCH v2] " Paolo Bonzini
2011-10-10 18:50   ` Luiz Capitulino
2011-10-11  7:22     ` Paolo Bonzini
2011-10-11 17:52       ` Luiz Capitulino
2011-10-13 20:26         ` Luiz Capitulino
2011-10-14  6:56           ` Paolo Bonzini
2011-10-14 13:23             ` Luiz Capitulino
2011-10-14 13:37               ` Paolo Bonzini
2011-10-14 14:24                 ` Luiz Capitulino
2011-10-14 14:26                   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).