[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 19/21] sysemu: add vm_start_hold/release
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 19/21] sysemu: add vm_start_hold/release |
Date: |
Mon, 18 Nov 2013 13:25:29 +0100 |
This is a simple solution (or hack?) to allow the Spice block driver to
hold the VM from starting before the migration state is completed.
During migration, the destination qemu needs to initialize the NBD
session. This requires waiting for the Spice client and communication
before the VM is started, but using a running main loop.
Signed-off-by: Marc-André Lureau <address@hidden>
---
include/sysemu/sysemu.h | 2 ++
vl.c | 17 +++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index cd5791e..a76a6e7 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -38,6 +38,8 @@ void vm_state_notify(int running, RunState state);
#define VMRESET_REPORT true
void vm_start(void);
+void vm_start_hold(void);
+void vm_start_release(void);
int vm_stop(RunState state);
int vm_stop_force_state(RunState state);
diff --git a/vl.c b/vl.c
index 4ad15b8..8905ba5 100644
--- a/vl.c
+++ b/vl.c
@@ -1690,8 +1690,25 @@ void vm_state_notify(int running, RunState state)
}
}
+static int start_hold;
+
+void vm_start_hold(void)
+{
+ start_hold++;
+}
+
+void vm_start_release(void)
+{
+ start_hold--;
+ vm_start();
+}
+
void vm_start(void)
{
+ if (start_hold != 0) {
+ return;
+ }
+
if (!runstate_is_running()) {
cpu_enable_ticks();
runstate_set(RUN_STATE_RUNNING);
--
1.8.3.1
- [Qemu-devel] [PATCH 09/21] nbd: make session_close() idempotent, (continued)
- [Qemu-devel] [PATCH 09/21] nbd: make session_close() idempotent, Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 10/21] nbd: finish any pending coroutine, Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 11/21] nbd: avoid uninitialized warnings, Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 12/21] block: save the associated child name in BlockDriverState, Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 13/21] blockdev: add qmp_change_blockdev_int(), Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 14/21] block: extract make_snapshot() from bdrv_open(), Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 15/21] block: add "snapshot.size" option to avoid extra bdrv_open(), Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 16/21] block: learn to open a driver with a given opaque, Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 17/21] block: allow to call bdrv_open() with an opaque, Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 18/21] block: do not notify change during migration, Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 19/21] sysemu: add vm_start_hold/release,
Marc-André Lureau <=
- [Qemu-devel] [PATCH 20/21] spice-core: allow an interface to be in AIO context, Marc-André Lureau, 2013/11/18
- [Qemu-devel] [PATCH 21/21] block: add spice block device backend, Marc-André Lureau, 2013/11/18
- Re: [Qemu-devel] [PATCH 00/21] RFCv2: add Spice block device, Marc-André Lureau, 2013/11/22