qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH] runstate: add more valid transitions
Date: Tue,  4 Oct 2011 15:10:39 +0200	[thread overview]
Message-ID: <1317733839-18143-1-git-send-email-pbonzini@redhat.com> (raw)

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

             reply	other threads:[~2011-10-04 13:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-04 13:10 Paolo Bonzini [this message]
2011-10-04 13:15 ` [Qemu-devel] [PATCH v2] runstate: add more valid transitions 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1317733839-18143-1-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).