[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 33/56] cpus: Add return value for vm_stop()
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 33/56] cpus: Add return value for vm_stop() |
Date: |
Tue, 13 Aug 2013 10:10:57 -0500 |
From: Kevin Wolf <address@hidden>
If flushing the block devices fails, return an error. The VM is stopped
anyway.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
(cherry picked from commit 5698346391b306c2c84358c68ee897c095d714cc)
Signed-off-by: Michael Roth <address@hidden>
---
cpus.c | 20 +++++++++++++-------
include/sysemu/sysemu.h | 4 ++--
stubs/vm-stop.c | 2 +-
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/cpus.c b/cpus.c
index c232265..2a2f633 100644
--- a/cpus.c
+++ b/cpus.c
@@ -437,17 +437,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)
@@ -1093,7 +1097,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);
@@ -1102,19 +1106,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;
}
}
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 2fb71af..b5e1add 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -35,8 +35,8 @@ void vm_state_notify(int running, RunState state);
#define VMRESET_REPORT true
void vm_start(void);
-void vm_stop(RunState state);
-void vm_stop_force_state(RunState state);
+int vm_stop(RunState state);
+int vm_stop_force_state(RunState state);
typedef enum WakeupReason {
QEMU_WAKEUP_REASON_OTHER = 0,
diff --git a/stubs/vm-stop.c b/stubs/vm-stop.c
index 4568935..f82c897 100644
--- a/stubs/vm-stop.c
+++ b/stubs/vm-stop.c
@@ -1,7 +1,7 @@
#include "qemu-common.h"
#include "sysemu/sysemu.h"
-void vm_stop(RunState state)
+int vm_stop(RunState state)
{
abort();
}
--
1.7.9.5
- [Qemu-stable] [PATCH 30/56] iscsi: remove support for misaligned nb_sectors in aio_readv, (continued)
- [Qemu-stable] [PATCH 30/56] iscsi: remove support for misaligned nb_sectors in aio_readv, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 28/56] ahci: Fix FLUSH command, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 26/56] seccomp: add the asynchronous I/O syscalls to the whitelist, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 36/56] gtk: don't use g_object_unref on GdkCursor, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 35/56] megasas: Legacy command line handling fix, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 37/56] gtk: Fix compiler warning (GTK 3 deprecated function), Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 42/56] virtio-console: Use exitfn for virtserialport, too, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 38/56] dataplane: refuse to start if device is already in use, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 32/56] block: Add return value for bdrv_flush_all(), Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 39/56] xhci: handle USB_RET_IOERROR, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 33/56] cpus: Add return value for vm_stop(),
Michael Roth <=
- [Qemu-stable] [PATCH 40/56] qemu-char: Register ring buffer driver with correct name "ringbuf", Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 41/56] qapi: Rename ChardevBackend member "memory" to "ringbuf", Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 43/56] pci-bridge: update mappings for migration/restore, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 34/56] cpus: Let vm_stop[_force_state]() always flush block devices, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 45/56] chardev: fix CHR_EVENT_OPENED events for mux chardevs, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 54/56] dataplane: sync virtio.c and vring.c virtqueue state, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 55/56] virtio: clear signalled_used_valid when switching from dataplane, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 49/56] target-i386: Fix X86CPU error handling, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 47/56] seccomp: add additional asynchronous I/O syscalls, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 56/56] vhost: clear signalled_used_valid on vhost stop, Michael Roth, 2013/08/13