This replicate a Xend behavior, when you specify: vnc=1 vnclisten=XXXX vncpasswd=XXXX in a PV guest''s config file, it creates a VFB for you. Fixes bug #25. http://bugs.xenproject.org/xen/bug/25 Signed-off-by: Wei Liu <wei.liu2@citrix.com> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Konrad Wilk <konrad.wilk@oracle.com> --- tools/libxl/xl_cmdimpl.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index bd26bcc..06c516c 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1357,11 +1357,12 @@ skip_nic: fprintf(stderr, "WARNING: vif2: netchannel2 is deprecated and not supported by xl\n"); } + d_config->num_vfbs = 0; + d_config->num_vkbs = 0; + d_config->vfbs = NULL; + d_config->vkbs = NULL; + if (!xlu_cfg_get_list (config, "vfb", &cvfbs, 0, 0)) { - d_config->num_vfbs = 0; - d_config->num_vkbs = 0; - d_config->vfbs = NULL; - d_config->vkbs = NULL; while ((buf = xlu_cfg_get_listitem (cvfbs, d_config->num_vfbs)) != NULL) { libxl_device_vfb *vfb; libxl_device_vkb *vkb; @@ -1608,6 +1609,39 @@ skip_vfb: #undef parse_extra_args + if (c_info->type == LIBXL_DOMAIN_TYPE_PV) { + libxl_defbool vnc_enabled; + + xlu_cfg_get_defbool(config, "vnc", &vnc_enabled, 0); + + if (libxl_defbool_val(vnc_enabled)) { + libxl_device_vfb *vfb; + libxl_device_vkb *vkb; + + d_config->vfbs = (libxl_device_vfb *) + realloc(d_config->vfbs, sizeof(libxl_device_vfb) * (d_config->num_vfbs + 1)); + vfb = d_config->vfbs + d_config->num_vfbs; + libxl_device_vfb_init(vfb); + vfb->devid = d_config->num_vfbs; + + d_config->vkbs = (libxl_device_vkb *) + realloc(d_config->vkbs, sizeof(libxl_device_vkb) * (d_config->num_vkbs + 1)); + vkb = d_config->vkbs + d_config->num_vkbs; + libxl_device_vkb_init(vkb); + vkb->devid = d_config->num_vkbs; + + libxl_defbool_set(&vfb->vnc.enable, true); + xlu_cfg_replace_string(config, "vnclisten", &vfb->vnc.listen, 0); + xlu_cfg_replace_string(config, "vncpasswd", &vfb->vnc.passwd, 0); + if (!xlu_cfg_get_long (config, "vncdisplay", &l, 0)) + vfb->vnc.display = l; + xlu_cfg_get_defbool(config, "vncunused", &vfb->vnc.findunused, 0); + + d_config->num_vfbs++; + d_config->num_vkbs++; + } + } + if (c_info->type == LIBXL_DOMAIN_TYPE_HVM) { if (!xlu_cfg_get_string (config, "vga", &buf, 0)) { if (!strcmp(buf, "stdvga")) { -- 1.7.10.4
Konrad Rzeszutek Wilk
2013-Dec-14 17:27 UTC
Re: [PATCH] xl: create VFB for PV guest when VNC is specified
On Fri, Dec 13, 2013 at 09:03:24PM +0000, Wei Liu wrote:> This replicate a Xend behavior, when you specify: > > vnc=1 > vnclisten=XXXX > vncpasswd=XXXX > > in a PV guest''s config file, it creates a VFB for you. > > Fixes bug #25. > http://bugs.xenproject.org/xen/bug/25 > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > Cc: Ian Campbell <ian.campbell@citrix.com> > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: Konrad Wilk <konrad.wilk@oracle.com>Reported-by: .. my name. Hadn''t tested it yet - I can do it on Tuesday if you are OK with it.> --- > tools/libxl/xl_cmdimpl.c | 42 ++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 38 insertions(+), 4 deletions(-) > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index bd26bcc..06c516c 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -1357,11 +1357,12 @@ skip_nic: > fprintf(stderr, "WARNING: vif2: netchannel2 is deprecated and not supported by xl\n"); > } > > + d_config->num_vfbs = 0; > + d_config->num_vkbs = 0; > + d_config->vfbs = NULL; > + d_config->vkbs = NULL; > + > if (!xlu_cfg_get_list (config, "vfb", &cvfbs, 0, 0)) { > - d_config->num_vfbs = 0; > - d_config->num_vkbs = 0; > - d_config->vfbs = NULL; > - d_config->vkbs = NULL; > while ((buf = xlu_cfg_get_listitem (cvfbs, d_config->num_vfbs)) != NULL) { > libxl_device_vfb *vfb; > libxl_device_vkb *vkb; > @@ -1608,6 +1609,39 @@ skip_vfb: > > #undef parse_extra_args > > + if (c_info->type == LIBXL_DOMAIN_TYPE_PV) { > + libxl_defbool vnc_enabled; > + > + xlu_cfg_get_defbool(config, "vnc", &vnc_enabled, 0); > + > + if (libxl_defbool_val(vnc_enabled)) { > + libxl_device_vfb *vfb; > + libxl_device_vkb *vkb; > + > + d_config->vfbs = (libxl_device_vfb *) > + realloc(d_config->vfbs, sizeof(libxl_device_vfb) * (d_config->num_vfbs + 1)); > + vfb = d_config->vfbs + d_config->num_vfbs; > + libxl_device_vfb_init(vfb); > + vfb->devid = d_config->num_vfbs; > + > + d_config->vkbs = (libxl_device_vkb *) > + realloc(d_config->vkbs, sizeof(libxl_device_vkb) * (d_config->num_vkbs + 1)); > + vkb = d_config->vkbs + d_config->num_vkbs; > + libxl_device_vkb_init(vkb); > + vkb->devid = d_config->num_vkbs; > + > + libxl_defbool_set(&vfb->vnc.enable, true); > + xlu_cfg_replace_string(config, "vnclisten", &vfb->vnc.listen, 0); > + xlu_cfg_replace_string(config, "vncpasswd", &vfb->vnc.passwd, 0); > + if (!xlu_cfg_get_long (config, "vncdisplay", &l, 0)) > + vfb->vnc.display = l; > + xlu_cfg_get_defbool(config, "vncunused", &vfb->vnc.findunused, 0); > + > + d_config->num_vfbs++; > + d_config->num_vkbs++; > + } > + } > + > if (c_info->type == LIBXL_DOMAIN_TYPE_HVM) { > if (!xlu_cfg_get_string (config, "vga", &buf, 0)) { > if (!strcmp(buf, "stdvga")) { > -- > 1.7.10.4 >
Wei Liu
2013-Dec-14 19:53 UTC
Re: [PATCH] xl: create VFB for PV guest when VNC is specified
On Sat, Dec 14, 2013 at 5:27 PM, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:> On Fri, Dec 13, 2013 at 09:03:24PM +0000, Wei Liu wrote: >> This replicate a Xend behavior, when you specify: >> >> vnc=1 >> vnclisten=XXXX >> vncpasswd=XXXX >> >> in a PV guest''s config file, it creates a VFB for you. >> >> Fixes bug #25. >> http://bugs.xenproject.org/xen/bug/25 >> >> Signed-off-by: Wei Liu <wei.liu2@citrix.com> >> Cc: Ian Campbell <ian.campbell@citrix.com> >> Cc: Ian Jackson <ian.jackson@eu.citrix.com> >> Cc: Konrad Wilk <konrad.wilk@oracle.com> > > Reported-by: .. my name. > > Hadn''t tested it yet - I can do it on Tuesday if you are OK with it.Yes, I''m fine with it. Take your time. Wei.