summaryrefslogtreecommitdiff
path: root/ui/spice-core.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-04-23 13:28:21 +0200
committerGerd Hoffmann <kraxel@redhat.com>2011-01-24 15:13:54 +0100
commite866e23959b45325414ac84a21f31dea79867ee6 (patch)
treed6d618e0fdb5933be9a8d74d65e1ca9839119384 /ui/spice-core.c
parent99a0db9b8dd72ea20a2d4cd99fe91b08903ae857 (diff)
downloadqemu-e866e23959b45325414ac84a21f31dea79867ee6.tar.gz
spice/vnc: client migration.
Handle spice client migration, i.e. inform a spice client connected about the new host and connection parameters, so it can move over the connection automatically. The monitor command has a not-yet used protocol argument simliar to set_password and expire_password commands. This allows to add a simliar feature to vnc in the future. Daniel Berrange plans to work on this. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/spice-core.c')
-rw-r--r--ui/spice-core.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 27a1ced430..1aa1a5ed18 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -30,11 +30,15 @@
#include "qbool.h"
#include "qstring.h"
#include "qjson.h"
+#include "notify.h"
+#include "migration.h"
#include "monitor.h"
+#include "hw/hw.h"
/* core bits */
static SpiceServer *spice_server;
+static Notifier migration_state;
static const char *auth = "spice";
static char *auth_passwd;
static time_t auth_expires = TIME_MAX;
@@ -416,6 +420,24 @@ void do_info_spice(Monitor *mon, QObject **ret_data)
*ret_data = QOBJECT(server);
}
+static void migration_state_notifier(Notifier *notifier)
+{
+ int state = get_migration_state();
+
+ if (state == MIG_STATE_COMPLETED) {
+#if SPICE_SERVER_VERSION >= 0x000701 /* 0.7.1 */
+ spice_server_migrate_switch(spice_server);
+#endif
+ }
+}
+
+int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
+ const char *subject)
+{
+ return spice_server_migrate_info(spice_server, hostname,
+ port, tls_port, subject);
+}
+
static int add_channel(const char *name, const char *value, void *opaque)
{
int security = 0;
@@ -573,6 +595,9 @@ void qemu_spice_init(void)
spice_server_init(spice_server, &core_interface);
using_spice = 1;
+ migration_state.notify = migration_state_notifier;
+ add_migration_state_change_notifier(&migration_state);
+
qemu_spice_input_init();
qemu_spice_audio_init();