From db8448edc16982622b92f324f471df0f12251a3b Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <66350080c56dd39cd894591e70182434d5d2de75.1346761472.git.minovotn@redhat.com> References: <66350080c56dd39cd894591e70182434d5d2de75.1346761472.git.minovotn@redhat.com> From: Yonit Halperin Date: Sun, 26 Aug 2012 09:54:07 +0200 Subject: [PATCH 04/10] spice: notify spice server on vm start/stop RH-Author: Yonit Halperin Message-id: <1345974852-592-1-git-send-email-yhalperi@redhat.com> Patchwork-id: 41269 O-Subject: [PATCH 1/6] spice: notify spice server on vm start/stop Bugzilla: 836133 RH-Acked-by: Gerd Hoffmann RH-Acked-by: Alon Levy RH-Acked-by: Uri Lublin Spice server needs to know about the vm state in order to prevent attempts to write to devices when they are stopped, mainly during the non-live stage of migration. Instead, spice will take care of restoring these writes, on the migration target side, after migration completes. rhbz#836133 upstream: http://patchwork.ozlabs.org/patch/179005/ Signed-off-by: Yonit Halperin --- ui/spice-core.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) Signed-off-by: Michal Novotny --- ui/spice-core.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/spice-core.c b/ui/spice-core.c index d16610b..1702aa0 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -35,6 +35,7 @@ #include "migration.h" #include "monitor.h" #include "hw/hw.h" +#include "sysemu.h" /* core bits */ @@ -585,6 +586,19 @@ static int add_channel(const char *name, const char *value, void *opaque) return 0; } +static void vm_change_state_handler(void *opaque, int running, + RunState state) +{ +#if SPICE_SERVER_VERSION >= 0x000b02 /* 0.11.2 */ + if (running) { + spice_server_vm_start(spice_server); + } else { + spice_server_vm_stop(spice_server); + } +#endif +} + + void qemu_spice_init(void) { QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head); @@ -745,6 +759,8 @@ void qemu_spice_init(void) qemu_spice_input_init(); qemu_spice_audio_init(); + qemu_add_vm_change_state_handler(vm_change_state_handler, &spice_server); + qemu_free(x509_key_file); qemu_free(x509_cert_file); qemu_free(x509_cacert_file); -- 1.7.11.4