[Spice-commits] Branch '0.8' - 3 commits - server/reds.c server/spice-experimental.h server/spice.h
Gerd Hoffmann
kraxel at kemper.freedesktop.org
Thu Dec 16 00:17:59 PST 2010
server/reds.c | 66 +++++++++++++++++++++++++++++++++++++-------
server/spice-experimental.h | 29 -------------------
server/spice.h | 33 ++++++++++++++++++++++
3 files changed, 90 insertions(+), 38 deletions(-)
New commits:
commit bca5403370df212fb3e39d36b1871a5079c31b96
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Tue Dec 14 12:56:15 2010 +0100
move chardevs out of experimental
While we are at it: There is no reason for chardev
support to stay in the experimental area, so move it out.
qemu should not need the "spice-experimental.h" file.
Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
(cherry picked from commit 7bbc2ba090788d844573e044041480ff6e3cba7b)
diff --git a/server/spice-experimental.h b/server/spice-experimental.h
index f1b7385..482ac44 100644
--- a/server/spice-experimental.h
+++ b/server/spice-experimental.h
@@ -3,31 +3,6 @@
#include "spice.h"
-/* char device interfaces */
-#define SPICE_INTERFACE_CHAR_DEVICE "char_device"
-#define SPICE_INTERFACE_CHAR_DEVICE_MAJOR 1
-#define SPICE_INTERFACE_CHAR_DEVICE_MINOR 1
-typedef struct SpiceCharDeviceInterface SpiceCharDeviceInterface;
-typedef struct SpiceCharDeviceInstance SpiceCharDeviceInstance;
-typedef struct SpiceCharDeviceState SpiceCharDeviceState;
-
-struct SpiceCharDeviceInterface {
- SpiceBaseInterface base;
-
- void (*state)(SpiceCharDeviceInstance *sin, int connected);
- int (*write)(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len);
- int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len);
-};
-
-struct SpiceCharDeviceInstance {
- SpiceBaseInstance base;
- const char* subtype;
- SpiceCharDeviceState *st;
-};
-
-void spice_server_char_device_wakeup(SpiceCharDeviceInstance *sin);
-const char** spice_server_char_device_recognized_subtypes(void);
-
/* tunnel interface */
#define SPICE_INTERFACE_NET_WIRE "net_wire"
diff --git a/server/spice.h b/server/spice.h
index 87303ab..f6a4fe0 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -322,6 +322,32 @@ void spice_server_record_stop(SpiceRecordInstance *sin);
uint32_t spice_server_record_get_samples(SpiceRecordInstance *sin,
uint32_t *samples, uint32_t bufsize);
+/* char device interfaces */
+
+#define SPICE_INTERFACE_CHAR_DEVICE "char_device"
+#define SPICE_INTERFACE_CHAR_DEVICE_MAJOR 1
+#define SPICE_INTERFACE_CHAR_DEVICE_MINOR 1
+typedef struct SpiceCharDeviceInterface SpiceCharDeviceInterface;
+typedef struct SpiceCharDeviceInstance SpiceCharDeviceInstance;
+typedef struct SpiceCharDeviceState SpiceCharDeviceState;
+
+struct SpiceCharDeviceInterface {
+ SpiceBaseInterface base;
+
+ void (*state)(SpiceCharDeviceInstance *sin, int connected);
+ int (*write)(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len);
+ int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len);
+};
+
+struct SpiceCharDeviceInstance {
+ SpiceBaseInstance base;
+ const char* subtype;
+ SpiceCharDeviceState *st;
+};
+
+void spice_server_char_device_wakeup(SpiceCharDeviceInstance *sin);
+const char** spice_server_char_device_recognized_subtypes(void);
+
/* spice server setup */
/* Don't use features incompatible with a specific spice
commit 215cd7f90314788fb8f6a9625bb788ece274a716
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Tue Dec 14 12:58:26 2010 +0100
move switch-host migration out of experimental
seamless stays in the experimental area.
comments updates too.
Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
(cherry picked from commit 6acb817071daa13b8389bfce12cac6221997cebe)
diff --git a/server/spice-experimental.h b/server/spice-experimental.h
index 70d2246..f1b7385 100644
--- a/server/spice-experimental.h
+++ b/server/spice-experimental.h
@@ -53,7 +53,7 @@ struct SpiceNetWireInstance {
void spice_server_net_wire_recv_packet(SpiceNetWireInstance *sin,
const uint8_t *pkt, int len);
-/* spice client migration */
+/* spice seamless client migration (broken) */
enum {
SPICE_MIGRATE_CLIENT_NONE = 1,
@@ -61,13 +61,9 @@ enum {
SPICE_MIGRATE_CLIENT_READY,
};
-int spice_server_migrate_info(SpiceServer *s, const char* dest,
- int port, int secure_port,
- const char* cert_subject);
int spice_server_migrate_start(SpiceServer *s);
int spice_server_migrate_client_state(SpiceServer *s);
int spice_server_migrate_end(SpiceServer *s, int completed);
-int spice_server_migrate_switch(SpiceServer *s);
#endif // __SPICE_EXPERIMENTAL_H__
diff --git a/server/spice.h b/server/spice.h
index 898a32d..87303ab 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -404,4 +404,11 @@ int spice_server_set_agent_mouse(SpiceServer *s, int enable);
int spice_server_get_sock_info(SpiceServer *s, struct sockaddr *sa, socklen_t *salen);
int spice_server_get_peer_info(SpiceServer *s, struct sockaddr *sa, socklen_t *salen);
+/* spice switch-host client migration */
+
+int spice_server_migrate_info(SpiceServer *s, const char* dest,
+ int port, int secure_port,
+ const char* cert_subject);
+int spice_server_migrate_switch(SpiceServer *s);
+
#endif
commit 697c91db808446e1422dc5593c9f040e373e40bb
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Mon Dec 13 23:08:57 2010 +0100
client migration: switch host
Implement server-side support for switch-host client migration. Client
side support is present already in the tree.
Setting the migration information is done using the existing
spice_server_migrate_info() function. A new
spice_server_migrate_switch() function has been added which triggers
sending out the switch-host message.
Seamless migration functions are left there for now.
spice_server_migrate_start() has been chamnged to just fail
unconditionally though as seamless migration is broken anyway.
Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
(cherry picked from commit 4b1ea4e102bb8a737487dab51dd0f3fc94352948)
diff --git a/server/reds.c b/server/reds.c
index 28409b9..601acc4 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3238,6 +3238,7 @@ struct RedsMigSpice {
char pub_key[SPICE_TICKET_PUBKEY_BYTES];
uint32_t mig_key;
char *host;
+ char *cert_subject;
int port;
int sport;
uint16_t cert_pub_key_type;
@@ -3254,6 +3255,16 @@ typedef struct RedsMigCertPubKeyInfo {
uint32_t len;
} RedsMigCertPubKeyInfo;
+static void reds_mig_release(void)
+{
+ if (reds->mig_spice) {
+ free(reds->mig_spice->cert_subject);
+ free(reds->mig_spice->host);
+ free(reds->mig_spice);
+ reds->mig_spice = NULL;
+ }
+}
+
static void reds_mig_continue(void)
{
RedsMigSpice *s = reds->mig_spice;
@@ -3274,9 +3285,7 @@ static void reds_mig_continue(void)
reds_push_pipe_item(item);
- free(reds->mig_spice->host);
- free(reds->mig_spice);
- reds->mig_spice = NULL;
+ reds_mig_release();
reds->mig_wait_connect = TRUE;
core->timer_start(reds->mig_timer, MIGRATE_TIMEOUT);
@@ -3311,11 +3320,7 @@ static void reds_mig_started(void)
return;
error:
- if (reds->mig_spice) {
- free(reds->mig_spice->host);
- free(reds->mig_spice);
- reds->mig_spice = NULL;
- }
+ reds_mig_release();
reds_mig_disconnect();
}
@@ -3362,6 +3367,33 @@ static void reds_mig_finished(int completed)
}
}
+static void reds_mig_switch(void)
+{
+ RedsMigSpice *s = reds->mig_spice;
+ SpiceMsgMainMigrationSwitchHost migrate;
+ RedsOutItem *item;
+
+ red_printf("");
+ item = new_out_item(SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST);
+
+ migrate.port = s->port;
+ migrate.sport = s->sport;
+ migrate.host_size = strlen(s->host) + 1;
+ migrate.host_data = (uint8_t *)s->host;
+ if (s->cert_subject) {
+ migrate.cert_subject_size = strlen(s->cert_subject) + 1;
+ migrate.cert_subject_data = (uint8_t *)s->cert_subject;
+ } else {
+ migrate.cert_subject_size = 0;
+ migrate.cert_subject_data = NULL;
+ }
+ spice_marshall_msg_main_migrate_switch_host(item->m, &migrate);
+
+ reds_push_pipe_item(item);
+
+ reds_mig_release();
+}
+
static void migrate_timout(void *opaque)
{
red_printf("");
@@ -4098,19 +4130,25 @@ __visible__ int spice_server_migrate_info(SpiceServer *s, const char* dest,
spice_migration->port = port;
spice_migration->sport = secure_port;
spice_migration->host = strdup(dest);
-
if (cert_subject) {
- /* TODO */
+ spice_migration->cert_subject = strdup(cert_subject);
}
+ reds_mig_release();
reds->mig_spice = spice_migration;
return 0;
}
+/* interface for seamless migration */
__visible__ int spice_server_migrate_start(SpiceServer *s)
{
ASSERT(reds == s);
+ if (1) {
+ /* seamless doesn't work, fixing needs protocol change. */
+ return -1;
+ }
+
if (!reds->mig_spice) {
return -1;
}
@@ -4138,3 +4176,11 @@ __visible__ int spice_server_migrate_end(SpiceServer *s, int completed)
reds_mig_finished(completed);
return 0;
}
+
+/* interface for switch-host migration */
+__visible__ int spice_server_migrate_switch(SpiceServer *s)
+{
+ ASSERT(reds == s);
+ reds_mig_switch();
+ return 0;
+}
diff --git a/server/spice-experimental.h b/server/spice-experimental.h
index 526062f..70d2246 100644
--- a/server/spice-experimental.h
+++ b/server/spice-experimental.h
@@ -61,11 +61,13 @@ enum {
SPICE_MIGRATE_CLIENT_READY,
};
-int spice_server_migrate_info(SpiceServer *s, const char* dest, int port, int secure_port,
+int spice_server_migrate_info(SpiceServer *s, const char* dest,
+ int port, int secure_port,
const char* cert_subject);
int spice_server_migrate_start(SpiceServer *s);
int spice_server_migrate_client_state(SpiceServer *s);
int spice_server_migrate_end(SpiceServer *s, int completed);
+int spice_server_migrate_switch(SpiceServer *s);
#endif // __SPICE_EXPERIMENTAL_H__
More information about the Spice-commits
mailing list