From b419115ab3e8952457e952f6ba913a375c5c4d95 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 15 Jul 2014 06:51:01 -0500
Subject: [CHANGE 4/4] spice: move spice_server_vm_{start, stop} calls into
 qemu_spice_display_*()
To: rhvirt-patches@redhat.com,
    jen@redhat.com

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1405407061-27644-4-git-send-email-kraxel@redhat.com>
Patchwork-id: 59893
O-Subject: [RHEL-6.6 qemu-kvm PATCH 3/3] spice: move spice_server_vm_{start, stop} calls into qemu_spice_display_*()
Bugzilla: 995931
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Levente Kurusa <lkurusa@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>

So calling spice server to start/stop the worker goes
hand in hand with the status variable update.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit b50f3e42b9438e033074222671c0502ecfeba82c)
Signed-off-by: jen <jen@redhat.com>
---
 ui/spice-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui/spice-core.c b/ui/spice-core.c
index 55476dd..c7ec2da 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -612,9 +612,7 @@ static void vm_change_state_handler(void *opaque, int running,
 #if SPICE_SERVER_VERSION >= 0x000b02 /* 0.11.2 */
     if (running) {
         qemu_spice_display_start();
-        spice_server_vm_start(spice_server);
     } else {
-        spice_server_vm_stop(spice_server);
         qemu_spice_display_stop();
     }
 #endif
@@ -876,10 +874,12 @@ int qemu_spice_set_pw_expire(time_t expires)
 void qemu_spice_display_start(void)
 {
     spice_display_is_running = true;
+    spice_server_vm_start(spice_server);
 }
 
 void qemu_spice_display_stop(void)
 {
+    spice_server_vm_stop(spice_server);
     spice_display_is_running = false;
 }
 
-- 
1.9.3

