xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: ZhouPeng <zpengxen@gmail.com>
To: "Xen-Devel (E-mail)" <xen-devel@lists.xensource.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
Date: Mon, 18 Apr 2011 15:49:56 +0800	[thread overview]
Message-ID: <BANLkTi=9OBXN0fMaPEvrEityAqM-L6yPBQ@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 7495 bytes --]

Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>

This patch allows you to play with 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 configuration file.
#spice
spice=1
spiceport=6000
spicehost='192.168.1.187'
spicedisable_ticketing = 0 # default is 0
spicepasswd = 'password'

apic=0 # disable acpi, but if you used the appended patch, set acpi=0

You may need to disable acpi(I'm not sure),
but if you want to disable acpi, you may need to set
apic = 0, (Yes, It is apic not acpi, pls don't ask me why, because I am also
confused with it).
If you feel uncomfortable by setting apic = 0, you can try an additional
patch appended,
then you can use acpi=0 in vm cfg file to give "no-acpi" argument to qemu.

For detailed:
http://code.google.com/p/spice4xen/wiki/Using_Upstream_Qemu

diff -r 3f00c5faa12a tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl    Wed Apr 13 16:10:26 2011 +0100
+++ b/tools/libxl/libxl.idl    Mon Apr 18 10:52:09 2011 +0800
@@ -153,6 +153,13 @@ libxl_device_model_info = Struct("device
     ("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 passwords never
expires"),
+    ("spiceagent_mouset",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 3f00c5faa12a tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Wed Apr 13 16:10:26 2011 +0100
+++ b/tools/libxl/libxl_dm.c    Mon Apr 18 10:52:09 2011 +0800
@@ -225,15 +225,44 @@ static char ** libxl__build_device_model

         if (strchr(listen, ':') != NULL)
             flexarray_append(dm_args,
-                    libxl__sprintf(gc, "%s%s", listen,
-                        info->vncunused ? ",to=99" : ""));
+                    libxl__sprintf(gc, "%s%s,%s", listen,
+                        info->vncunused ? ",to=99" : "", info->vncpasswd));
         else
             flexarray_append(dm_args,
-                    libxl__sprintf(gc, "%s:%d%s", listen, display,
-                        info->vncunused ? ",to=99" : ""));
+                    libxl__sprintf(gc, "%s:%d%s,%s", listen, display,
+                        info->vncunused ? ",to=99" : "", info->vncpasswd));
     }
     if (info->sdl) {
         flexarray_append(dm_args, "-sdl");
+    }
+    if (info->spice) {
+        char *spiceoptions = NULL;
+        if (!info->spiceport && !info->spicetls_port) {
+            assert(!"at least one of the spiceport or tls_port must be
provided");
+        }
+
+        if (!info->spicedisable_ticketing) {
+            if (!info->spicepasswd)
+                assert(!"spice ticketing is enabled but missing password");
+            else if (!info->spicepasswd[0])
+                assert(!"missing code for supplying spice password");
+        }
+        spiceoptions = libxl__sprintf(gc, "port=%d,tls-port=%d",
+                       info->spiceport, info->spicetls_port);
+        if (!info->spicehost)
+            spiceoptions = libxl__sprintf(gc,
+                    "%s,host=%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_mouset ? "on" :
"off");
+
+        flexarray_append(dm_args, "-spice");
+        flexarray_append(dm_args, spiceoptions);
+        printf("SPICE Options:\n  -spice %s\n", spiceoptions);
     }

     if (info->type == XENPV && !info->nographic) {
diff -r 3f00c5faa12a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c    Wed Apr 13 16:10:26 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c    Mon Apr 18 10:52:10 2011 +0800
@@ -1089,6 +1089,20 @@ skip_vfb:
             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_mouset = l;
+        else
+            dm_info->spiceagent_mouset = 1;
         if (!xlu_cfg_get_long (config, "nographic", &l))
             dm_info->nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l))


==============================Appended patch======================
Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>

tool/libxl: mistake apic for acpi in libxl__build_device_model_args_old/new
It may be advisedly coded for some reason, then it can be a mistake of my
understanding.

diff -r 6871474a2a09 -r 01f8b29dda8e tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Fri Apr 15 10:06:59 2011 +0800
+++ b/tools/libxl/libxl_dm.c    Fri Apr 15 15:17:42 2011 +0800
@@ -120,7 +120,7 @@ static char ** libxl__build_device_model
         if (info->soundhw) {
             flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
         }
-        if (info->apic) {
+        if (info->acpi) {
             flexarray_append(dm_args, "-acpi");
         }
         if (info->vcpus > 1) {
@@ -268,7 +268,7 @@ static char ** libxl__build_device_model
         if (info->soundhw) {
             flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
         }
-        if (!info->apic) {
+        if (!info->acpi) {
             flexarray_append(dm_args, "-no-acpi");
         }
         if (info->vcpus > 1) {


-- 
Zhou Peng
Operating System Technology Group
Institute of Software, the Chinese Academy of Sciences (ISCAS)
<ailvpeng25@gmail.com>

[-- Attachment #1.2: Type: text/html, Size: 9165 bytes --]

[-- Attachment #2: spice-upstreamXen-upstreamQemu.diff --]
[-- Type: text/x-patch, Size: 7289 bytes --]

Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>

This patch allows you to play with 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 configuration file.
#spice
spice=1
spiceport=6000
spicehost='192.168.1.187'
spicedisable_ticketing = 0 # default is 0
spicepasswd = 'password'

apic=0 # disable acpi, but if you used the appended patch, set acpi=0

You may need to disable acpi(I'm not sure),
but if you want to disable acpi, you may need to set
apic = 0, (Yes, It is apic not acpi, pls don't ask me why, because I am also confused with it).
If you feel uncomfortable by setting apic = 0, you can try an additional patch appended,
then you can use acpi=0 in vm cfg file to give "no-acpi" argument to qemu.

diff -r 3f00c5faa12a tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl	Wed Apr 13 16:10:26 2011 +0100
+++ b/tools/libxl/libxl.idl	Mon Apr 18 10:52:09 2011 +0800
@@ -153,6 +153,13 @@ libxl_device_model_info = Struct("device
     ("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 passwords never expires"),
+    ("spiceagent_mouset",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 3f00c5faa12a tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Wed Apr 13 16:10:26 2011 +0100
+++ b/tools/libxl/libxl_dm.c	Mon Apr 18 10:52:09 2011 +0800
@@ -225,15 +225,44 @@ static char ** libxl__build_device_model
 
         if (strchr(listen, ':') != NULL)
             flexarray_append(dm_args, 
-                    libxl__sprintf(gc, "%s%s", listen,
-                        info->vncunused ? ",to=99" : ""));
+                    libxl__sprintf(gc, "%s%s,%s", listen,
+                        info->vncunused ? ",to=99" : "", info->vncpasswd));
         else
             flexarray_append(dm_args, 
-                    libxl__sprintf(gc, "%s:%d%s", listen, display,
-                        info->vncunused ? ",to=99" : ""));
+                    libxl__sprintf(gc, "%s:%d%s,%s", listen, display,
+                        info->vncunused ? ",to=99" : "", info->vncpasswd));
     }
     if (info->sdl) {
         flexarray_append(dm_args, "-sdl");
+    }
+    if (info->spice) {
+        char *spiceoptions = NULL;
+        if (!info->spiceport && !info->spicetls_port) {
+            assert(!"at least one of the spiceport or tls_port must be provided"); 
+        }
+
+        if (!info->spicedisable_ticketing) {
+            if (!info->spicepasswd)
+                assert(!"spice ticketing is enabled but missing password");
+            else if (!info->spicepasswd[0])
+                assert(!"missing code for supplying spice password");
+        }
+        spiceoptions = libxl__sprintf(gc, "port=%d,tls-port=%d",
+                       info->spiceport, info->spicetls_port);
+        if (!info->spicehost)
+            spiceoptions = libxl__sprintf(gc,
+                    "%s,host=%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_mouset ? "on" : "off");
+
+        flexarray_append(dm_args, "-spice");
+        flexarray_append(dm_args, spiceoptions);
+        printf("SPICE Options:\n  -spice %s\n", spiceoptions);
     }
 
     if (info->type == XENPV && !info->nographic) {
diff -r 3f00c5faa12a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Apr 13 16:10:26 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Mon Apr 18 10:52:10 2011 +0800
@@ -1089,6 +1089,20 @@ skip_vfb:
             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_mouset = l;
+        else
+            dm_info->spiceagent_mouset = 1;
         if (!xlu_cfg_get_long (config, "nographic", &l))
             dm_info->nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l))


==============================Appended patch============================================
Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>

tool/libxl: mistake apic for acpi in libxl__build_device_model_args_old/new
It may be advisedly coded for some reason, then it can be a mistake of my understanding.

diff -r 6871474a2a09 -r 01f8b29dda8e tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Fri Apr 15 10:06:59 2011 +0800
+++ b/tools/libxl/libxl_dm.c	Fri Apr 15 15:17:42 2011 +0800
@@ -120,7 +120,7 @@ static char ** libxl__build_device_model
         if (info->soundhw) {
             flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
         }
-        if (info->apic) {
+        if (info->acpi) {
             flexarray_append(dm_args, "-acpi");
         }
         if (info->vcpus > 1) {
@@ -268,7 +268,7 @@ static char ** libxl__build_device_model
         if (info->soundhw) {
             flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
         }
-        if (!info->apic) {
+        if (!info->acpi) {
             flexarray_append(dm_args, "-no-acpi");
         }
         if (info->vcpus > 1) {


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

             reply	other threads:[~2011-04-18  7:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-18  7:49 ZhouPeng [this message]
2011-04-18 13:52 ` [PATCH] Play with spice for xen-upstream-qemu on upstream Xen Stefano Stabellini
2011-04-19  4:46   ` ZhouPeng
2011-04-20 12:33     ` Stefano Stabellini
2011-04-21  1:23       ` ZhouPeng
2011-04-18 16:24 ` Ian Jackson
2011-04-19  1:31   ` ZhouPeng
2011-05-20 15:16     ` Ian Jackson
2011-05-23 11:17       ` ZhouPeng
2011-05-24  3:29         ` ZhouPeng
2011-05-24 15:55           ` Ian Jackson
2011-05-25 14:12             ` ZhouPeng
2011-05-26 13:34               ` Ian Jackson
2011-05-26 13:36                 ` Ian Jackson
2011-05-26 14:07                   ` ZhouPeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTi=9OBXN0fMaPEvrEityAqM-L6yPBQ@mail.gmail.com' \
    --to=zpengxen@gmail.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).