[Spice-devel] [PATCH qemu 1/2] add the ability to specify Spice keepalive

Sunny Shin sunny4s.git at gmail.com
Mon Nov 30 20:45:07 PST 2015


add the ability to specify Spice keepalive

Signed-off-by: Sunny Shin <sunny4s.git at gmail.com>
---
 qemu-options.hx |  4 ++++
 ui/spice-core.c | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/qemu-options.hx b/qemu-options.hx
index 0eea4ee..bc8fe42 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -995,6 +995,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice,
     "       [,streaming-video=[off|all|filter]][,disable-copy-paste]\n"
     "       [,disable-agent-file-xfer][,agent-mouse=[on|off]]\n"
     "
[,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"
+    "       [,keepalive-timeout=<timeout>]\n"
     "   enable spice\n"
     "   at least one of {port, tls-port} is mandatory\n",
     QEMU_ARCH_ALL)
@@ -1086,6 +1087,9 @@ Enable/disable audio stream compression (using celt
0.5.1).  Default is on.
 @item seamless-migration=[on|off]
 Enable/disable spice seamless migration. Default is off.

+ at item keepalive-timeout=[<timeout>]
+Enable tcp keepalive and set timeout as specified value.
+
 @end table
 ETEXI

diff --git a/ui/spice-core.c b/ui/spice-core.c
index 6a62d71..1ffff9b 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -496,6 +496,9 @@ static QemuOptsList qemu_spice_opts = {
         }, {
             .name = "seamless-migration",
             .type = QEMU_OPT_BOOL,
+        }, {
+            .name = "keepalive-timeout",
+            .type = QEMU_OPT_NUMBER,
         },
         { /* end of list */ }
     },
@@ -644,6 +647,7 @@ void qemu_spice_init(void)
     spice_image_compression_t compression;
     spice_wan_compression_t wan_compr;
     bool seamless_migration;
+    int keepalive_timeout;

     qemu_thread_get_self(&me);

@@ -794,6 +798,17 @@ void qemu_spice_init(void)

     seamless_migration = qemu_opt_get_bool(opts, "seamless-migration", 0);
     spice_server_set_seamless_migration(spice_server, seamless_migration);
+
+    keepalive_timeout = qemu_opt_get_number(opts, "keepalive-timeout", 0);
+    if (keepalive_timeout > 0) {
+#if SPICE_SERVER_VERSION >= 0x000c06
+        spice_server_set_keepalive_timeout(spice_server,
keepalive_timeout);
+#else
+        error_report("this qemu build does not support the "
+                     "\"keepalive-timeout\" option");
+#endif
+    }
+
     if (spice_server_init(spice_server, &core_interface) != 0) {
         error_report("failed to initialize spice server");
         exit(1);
--
2.5.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151201/c258b9c8/attachment-0001.html>


More information about the Spice-devel mailing list