[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: support "spice" (remote display protocol) with upstream qemu



# HG changeset patch
# User Zhou Peng <zhoupeng@xxxxxxxxxxxxxxx>
# Date 1306416832 -3600
# Node ID d8d24e8a81f8413eb25b14984f69d0e39e63eb3a
# Parent  1fc3347850c7bc509b997a89d6c91b8277139d00
libxl: support "spice" (remote display protocol) with upstream qemu

This patch allows you to use spice for
xen-upstream-qemu on upstream Xen or released Xen-4.1.0.

Nothing need to be modified in xen-upstream-qemu,
because qemu has include spice's code as a new feature since qemu-0.14.

Usage:

Add spice fields in VM cfg file.  e.g.
    spice=1
    spiceport=6000
    spicehost='192.168.1.187'
    spicedisable_ticketing = 0 # default is 0
    spicepasswd = 'password'
    spiceagent_mouse = 1 # default is 1

Signed-off-by: Zhou Peng <zhoupeng@xxxxxxxxxxxxxxx>
Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 1fc3347850c7 -r d8d24e8a81f8 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl     Thu May 26 12:37:47 2011 +0100
+++ b/tools/libxl/libxl.idl     Thu May 26 14:33:52 2011 +0100
@@ -210,6 +210,22 @@
     ("keymap",           string,            False, "set keyboard layout, 
default is en-us keyboard"),
     ("sdl",              bool,              False, "sdl enabled or disabled"),
     ("opengl",           bool,              False, "opengl enabled or disabled 
(if enabled requires sdl enabled)"),
+    ("spice",            bool,              False,
+    "spice enabled or disabled"),
+    ("spiceport",        integer,           False, 
+    "the port that should be listened on for the spice server"),
+    ("spicetls_port",    integer,           False, """the tls port
+that should be listened on for the spice server, 
+at least one of the port or tls port must be given"""),
+    ("spicehost",        string,            False, """the interface
+that should be listened on if given otherwise any interface"""),
+    ("spicedisable_ticketing", bool,        False, 
+    "enable client connection with no password"),
+    ("spicepasswd",      string,            False, """set ticket password
+witch must be used by a client for connection.
+The password never expires"""),
+    ("spiceagent_mouse", bool,              False, 
+    "Whether spice agent is used for client mouse mode(default is on)"),
     ("nographic",        bool,              False, "no graphics, use serial 
port"),
     ("gfx_passthru",     bool,              False, "graphics passthrough 
enabled or disabled"),
     ("serial",           string,            False, "serial port re-direct to 
pty deivce"),
diff -r 1fc3347850c7 -r d8d24e8a81f8 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Thu May 26 12:37:47 2011 +0100
+++ b/tools/libxl/libxl_dm.c    Thu May 26 14:33:52 2011 +0100
@@ -282,6 +282,43 @@
     if (info->sdl) {
         flexarray_append(dm_args, "-sdl");
     }
+    if (info->spice) {
+        char *spiceoptions = NULL;
+        if (!info->spiceport && !info->spicetls_port) {
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                "at least one of the spiceport or tls_port must be provided");
+            return NULL;
+        }
+
+        if (!info->spicedisable_ticketing) {
+            if (!info->spicepasswd) {
+                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                    "spice ticketing is enabled but missing password");
+                return NULL;
+            }
+            else if (!info->spicepasswd[0]) {
+                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                    "spice password can't be empty");
+                return NULL;
+            }
+        }
+        spiceoptions = libxl__sprintf(gc, "port=%d,tls-port=%d",
+                       info->spiceport, info->spicetls_port);
+        if (info->spicehost)
+            spiceoptions = libxl__sprintf(gc,
+                    "%s,addr=%s", spiceoptions, info->spicehost);
+        if (info->spicedisable_ticketing)
+            spiceoptions = libxl__sprintf(gc, "%s,disable-ticketing",
+                                               spiceoptions);
+        else
+            spiceoptions = libxl__sprintf(gc,
+                    "%s,password=%s", spiceoptions, info->spicepasswd);
+        spiceoptions = libxl__sprintf(gc, "%s,agent-mouse=%s", spiceoptions,
+                                      info->spiceagent_mouse ? "on" : "off");
+
+        flexarray_append(dm_args, "-spice");
+        flexarray_append(dm_args, spiceoptions);
+    }
 
     if (info->type == LIBXL_DOMAIN_TYPE_PV && !info->nographic) {
         flexarray_vappend(dm_args, "-vga", "xenfb", NULL);
diff -r 1fc3347850c7 -r d8d24e8a81f8 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu May 26 12:37:47 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Thu May 26 14:33:52 2011 +0100
@@ -367,6 +367,13 @@
         printf("\t\t\t(usb %d)\n", dm_info->usb);
         printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
         printf("\t\t\t(acpi %d)\n", dm_info->acpi);
+        printf("\t\t\t(spice %d)\n", dm_info->spice);
+        printf("\t\t\t(spiceport %d)\n", dm_info->spiceport);
+        printf("\t\t\t(spicetls_port %d)\n", dm_info->spicetls_port);
+        printf("\t\t\t(spicehost %s)\n", dm_info->spicehost);
+        printf("\t\t\t(spicedisable_ticketing %d)\n",
+                    dm_info->spicedisable_ticketing);
+        printf("\t\t\t(spiceagent_mouse %d)\n", dm_info->spiceagent_mouse);
         printf("\t\t)\n");
     } else {
         printf("\t\t(linux %d)\n", b_info->hvm);
@@ -1124,6 +1131,20 @@
             dm_info->sdl = l;
         if (!xlu_cfg_get_long (config, "opengl", &l))
             dm_info->opengl = l;
+        if (!xlu_cfg_get_long (config, "spice", &l))
+            dm_info->spice = l;
+        if (!xlu_cfg_get_long (config, "spiceport", &l))
+            dm_info->spiceport = l;
+        if (!xlu_cfg_get_long (config, "spicetls_port", &l))
+            dm_info->spicetls_port = l;
+        xlu_cfg_replace_string (config, "spicehost", &dm_info->spicehost);
+        if (!xlu_cfg_get_long (config, "spicedisable_ticketing", &l))
+            dm_info->spicedisable_ticketing = l;
+        xlu_cfg_replace_string (config, "spicepasswd", &dm_info->spicepasswd);
+        if (!xlu_cfg_get_long (config, "spiceagent_mouse", &l))
+            dm_info->spiceagent_mouse = l;
+        else
+            dm_info->spiceagent_mouse = 1;
         if (!xlu_cfg_get_long (config, "nographic", &l))
             dm_info->nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l))

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.