summaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-10-14 11:18:09 -0300
committerLuiz Capitulino <lcapitulino@redhat.com>2011-10-19 10:48:57 -0200
commit8a9236f1d2e91ddd31e3eeae8fe27392c07324a9 (patch)
tree8d47b900a239c9183f7ce5921a6b9e5b3d52ea35 /cpus.c
parentc370f09dba0f0d92e0e8127e9e444f58e9332448 (diff)
downloadqemu-8a9236f1d2e91ddd31e3eeae8fe27392c07324a9.tar.gz
qemu-8a9236f1d2e91ddd31e3eeae8fe27392c07324a9.tar.bz2
qemu-8a9236f1d2e91ddd31e3eeae8fe27392c07324a9.zip
runstate: Allow user to migrate twice
It should be a matter of allowing the transition POSTMIGRATE -> FINISH_MIGRATE, but it turns out that the VM won't do the transition the second time because it's already stopped. So this commit also adds vm_stop_force_state() which performs the transition even if the VM is already stopped. While there also allow other states to migrate. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/cpus.c b/cpus.c
index 89787794e8..5f5b763e2c 100644
--- a/cpus.c
+++ b/cpus.c
@@ -887,6 +887,17 @@ void vm_stop(RunState state)
do_vm_stop(state);
}
+/* does a state transition even if the VM is already stopped,
+ current state is forgotten forever */
+void vm_stop_force_state(RunState state)
+{
+ if (runstate_is_running()) {
+ vm_stop(state);
+ } else {
+ runstate_set(state);
+ }
+}
+
static int tcg_cpu_exec(CPUState *env)
{
int ret;