Blame 0035-Revert-spice-live-migration-wip.patch

Justin M. Forbes a81953
From 3e0d1b6ed5f8e8b871803337008e104398e4db0a Mon Sep 17 00:00:00 2001
Justin M. Forbes a81953
From: Gerd Hoffmann <kraxel@redhat.com>
Justin M. Forbes a81953
Date: Wed, 8 Sep 2010 11:48:57 +0200
Justin M. Forbes a81953
Subject: [PATCH 35/39] Revert "spice: live migration (wip)."
Justin M. Forbes a81953
Justin M. Forbes a81953
This reverts commit 85b9db9ba993af737c9c402cf2f67db7b1b3cbce.
Justin M. Forbes a81953
Justin M. Forbes a81953
Conflicts:
Justin M. Forbes a81953
Justin M. Forbes a81953
	spice.c
Justin M. Forbes a81953
---
Justin M. Forbes a81953
 monitor.c       |    1 -
Justin M. Forbes a81953
 qemu-monitor.hx |   11 -------
Justin M. Forbes a81953
 qemu-spice.h    |    2 -
Justin M. Forbes a81953
 spice.c         |   87 -------------------------------------------------------
Justin M. Forbes a81953
 4 files changed, 0 insertions(+), 101 deletions(-)
Justin M. Forbes a81953
Justin M. Forbes a81953
diff --git a/monitor.c b/monitor.c
Justin M. Forbes a81953
index 6674a8c..e51df62 100644
Justin M. Forbes a81953
--- a/monitor.c
Justin M. Forbes a81953
+++ b/monitor.c
Justin M. Forbes a81953
@@ -57,7 +57,6 @@
Justin M. Forbes a81953
 #include "osdep.h"
Justin M. Forbes a81953
 #include "exec-all.h"
Justin M. Forbes a81953
 #include "qemu-kvm.h"
Justin M. Forbes a81953
-#include "qemu-spice.h"
Justin M. Forbes a81953
Justin M. Forbes a81953
 //#define DEBUG
Justin M. Forbes a81953
 //#define DEBUG_COMPLETION
Justin M. Forbes a81953
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
Justin M. Forbes a81953
index c2570d9..da7b796 100644
Justin M. Forbes a81953
--- a/qemu-monitor.hx
Justin M. Forbes a81953
+++ b/qemu-monitor.hx
Justin M. Forbes a81953
@@ -2510,17 +2510,6 @@ ETEXI
Justin M. Forbes a81953
Justin M. Forbes a81953
 HXCOMM DO NOT add new commands after 'info', move your addition before it!
Justin M. Forbes a81953
Justin M. Forbes a81953
-#if defined(CONFIG_SPICE)
Justin M. Forbes a81953
-    {
Justin M. Forbes a81953
-        .name       = "spice_migrate_info",
Justin M. Forbes a81953
-        .args_type  = "hostname:s,port:i?,tls-port:i?,cert-subject:s?",
Justin M. Forbes a81953
-        .params     = "hostname port tls-port cert-subject",
Justin M. Forbes a81953
-        .help       = "send migration info to spice client",
Justin M. Forbes a81953
-	.user_print = monitor_user_noop,
Justin M. Forbes a81953
-        .mhandler.cmd_new = mon_spice_migrate,
Justin M. Forbes a81953
-    },
Justin M. Forbes a81953
-#endif
Justin M. Forbes a81953
-
Justin M. Forbes a81953
 STEXI
Justin M. Forbes a81953
 @end table
Justin M. Forbes a81953
 ETEXI
Justin M. Forbes a81953
diff --git a/qemu-spice.h b/qemu-spice.h
Justin M. Forbes a81953
index 3c8e959..6f19ba7 100644
Justin M. Forbes a81953
--- a/qemu-spice.h
Justin M. Forbes a81953
+++ b/qemu-spice.h
Justin M. Forbes a81953
@@ -16,8 +16,6 @@ void qemu_spice_input_init(void);
Justin M. Forbes a81953
 void qemu_spice_audio_init(void);
Justin M. Forbes a81953
 void qemu_spice_display_init(DisplayState *ds);
Justin M. Forbes a81953
Justin M. Forbes a81953
-int mon_spice_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data);
Justin M. Forbes a81953
-
Justin M. Forbes a81953
 #else  /* CONFIG_SPICE */
Justin M. Forbes a81953
Justin M. Forbes a81953
 #define using_spice 0
Justin M. Forbes a81953
diff --git a/spice.c b/spice.c
Justin M. Forbes a81953
index 76e6ac1..e6f047d 100644
Justin M. Forbes a81953
--- a/spice.c
Justin M. Forbes a81953
+++ b/spice.c
Justin M. Forbes a81953
@@ -11,7 +11,6 @@
Justin M. Forbes a81953
 #include "qemu-queue.h"
Justin M. Forbes a81953
 #include "qemu-x509.h"
Justin M. Forbes a81953
 #include "monitor.h"
Justin M. Forbes a81953
-#include "hw/hw.h"
Justin M. Forbes a81953
Justin M. Forbes a81953
 /* core bits */
Justin M. Forbes a81953
Justin M. Forbes a81953
@@ -123,90 +122,8 @@ static SpiceCoreInterface core_interface = {
Justin M. Forbes a81953
     .watch_remove       = watch_remove,
Justin M. Forbes a81953
 };
Justin M. Forbes a81953
Justin M. Forbes a81953
-/* handle client migration */
Justin M. Forbes a81953
-
Justin M. Forbes a81953
-static int spice_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
Justin M. Forbes a81953
-{
Justin M. Forbes a81953
-    static int last_stage;
Justin M. Forbes a81953
-    static int migrate_client, client_connected;
Justin M. Forbes a81953
-    int ret = 1;
Justin M. Forbes a81953
-
Justin M. Forbes a81953
-    if (last_stage != stage) {
Justin M. Forbes a81953
-        last_stage = stage;
Justin M. Forbes a81953
-        fprintf(stderr, "%s: stage %d\n", __FUNCTION__, stage);
Justin M. Forbes a81953
-    } else {
Justin M. Forbes a81953
-        fprintf(stderr, ".");
Justin M. Forbes a81953
-    }
Justin M. Forbes a81953
-
Justin M. Forbes a81953
-    switch (stage) {
Justin M. Forbes a81953
-    case 1:
Justin M. Forbes a81953
-        migrate_client = 1;
Justin M. Forbes a81953
-        client_connected = 0;
Justin M. Forbes a81953
-        fprintf(stderr, "%s: start client migration\n", __FUNCTION__);
Justin M. Forbes a81953
-        if (spice_server_migrate_start(spice_server) != 0) {
Justin M. Forbes a81953
-            fprintf(stderr, "%s: fail -> no client migration\n", __FUNCTION__);
Justin M. Forbes a81953
-            migrate_client = 0;
Justin M. Forbes a81953
-        }
Justin M. Forbes a81953
-        break;
Justin M. Forbes a81953
-    case 2:
Justin M. Forbes a81953
-        if (!migrate_client)
Justin M. Forbes a81953
-            break;
Justin M. Forbes a81953
-        switch (spice_server_migrate_client_state(spice_server)) {
Justin M. Forbes a81953
-        case SPICE_MIGRATE_CLIENT_NONE:
Justin M. Forbes a81953
-            fprintf(stderr, "%s: no client connected\n", __FUNCTION__);
Justin M. Forbes a81953
-            migrate_client = 0;
Justin M. Forbes a81953
-            break;
Justin M. Forbes a81953
-        case SPICE_MIGRATE_CLIENT_WAITING:
Justin M. Forbes a81953
-            ret = 0;
Justin M. Forbes a81953
-            break;
Justin M. Forbes a81953
-        case SPICE_MIGRATE_CLIENT_READY:
Justin M. Forbes a81953
-            if (!client_connected) {
Justin M. Forbes a81953
-                fprintf(stderr, "%s: client connected to target\n", __FUNCTION__);
Justin M. Forbes a81953
-                client_connected = 1;
Justin M. Forbes a81953
-            }
Justin M. Forbes a81953
-            break;
Justin M. Forbes a81953
-        }
Justin M. Forbes a81953
-        break;
Justin M. Forbes a81953
-    case 3:
Justin M. Forbes a81953
-        if (migrate_client && client_connected) {
Justin M. Forbes a81953
-            fprintf(stderr, "%s: finish client migration\n", __FUNCTION__);
Justin M. Forbes a81953
-            spice_server_migrate_end(spice_server, 1);
Justin M. Forbes a81953
-        }
Justin M. Forbes a81953
-        break;
Justin M. Forbes a81953
-    }
Justin M. Forbes a81953
-    return ret;
Justin M. Forbes a81953
-}
Justin M. Forbes a81953
-
Justin M. Forbes a81953
-static void spice_save(QEMUFile *f, void *opaque)
Justin M. Forbes a81953
-{
Justin M. Forbes a81953
-    fprintf(stderr, "%s:\n", __FUNCTION__);
Justin M. Forbes a81953
-}
Justin M. Forbes a81953
-
Justin M. Forbes a81953
-static int spice_load(QEMUFile *f, void *opaque, int version_id)
Justin M. Forbes a81953
-{
Justin M. Forbes a81953
-    fprintf(stderr, "%s:\n", __FUNCTION__);
Justin M. Forbes a81953
-    return 0;
Justin M. Forbes a81953
-}
Justin M. Forbes a81953
-
Justin M. Forbes a81953
 /* functions for the rest of qemu */
Justin M. Forbes a81953
Justin M. Forbes a81953
-int mon_spice_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
Justin M. Forbes a81953
-{
Justin M. Forbes a81953
-    const char *hostname = qdict_get_str(qdict, "hostname");
Justin M. Forbes a81953
-    const char *subject  = qdict_get_try_str(qdict, "cert-subject");
Justin M. Forbes a81953
-    int port             = qdict_get_try_int(qdict, "port", -1);
Justin M. Forbes a81953
-    int tls_port         = qdict_get_try_int(qdict, "tls-port", -1);
Justin M. Forbes a81953
-
Justin M. Forbes a81953
-    if (!spice_server) {
Justin M. Forbes a81953
-        qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");
Justin M. Forbes a81953
-        return -1;
Justin M. Forbes a81953
-    }
Justin M. Forbes a81953
-
Justin M. Forbes a81953
-    /* TODO: Convert to QError */
Justin M. Forbes a81953
-    return spice_server_migrate_info(spice_server, hostname,
Justin M. Forbes a81953
-                                     port, tls_port, subject);
Justin M. Forbes a81953
-}
Justin M. Forbes a81953
-
Justin M. Forbes a81953
 #if defined(SPICE_SERVER_VERSION) && SPICE_SERVER_VERSION >= 0x000503
Justin M. Forbes a81953
 static inline spice_wan_compression_t get_wan_compression_value(const char *str)
Justin M. Forbes a81953
 {
Justin M. Forbes a81953
@@ -322,10 +239,6 @@ void qemu_spice_init(void)
Justin M. Forbes a81953
     qemu_spice_input_init();
Justin M. Forbes a81953
     qemu_spice_audio_init();
Justin M. Forbes a81953
Justin M. Forbes a81953
-    register_savevm_live(NULL, "spice", -1, 1, NULL,
Justin M. Forbes a81953
-                         spice_live, spice_save, spice_load,
Justin M. Forbes a81953
-                         spice_server);
Justin M. Forbes a81953
-
Justin M. Forbes a81953
     qemu_free(x509_key_file);
Justin M. Forbes a81953
     qemu_free(x509_cert_file);
Justin M. Forbes a81953
     qemu_free(x509_cacert_file);
Justin M. Forbes a81953
-- 
Justin M. Forbes a81953
1.7.2.3
Justin M. Forbes a81953