The following series of patches introduce vncviewer compatibility options to the create and restore commands. It also introduces a boolean vncviewer keyword in configuration files. Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM>
Goncalo Gomes
2012-May-07 01:20 UTC
[PATCH 1 of 6] Update xl man page to include vncviewer options
Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM> diff -r 0f53540494f7 -r 53f124f82cfd docs/man/xl.pod.1 --- a/docs/man/xl.pod.1 Fri May 04 11:18:48 2012 +0100 +++ b/docs/man/xl.pod.1 Mon May 07 01:10:57 2012 +0000 @@ -120,6 +120,14 @@ Use the given configuration file. Leave the domain paused after it is created. +=item B<-V>, B<--vncviewer> + +Attach to domain''s VNC server, forking a vncviewer process. + +=item B<-A>, B<--vncviewer-autopass> + +Pass VNC password to vncviewer via stdin. + =item B<-c> Attach console to the domain as soon as it has started. This is @@ -433,6 +441,14 @@ See the corresponding option of the I<cr Enable debug messages. +=item B<-V> + +Attach to domain''s VNC server, forking a vncviewer process. + +=item B<-A> + +Pass VNC password to vncviewer via stdin. + =back =item B<save> [I<OPTIONS>] I<domain-id> I<CheckpointFile> [I<ConfigFile>]
Goncalo Gomes
2012-May-07 01:20 UTC
[PATCH 2 of 6] Update xl.cfg man page to introduce new config option
Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM> diff -r 53f124f82cfd -r 79526068a874 docs/man/xl.cfg.pod.5 --- a/docs/man/xl.cfg.pod.5 Mon May 07 01:10:57 2012 +0000 +++ b/docs/man/xl.cfg.pod.5 Mon May 07 01:10:58 2012 +0000 @@ -624,6 +624,11 @@ frequency changes. Please see F<docs/misc/tscmode.txt> for more information on this option. +=item B<vncviewer=BOOLEAN> + +Automatically attach to domain''s VNC server forking a vncviewer process +on domain creation and/or restore. + =item B<localtime=BOOLEAN> Set the real time clock to local time or to UTC. 0 by default, i.e. set to UTC.
Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM> diff -r 79526068a874 -r 497a6061df08 tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Mon May 07 01:10:58 2012 +0000 +++ b/tools/libxl/libxl_create.c Mon May 07 01:10:58 2012 +0000 @@ -156,6 +156,7 @@ int libxl__domain_build_info_setdefault( if (b_info->target_memkb == LIBXL_MEMKB_DEFAULT) b_info->target_memkb = b_info->max_memkb; + libxl_defbool_setdefault(&b_info->vncviewer, false); libxl_defbool_setdefault(&b_info->localtime, false); libxl_defbool_setdefault(&b_info->disable_migrate, false); diff -r 79526068a874 -r 497a6061df08 tools/libxl/libxl_types.idl --- a/tools/libxl/libxl_types.idl Mon May 07 01:10:58 2012 +0000 +++ b/tools/libxl/libxl_types.idl Mon May 07 01:10:58 2012 +0000 @@ -250,6 +250,7 @@ libxl_domain_build_info = Struct("domain ("video_memkb", MemKB), ("shadow_memkb", MemKB), ("rtc_timeoffset", uint32), + ("vncviewer", libxl_defbool), ("localtime", libxl_defbool), ("disable_migrate", libxl_defbool), ("cpuid", libxl_cpuid_policy_list),
Goncalo Gomes
2012-May-07 01:20 UTC
[PATCH 4 of 6] xl: move vncviewer function closer to the start of file so it can be seen by create_domain
Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM> diff -r 497a6061df08 -r 0663afbb57f5 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Mon May 07 01:10:58 2012 +0000 +++ b/tools/libxl/xl_cmdimpl.c Mon May 07 01:10:58 2012 +0000 @@ -186,6 +186,14 @@ static void find_domain(const char *p) common_domname = was_name ? p : libxl_domid_to_name(ctx, domid); } +static int vncviewer(const char *domain_spec, int autopass) +{ + find_domain(domain_spec); + libxl_vncviewer_exec(ctx, domid, autopass); + fprintf(stderr, "Unable to execute vncviewer\n"); + return 1; +} + static int acquire_lock(void) { int rc; @@ -2170,14 +2178,6 @@ int main_console(int argc, char **argv) return 1; } -static int vncviewer(const char *domain_spec, int autopass) -{ - find_domain(domain_spec); - libxl_vncviewer_exec(ctx, domid, autopass); - fprintf(stderr, "Unable to execute vncviewer\n"); - return 1; -} - int main_vncviewer(int argc, char **argv) { static const struct option long_options[] = {
Goncalo Gomes
2012-May-07 01:20 UTC
[PATCH 5 of 6] xl: Add vncviewer options to create and restore
Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM> diff -r 0663afbb57f5 -r ed41714d9ce9 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Mon May 07 01:10:58 2012 +0000 +++ b/tools/libxl/xl_cmdimpl.c Mon May 07 01:10:58 2012 +0000 @@ -736,6 +736,7 @@ static void parse_config_data(const char if (!xlu_cfg_get_long(config, "rtc_timeoffset", &l, 0)) b_info->rtc_timeoffset = l; + xlu_cfg_get_defbool(config, "vncviewer", &b_info->vncviewer, 0); xlu_cfg_get_defbool(config, "localtime", &b_info->localtime, 0); if (!xlu_cfg_get_long (config, "videoram", &l, 0)) @@ -1414,6 +1415,8 @@ struct domain_create { int paused; int dryrun; int quiet; + int vnc; + int vncautopass; int console_autoconnect; const char *config_file; const char *extra_config; /* extra config string */ @@ -1527,6 +1530,8 @@ static int create_domain(struct domain_c int daemonize = dom_info->daemonize; int monitor = dom_info->monitor; int paused = dom_info->paused; + int vnc = dom_info->vnc; + int vncautopass = dom_info->vncautopass; const char *config_file = dom_info->config_file; const char *extra_config = dom_info->extra_config; const char *restore_file = dom_info->restore_file; @@ -1734,6 +1739,14 @@ start: if (!daemonize && !monitor) goto out; + if (vnc || (libxl_defbool_val(d_config.b_info.vncviewer) == 1)) { + char *domspec = libxl_domid_to_name(ctx, domid); + if (domspec) { + vncviewer(domspec, vncautopass); + free(domsec); + } + } + if (need_daemon) { char *fullname, *name; pid_t child1, got_child; @@ -3033,10 +3046,10 @@ int main_restore(int argc, char **argv) const char *config_file = NULL; struct domain_create dom_info; int paused = 0, debug = 0, daemonize = 1, monitor = 1, - console_autoconnect = 0; + console_autoconnect = 0, vnc = 0, vncautopass = 0; int opt, rc; - while ((opt = def_getopt(argc, argv, "Fcpde", "restore", 1)) != -1) { + while ((opt = def_getopt(argc, argv, "FcpdeVA", "restore", 1)) != -1) { switch (opt) { case 0: case 2: return opt; @@ -3056,6 +3069,12 @@ int main_restore(int argc, char **argv) daemonize = 0; monitor = 0; break; + case ''V'': + vnc = 1; + break; + case ''A'': + vnc = vncautopass = 1; + break; } } @@ -3077,6 +3096,8 @@ int main_restore(int argc, char **argv) dom_info.config_file = config_file; dom_info.restore_file = checkpoint_file; dom_info.migrate_fd = -1; + dom_info.vnc = vnc; + dom_info.vncautopass = vncautopass; dom_info.console_autoconnect = console_autoconnect; dom_info.incr_generationid = 1; @@ -3384,7 +3405,7 @@ int main_create(int argc, char **argv) char extra_config[1024]; struct domain_create dom_info; int paused = 0, debug = 0, daemonize = 1, console_autoconnect = 0, - quiet = 0, monitor = 1; + quiet = 0, monitor = 1, vnc = 0, vncautopass = 0; int opt, rc; int option_index = 0; static struct option long_options[] = { @@ -3392,6 +3413,8 @@ int main_create(int argc, char **argv) {"quiet", 0, 0, ''q''}, {"help", 0, 0, ''h''}, {"defconfig", 1, 0, ''f''}, + {"vncviewer", 0, 0, ''V''}, + {"vncviewer-autopass", 0, 0, ''A''}, {0, 0, 0, 0} }; @@ -3401,7 +3424,7 @@ int main_create(int argc, char **argv) } while (1) { - opt = getopt_long(argc, argv, "Fhnqf:pcde", long_options, &option_index); + opt = getopt_long(argc, argv, "Fhnqf:pcdeVA", long_options, &option_index); if (opt == -1) break; @@ -3434,6 +3457,12 @@ int main_create(int argc, char **argv) case ''q'': quiet = 1; break; + case ''V'': + vnc = 1; + break; + case ''A'': + vnc = vncautopass = 1; + break; default: fprintf(stderr, "option `%c'' not supported.\n", optopt); break; @@ -3463,6 +3492,8 @@ int main_create(int argc, char **argv) dom_info.config_file = filename; dom_info.extra_config = extra_config; dom_info.migrate_fd = -1; + dom_info.vnc = vnc; + dom_info.vncautopass = vncautopass; dom_info.console_autoconnect = console_autoconnect; dom_info.incr_generationid = 0;
Goncalo Gomes
2012-May-07 01:20 UTC
[PATCH 6 of 6] xl: extend the help options of the create and restore commands
Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM> diff -r ed41714d9ce9 -r c2ed845386be tools/libxl/xl_cmdtable.c --- a/tools/libxl/xl_cmdtable.c Mon May 07 01:10:58 2012 +0000 +++ b/tools/libxl/xl_cmdtable.c Mon May 07 01:10:58 2012 +0000 @@ -30,7 +30,10 @@ struct cmd_spec cmd_table[] = { "-n, --dryrun Dry run - prints the resulting configuration\n" " (deprecated in favour of global -N option).\n" "-d Enable debug messages.\n" - "-e Do not wait in the background for the death of the domain." + "-e Do not wait in the background for the death of the domain.\n" + "-V, --vncviewer Connect to the VNC display after the domain is created.\n" + "-A, --vncviewer-autopass\n" + " Pass VNC password to viewer via stdin." }, { "config-update", &main_config_update, 1, @@ -147,7 +150,9 @@ struct cmd_spec cmd_table[] = { "-h Print this help.\n" "-p Do not unpause domain after restoring it.\n" "-e Do not wait in the background for the death of the domain.\n" - "-d Enable debug messages." + "-d Enable debug messages.\n" + "-V Connect to the VNC display after the domain is created.\n" + "-A Pass VNC password to viewer via stdin." }, { "migrate-receive", &main_migrate_receive, 0,
Ian Campbell
2012-May-08 09:58 UTC
Re: [PATCH 1 of 6] Update xl man page to include vncviewer options
On Mon, 2012-05-07 at 02:20 +0100, Goncalo Gomes wrote:> Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM> > > diff -r 0f53540494f7 -r 53f124f82cfd docs/man/xl.pod.1 > --- a/docs/man/xl.pod.1 Fri May 04 11:18:48 2012 +0100 > +++ b/docs/man/xl.pod.1 Mon May 07 01:10:57 2012 +0000 > @@ -120,6 +120,14 @@ Use the given configuration file. > > Leave the domain paused after it is created. > > +=item B<-V>, B<--vncviewer> > + > +Attach to domain''s VNC server, forking a vncviewer process. > + > +=item B<-A>, B<--vncviewer-autopass> > + > +Pass VNC password to vncviewer via stdin. > + > =item B<-c> > > Attach console to the domain as soon as it has started. This is > @@ -433,6 +441,14 @@ See the corresponding option of the I<cr > > Enable debug messages. > > +=item B<-V> > + > +Attach to domain''s VNC server, forking a vncviewer process. > + > +=item B<-A> > + > +Pass VNC password to vncviewer via stdin.No long form for these two?> + > =back > > =item B<save> [I<OPTIONS>] I<domain-id> I<CheckpointFile> [I<ConfigFile>]
Ian Campbell
2012-May-08 10:00 UTC
Re: [PATCH 3 of 6] libxl: add vncviewer boolean options
On Mon, 2012-05-07 at 02:20 +0100, Goncalo Gomes wrote:> Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM> > > diff -r 79526068a874 -r 497a6061df08 tools/libxl/libxl_create.c > --- a/tools/libxl/libxl_create.c Mon May 07 01:10:58 2012 +0000 > +++ b/tools/libxl/libxl_create.c Mon May 07 01:10:58 2012 +0000 > @@ -156,6 +156,7 @@ int libxl__domain_build_info_setdefault( > if (b_info->target_memkb == LIBXL_MEMKB_DEFAULT) > b_info->target_memkb = b_info->max_memkb; > > + libxl_defbool_setdefault(&b_info->vncviewer, false); > libxl_defbool_setdefault(&b_info->localtime, false); > > libxl_defbool_setdefault(&b_info->disable_migrate, false); > diff -r 79526068a874 -r 497a6061df08 tools/libxl/libxl_types.idl > --- a/tools/libxl/libxl_types.idl Mon May 07 01:10:58 2012 +0000 > +++ b/tools/libxl/libxl_types.idl Mon May 07 01:10:58 2012 +0000 > @@ -250,6 +250,7 @@ libxl_domain_build_info = Struct("domain > ("video_memkb", MemKB), > ("shadow_memkb", MemKB), > ("rtc_timeoffset", uint32), > + ("vncviewer", libxl_defbool),libxl never does anything with this, other that set the default as above. Does this value need to be in the libxl API, could it not be entirely an xl thing, as part of the struct domain_create? Ian.
Ian Campbell
2012-May-08 10:00 UTC
Re: [PATCH 4 of 6] xl: move vncviewer function closer to the start of file so it can be seen by create_domain
On Mon, 2012-05-07 at 02:20 +0100, Goncalo Gomes wrote:> Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM>Acked-by: Ian Campbell <ian.campbell@citrix.com>> > diff -r 497a6061df08 -r 0663afbb57f5 tools/libxl/xl_cmdimpl.c > --- a/tools/libxl/xl_cmdimpl.c Mon May 07 01:10:58 2012 +0000 > +++ b/tools/libxl/xl_cmdimpl.c Mon May 07 01:10:58 2012 +0000 > @@ -186,6 +186,14 @@ static void find_domain(const char *p) > common_domname = was_name ? p : libxl_domid_to_name(ctx, domid); > } > > +static int vncviewer(const char *domain_spec, int autopass) > +{ > + find_domain(domain_spec); > + libxl_vncviewer_exec(ctx, domid, autopass); > + fprintf(stderr, "Unable to execute vncviewer\n"); > + return 1; > +} > + > static int acquire_lock(void) > { > int rc; > @@ -2170,14 +2178,6 @@ int main_console(int argc, char **argv) > return 1; > } > > -static int vncviewer(const char *domain_spec, int autopass) > -{ > - find_domain(domain_spec); > - libxl_vncviewer_exec(ctx, domid, autopass); > - fprintf(stderr, "Unable to execute vncviewer\n"); > - return 1; > -} > - > int main_vncviewer(int argc, char **argv) > { > static const struct option long_options[] = {
Ian Campbell
2012-May-08 10:04 UTC
Re: [PATCH 5 of 6] xl: Add vncviewer options to create and restore
On Mon, 2012-05-07 at 02:20 +0100, Goncalo Gomes wrote:> @@ -1734,6 +1739,14 @@ start: > if (!daemonize && !monitor) > goto out; > > + if (vnc || (libxl_defbool_val(d_config.b_info.vncviewer) == 1)) {I think this can be just "if (vnc)", per my previous comment about including this in the libxl API.> + char *domspec = libxl_domid_to_name(ctx, domid);Error out if this fails? But... vncviewer will immediately call "find_domain(domain_spec)" to turn this back into a domid. I think you''d be better to make that function take a domid and pull the find_domain call up into main_vncviewer.> + if (domspec) { > + vncviewer(domspec, vncautopass); > + free(domsec); > + } > + } > + > if (need_daemon) { > char *fullname, *name; > pid_t child1, got_child;Ian.
Goncalo Gomes
2012-May-08 10:13 UTC
Re: [PATCH 1 of 6] Update xl man page to include vncviewer options
On Tue, 08 May 2012, Ian Campbell wrote:> On Mon, 2012-05-07 at 02:20 +0100, Goncalo Gomes wrote: > > Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM> > > > > diff -r 0f53540494f7 -r 53f124f82cfd docs/man/xl.pod.1 > > --- a/docs/man/xl.pod.1 Fri May 04 11:18:48 2012 +0100 > > +++ b/docs/man/xl.pod.1 Mon May 07 01:10:57 2012 +0000 > > @@ -120,6 +120,14 @@ Use the given configuration file. > > > > Leave the domain paused after it is created. > > > > +=item B<-V>, B<--vncviewer> > > + > > +Attach to domain''s VNC server, forking a vncviewer process. > > + > > +=item B<-A>, B<--vncviewer-autopass> > > + > > +Pass VNC password to vncviewer via stdin. > > + > > =item B<-c> > > > > Attach console to the domain as soon as it has started. This is > > @@ -433,6 +441,14 @@ See the corresponding option of the I<cr > > > > Enable debug messages. > > > > +=item B<-V> > > + > > +Attach to domain''s VNC server, forking a vncviewer process. > > + > > +=item B<-A> > > + > > +Pass VNC password to vncviewer via stdin. > > No long form for these two?It was deliberate as (1) `xm restore` doesn''t originally have these options and (2) `xl restore` only supports short options. I''m happy to add long options and will include them in my follow up patch. Thanks, Goncalo> > + > > =back > > > > =item B<save> [I<OPTIONS>] I<domain-id> I<CheckpointFile> [I<ConfigFile>] > >
Ian Campbell
2012-May-08 10:30 UTC
Re: [PATCH 0 of 6] Add vncviewer xm compatibility options
On Mon, 2012-05-07 at 02:20 +0100, Goncalo Gomes wrote:> The following series of patches introduce vncviewer compatibility > options to the create and restore commands.I have a look through and it generally looks good, I made some comments on specific patches as I went. One overall comment is that, while we generally prefer that a series is broken down into "one feature per patch", I think you''ve gone a little too far here. The docs updates, parser updates and the implementation can all reasonably come together in the same patch. The only thing which could be separate is "[...4 of 6] xl: move vncviewer function closer to the start of file so it can be seen by create_domain" which it would be useful to have as an early patch in the series (since splitting pure code motion out is always useful). Cheers, Ian.
Ian Jackson
2012-May-10 15:47 UTC
Re: [PATCH 2 of 6] Update xl.cfg man page to introduce new config option
Goncalo Gomes writes ("[Xen-devel] [PATCH 2 of 6] Update xl.cfg man page to introduce new config option"):> Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM> > > diff -r 53f124f82cfd -r 79526068a874 docs/man/xl.cfg.pod.5 > --- a/docs/man/xl.cfg.pod.5 Mon May 07 01:10:57 2012 +0000 > +++ b/docs/man/xl.cfg.pod.5 Mon May 07 01:10:58 2012 +0000 > @@ -624,6 +624,11 @@ frequency changes. > > Please see F<docs/misc/tscmode.txt> for more information on this option. > > +=item B<vncviewer=BOOLEAN> > + > +Automatically attach to domain''s VNC server forking a vncviewer process > +on domain creation and/or restore. > +Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson
2012-May-10 15:48 UTC
Re: [PATCH 6 of 6] xl: extend the help options of the create and restore commands
Goncalo Gomes writes ("[Xen-devel] [PATCH 6 of 6] xl: extend the help options of the create and restore commands"): the domain."> + "-e Do not wait in the background for the death of the domain.\n" > + "-V, --vncviewer Connect to the VNC display after the domain is created.\n" > + "-A, --vncviewer-autopass\n" > + " Pass VNC password to viewer via stdin."Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> However I think ideally this and the previous patch I have just acked (the corresponding documentation) should be in the same patch as the implementation. So when you resend can you combine them ? Thanks, Ian.