[Spice-devel,06/55] spice.h: add spice_server_set_seamless_migration

Submitted by Yonit Halperin on Aug. 15, 2012, 7:55 a.m.

Details

Message ID 1345017402-872-11-git-send-email-yhalperi@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Yonit Halperin Aug. 15, 2012, 7:55 a.m.
This new call is used in order to identify whether qemu, or
the management (e.g. libvirt), support seamless migration.
If it is supported, qemu spice cmd-line configuration should have
seamless-migration=on.

In addition, we disable seamless migration support if multiple clients
are allowed. Currently, only one client is supported.
---
 server/reds.c  |    9 +++++++++
 server/spice.h |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/reds.c b/server/reds.c
index b0c609f..b053a84 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -254,6 +254,7 @@  typedef struct RedsState {
 
     int vm_running;
     Ring char_devs_states; /* list of SpiceCharDeviceStateItem */
+    int seamless_migration_enabled;
 
     SSL_CTX *ctx;
 
@@ -4057,6 +4058,14 @@  SPICE_GNUC_VISIBLE void spice_server_vm_stop(SpiceServer *s)
     }
 }
 
+SPICE_GNUC_VISIBLE void spice_server_set_seamless_migration(SpiceServer *s, int enable)
+{
+    spice_assert(s == reds);
+    /* seamless migration is not supported with multiple clients */
+    reds->seamless_migration_enabled = enable && !reds->allow_multiple_clients;
+    spice_debug("seamless migration enabled=%d", enable);
+}
+
 ssize_t reds_stream_read(RedsStream *s, void *buf, size_t nbyte)
 {
     ssize_t ret;
diff --git a/server/spice.h b/server/spice.h
index 5f82ed5..1efd007 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -525,6 +525,8 @@  int spice_server_migrate_connect(SpiceServer *s, const char* dest,
 int spice_server_migrate_start(SpiceServer *s);
 int spice_server_migrate_end(SpiceServer *s, int completed);
 
+void spice_server_set_seamless_migration(SpiceServer *s, int enable);
+
 void spice_server_set_name(SpiceServer *s, const char *name);
 void spice_server_set_uuid(SpiceServer *s, const uint8_t uuid[16]);