aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-07-15 14:00:32 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-07-15 14:00:32 -0500
commit5699a02e01a4d046652bc6e77abd67e887ae209c (patch)
tree9b5f353025bb767ad0fbf10fc9d6488be7831b13 /cpus.c
parentc3cb8e77804313e1be99b5f28a34a346736707a5 (diff)
parenta62eaa26c1d6d48fbdc3ac1d32bd1314f5fdc8c9 (diff)
Merge remote-tracking branch 'kwolf/for-anthony' into staging
# By Kevin Wolf (6) and Stefan Hajnoczi (2) # Via Kevin Wolf * kwolf/for-anthony: ahci: Fix FLUSH command migration: Fail migration on bdrv_flush_all() error cpus: Add return value for vm_stop() block: Add return value for bdrv_flush_all() qemu-iotests: Update 051 reference output block: Don't parse protocol from file.filename block: add drive_backup HMP command blockdev: add sync mode to drive-backup QMP command Message-id: 1373887000-4488-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/cpus.c b/cpus.c
index f141428225..29277e109f 100644
--- a/cpus.c
+++ b/cpus.c
@@ -434,17 +434,21 @@ bool cpu_is_stopped(CPUState *cpu)
return !runstate_is_running() || cpu->stopped;
}
-static void do_vm_stop(RunState state)
+static int do_vm_stop(RunState state)
{
+ int ret = 0;
+
if (runstate_is_running()) {
cpu_disable_ticks();
pause_all_vcpus();
runstate_set(state);
vm_state_notify(0, state);
bdrv_drain_all();
- bdrv_flush_all();
+ ret = bdrv_flush_all();
monitor_protocol_event(QEVENT_STOP, NULL);
}
+
+ return ret;
}
static bool cpu_can_run(CPUState *cpu)
@@ -1070,7 +1074,7 @@ void cpu_stop_current(void)
}
}
-void vm_stop(RunState state)
+int vm_stop(RunState state)
{
if (qemu_in_vcpu_thread()) {
qemu_system_vmstop_request(state);
@@ -1079,19 +1083,21 @@ void vm_stop(RunState state)
* vm_stop() has been requested.
*/
cpu_stop_current();
- return;
+ return 0;
}
- do_vm_stop(state);
+
+ return 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)
+int vm_stop_force_state(RunState state)
{
if (runstate_is_running()) {
- vm_stop(state);
+ return vm_stop(state);
} else {
runstate_set(state);
+ return 0;
}
}