ZhouPeng
2011-Apr-18 07:49 UTC
[Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
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> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stefano Stabellini
2011-Apr-18 13:52 UTC
[Xen-devel] Re: [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
On Mon, 18 Apr 2011, ZhouPeng wrote:> 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_QemuCool! Does it mean that it works right now?> 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));This is not actually part of the spice support patch to libxl, is it? It looks like a generic bug fix to the vncpasswd handling. Could you please send it as a separate patch?> } > 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"); > + }please return error here and let the caller handle the failure> + > + 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"); > + }same here: replace the asserts with return errors> + 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=====================thanks for the patches, next time could you please send the patches inline as plain text, each patch as a separate email? See this document on how to send patches to the LKML as a reference: http://www.mjmwired.net/kernel/Documentation/email-clients.txt> 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. >Thanks for the patch, I found the first version that you sent and reply to it now. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Apr-18 16:24 UTC
Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
ZhouPeng writes ("[Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen"):> 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.Thanks. There seems to be some unrelated code in here. For example:> - libxl__sprintf(gc, "%s%s", listen, > - info->vncunused ? ",to=99" : "")); > + libxl__sprintf(gc, "%s%s,%s", listen, > + info->vncunused ? ",to=99" : "", info->vncpasswd));and> - if (info->apic) { > + if (info->acpi) {Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
ZhouPeng
2011-Apr-19 01:31 UTC
Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
2011/4/19 Ian Jackson <Ian.Jackson@eu.citrix.com>> ZhouPeng writes ("[Xen-devel] [PATCH] Play with spice for xen-upstream-qemu > on upstream Xen"): > > 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. > > Thanks. There seems to be some unrelated code in here. For example: > > > - libxl__sprintf(gc, "%s%s", listen, > > - info->vncunused ? ",to=99" : "")); > > + libxl__sprintf(gc, "%s%s,%s", listen, > > + info->vncunused ? ",to=99" : "", > info->vncpasswd)); > > and > > > - if (info->apic) { > > + if (info->acpi) { >yes, it''s it''s unrelated. Thanks,> Ian. >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 16:12:16 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 16:12:16 2011 +0800 @@ -234,6 +234,35 @@ static char ** libxl__build_device_model } 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 16:12:16 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> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
ZhouPeng
2011-Apr-19 04:46 UTC
[Xen-devel] Re: [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
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 Tue Apr 19 12:31:19 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_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 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 Tue Apr 19 12:31:19 2011 +0800 @@ -234,6 +234,42 @@ static char ** libxl__build_device_model } 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,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_mouse ? "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 Tue Apr 19 12:31:19 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_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)) ==============================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) {> > For detailed: > > http://code.google.com/p/spice4xen/wiki/Using_Upstream_Qemu > > Cool! Does it mean that it works right now?Yes, it works right. now.> >> > - 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)); > > This is not actually part of the spice support patch to libxl, is it?No, it is not part of spice of libxl. It''s mess msg because of my negligence Thanks for your review, -- Zhou Peng Operating System Technology Group Institute of Software, the Chinese Academy of Sciences (ISCAS) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stefano Stabellini
2011-Apr-20 12:33 UTC
[Xen-devel] Re: [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
On Tue, 19 Apr 2011, ZhouPeng wrote:> 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. >The spice part of the patch looks OK to me. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
ZhouPeng
2011-Apr-21 01:23 UTC
[Xen-devel] Re: [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
Thanks. 2011/4/20 Stefano Stabellini <stefano.stabellini@eu.citrix.com>:>> > > The spice part of the patch looks OK to me. >-- Zhou Peng Operating System Technology Group Institute of Software, the Chinese Academy of Sciences (ISCAS) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-May-20 15:16 UTC
Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
ZhouPeng writes ("Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen"):> 2011/4/19 Ian Jackson <Ian.Jackson@eu.citrix.com> > > > - if (info->apic) { > > > + if (info->acpi) { > > > yes, it''s it''s unrelated.Can you please not put unrelated changes in patches ? If you resend it with only the spice parts (that Stefano has acked) I will apply it. Thanks, Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
ZhouPeng
2011-May-23 11:17 UTC
Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
> Can you please not put unrelated changes in patches ? If you resend > it with only the spice parts (that Stefano has acked) I will apply it.Resend the patch. thanks ----------------------- Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> 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 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 -------------------------------------------------------------------------- diff -r fb517cc27ade -r 14664ae4bfb7 tools/libxl/libxl.idl --- a/tools/libxl/libxl.idl Fri May 20 18:20:09 2011 +0100 +++ b/tools/libxl/libxl.idl Mon May 23 18:37:42 2011 +0800 @@ -210,6 +210,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_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 fb517cc27ade -r 14664ae4bfb7 tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Fri May 20 18:20:09 2011 +0100 +++ b/tools/libxl/libxl_dm.c Mon May 23 18:37:42 2011 +0800 @@ -281,6 +281,42 @@ static char ** libxl__build_device_model } 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,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_mouse ? "on" : "off"); + + flexarray_append(dm_args, "-spice"); + flexarray_append(dm_args, spiceoptions); + printf("SPICE Options:\n -spice %s\n", spiceoptions); } if (info->type == LIBXL_DOMAIN_TYPE_PV && !info->nographic) { diff -r fb517cc27ade -r 14664ae4bfb7 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Fri May 20 18:20:09 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Mon May 23 18:37:42 2011 +0800 @@ -367,6 +367,12 @@ static void printf_info(int domid, 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 +1130,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_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)) -- Zhou Peng Operating System Technology Group Institute of Software, the Chinese Academy of Sciences (ISCAS) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
ZhouPeng
2011-May-24 03:29 UTC
Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
2011/5/23 ZhouPeng <zpengxen@gmail.com>:>> Can you please not put unrelated changes in patches ? If you resend >> it with only the spice parts (that Stefano has acked) I will apply it. >Resend the patch again with 3 fixes: 1) Change ''if (!info->spicehost)'' to ''if (info->spicehost)'' , sorry for my carelessness 2) In the new spice, the spice option of spiced qemu is "addrhostaddr " not "host=hostaddr", according to the new qemu''s file qemu-options.hx 3) Delete ''printf("SPICE Options:\n -spice %s\n", spiceoptions);'' , which is not necessary. Testing this patch on xen-unstable, I think there is no problem now. Thanks ---------------- Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> 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 ------------------------------------------------------------------------------ diff -r fb517cc27ade -r 0e67672ea59e tools/libxl/libxl.idl --- a/tools/libxl/libxl.idl Fri May 20 18:20:09 2011 +0100 +++ b/tools/libxl/libxl.idl Tue May 24 10:45:17 2011 +0800 @@ -210,6 +210,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_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 fb517cc27ade -r 0e67672ea59e tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Fri May 20 18:20:09 2011 +0100 +++ b/tools/libxl/libxl_dm.c Tue May 24 10:45:17 2011 +0800 @@ -281,6 +281,41 @@ static char ** libxl__build_device_model } 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) { diff -r fb517cc27ade -r 0e67672ea59e tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Fri May 20 18:20:09 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Tue May 24 10:45:17 2011 +0800 @@ -367,6 +367,12 @@ static void printf_info(int domid, 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 +1130,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_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)) -- Zhou Peng Operating System Technology Group Institute of Software, the Chinese Academy of Sciences (ISCAS) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-May-24 15:55 UTC
Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
ZhouPeng writes ("Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen"):> Resend the patch again with 3 fixes:Thanks. I was just about to apply this when I noticed a couple of oddities: Your calls to LIBXL__LOG all have a string starting ": ", eg:> + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, > + ": at least one of the spiceport or tls_port must be provided");I don''t think that''s correct. LIBXL__LOG should add all necessary punctuation and I think if you run this it will produce output like: libxl: something: : at least one of the spiceport .... Did you add the ": " after testing ? If so then perhaps the existing logging functions are wrong. Secondly, your patch has a lot of rather long lines in new code. Can you please try to keep your lines down to 75 characters (or 80 if you absolutely must) ? Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
ZhouPeng
2011-May-25 14:12 UTC
Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
> I was just about to apply this when I noticed a couple of > oddities:Fixed in this patch.>> + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, >> + ": at least one of the spiceport or tls_port must be provided"); > > punctuation and I think if you run this it will produce output like: > libxl: something: : at least one of the spiceport .... > > Did you add the ": " after testing ? If so then perhaps the existing > logging functions are wrong.The output is like this, libxl: something : at least one of the spiceport .... It is void libxl__logv(...) libxl__logv xtl_log(ctx->lg, msglevel, errnoval, "libxl", "%s%s%s%s" "%s", fileline, func&&file?":":"", func?func:"", func||file?" ":"", // here output the msg. It use a space not '': '' between func name and log msg. So no bug But I feel the format like below is more clear void libxl__logv(...) libxl__logv xtl_log(ctx->lg, msglevel, errnoval, "libxl", "%s%s%s%s" "%s", fileline, func&&file?":":"", func?func:"", func||file?": ":"", // here If you reply to agree to use '': '' instead of '' '', I will send a little patch for this. Any way, I agree with you to trim the header '':'' like below ": at least one of the spiceport or tls_port must be provided" to "at least one of the spiceport or tls_port must be provided"> Secondly, your patch has a lot of rather long lines in new code. Can > you please try to keep your lines down to 75 characters (or 80 if you > absolutely must) ?Fixed in this patch. There are many lines up to 80 characters in libxl.idl and even in libxl_dm.c, that''s why I turn a blind eye to libxl.idl in my last patch. I think I will send a patch for libxl.idl to cut down lines to 80, after this patch applied. Thanks. ----- Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> 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 ------------------------------------------------------------------------------ diff -r fb517cc27ade -r a19b590873e6 tools/libxl/libxl.idl --- a/tools/libxl/libxl.idl Fri May 20 18:20:09 2011 +0100 +++ b/tools/libxl/libxl.idl Wed May 25 21:21:55 2011 +0800 @@ -210,6 +210,22 @@ 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 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 fb517cc27ade -r a19b590873e6 tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Fri May 20 18:20:09 2011 +0100 +++ b/tools/libxl/libxl_dm.c Wed May 25 21:21:55 2011 +0800 @@ -281,6 +281,43 @@ static char ** libxl__build_device_model } 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) { diff -r fb517cc27ade -r a19b590873e6 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Fri May 20 18:20:09 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Wed May 25 21:21:55 2011 +0800 @@ -367,6 +367,13 @@ static void printf_info(int domid, 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 @@ 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_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)) -- Zhou Peng Operating System Technology Group Institute of Software, the Chinese Academy of Sciences (ISCAS) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-May-26 13:34 UTC
Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
ZhouPeng writes ("Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen"):> [Ian Jackson:] > > Did you add the ": " after testing ? If so then perhaps the existing > > logging functions are wrong. > > The output is like this, > libxl: something : at least one of the spiceport ....That''s strange.> It is > void libxl__logv(...) > libxl__logv > xtl_log(ctx->lg, msglevel, errnoval, "libxl", > "%s%s%s%s" "%s", > fileline, func&&file?":":"", func?func:"", > func||file?" ":"", // hereYes, I think this is arguably wrong.> output the msg. > It use a space not '': '' between func name and log msg. > So no bug > But I feel the format like below is more clear > void libxl__logv(...) > libxl__logv > xtl_log(ctx->lg, msglevel, errnoval, "libxl", > "%s%s%s%s" "%s", > fileline, func&&file?":":"", func?func:"", > func||file?": ":"", // here > > If you reply to agree to use '': '' instead of '' '', > I will send a little patch for this.Yes, I agree. I will make this change myself as it''s just one character :-). Thanks for digging.> Any way, I agree with you to trim the header '':'' like below > ": at least one of the spiceport or tls_port must be provided" to > "at least one of the spiceport or tls_port must be provided"Right, that''s what I meant.> > Secondly, your patch has a lot of rather long lines in new code. Can > > you please try to keep your lines down to 75 characters (or 80 if you > > absolutely must) ? > > Fixed in this patch.Good, thanks.> There are many lines up to 80 characters in libxl.idl > and even in libxl_dm.c, that''s why I turn a blind eye > to libxl.idl in my last patch.Right, yes, that''s fine. Well it would be nicer if libxl.idl were narrower but I don''t propose to argue about that right now :-). I have applied your patch. Thanks for your contribution. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-May-26 13:36 UTC
Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
I wrote:> Yes, I agree. I will make this change myself as it''s just one > character :-). Thanks for digging.Ian. # HG changeset patch # User Ian Jackson <Ian.Jackson@eu.citrix.com> # Date 1306416939 -3600 # Node ID 240bdcce0ad2e0caa0fa9ee6448952239a219ab0 # Parent d8d24e8a81f8413eb25b14984f69d0e39e63eb3a libxl: add missing ":" in log messages libxl__logv would fail to put a ":" between the function name and the rest of the message. Reported-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com> diff -r d8d24e8a81f8 -r 240bdcce0ad2 tools/libxl/libxl_internal.c --- a/tools/libxl/libxl_internal.c Thu May 26 14:33:52 2011 +0100 +++ b/tools/libxl/libxl_internal.c Thu May 26 14:35:39 2011 +0100 @@ -168,7 +168,7 @@ void libxl__logv(libxl_ctx *ctx, xentool x: xtl_log(ctx->lg, msglevel, errnoval, "libxl", "%s%s%s%s" "%s", - fileline, func&&file?":":"", func?func:"", func||file?" ":"", + fileline, func&&file?":":"", func?func:"", func||file?": ":"", base); if (base != enomem) free(base); errno = esave; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
ZhouPeng
2011-May-26 14:07 UTC
Re: [Xen-devel] [PATCH] Play with spice for xen-upstream-qemu on upstream Xen
It''s fine. Thanks 2011/5/26 Ian Jackson <Ian.Jackson@eu.citrix.com>:> I wrote: >> Yes, I agree. I will make this change myself as it''s just one >> character :-). Thanks for digging. > > Ian. > > # HG changeset patch > # User Ian Jackson <Ian.Jackson@eu.citrix.com> > # Date 1306416939 -3600 > # Node ID 240bdcce0ad2e0caa0fa9ee6448952239a219ab0 > # Parent d8d24e8a81f8413eb25b14984f69d0e39e63eb3a > libxl: add missing ":" in log messages > > libxl__logv would fail to put a ":" between the function name and the > rest of the message. > > Reported-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn> > Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> > Committed-by: Ian Jackson <ian.jackson@eu.citrix.com> > > diff -r d8d24e8a81f8 -r 240bdcce0ad2 tools/libxl/libxl_internal.c > --- a/tools/libxl/libxl_internal.c Thu May 26 14:33:52 2011 +0100 > +++ b/tools/libxl/libxl_internal.c Thu May 26 14:35:39 2011 +0100 > @@ -168,7 +168,7 @@ void libxl__logv(libxl_ctx *ctx, xentool > x: > xtl_log(ctx->lg, msglevel, errnoval, "libxl", > "%s%s%s%s" "%s", > - fileline, func&&file?":":"", func?func:"", func||file?" ":"", > + fileline, func&&file?":":"", func?func:"", func||file?": ":"", > base); > if (base != enomem) free(base); > errno = esave; >-- Zhou Peng Operating System Technology Group Institute of Software, the Chinese Academy of Sciences (ISCAS) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel