[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2 of 2 v2] Introduce vncviewer xm compatibility options
On Tue, 15 May 2012, Ian Campbell wrote: > On Tue, 2012-05-15 at 03:39 +0100, Goncalo Gomes wrote: > > docs/man/xl.cfg.pod.5 | 4 ++ > > docs/man/xl.pod.1 | 18 +++++++++++ > > tools/libxl/xl_cmdimpl.c | 73 > > ++++++++++++++++++++++++++++++++++++++-------- > > tools/libxl/xl_cmdtable.c | 15 ++++++--- > > 4 files changed, 92 insertions(+), 18 deletions(-) > > > > > > Signed-off-by: Goncalo Gomes <Goncalo.Gomes@xxxxxxxxxxxxx> > > Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx> > > Thanks! I fixed up a context reject in xl_cmdtable.c, relating to the > addition of the "modifies" flag, please do check I did the right thing. > > Also I stripped some trailing whitespace. Thanks for stripping the whitespace/fixing the reject in xl_cmdtable.c. Looks fine to me! Goncalo > > > > diff -r 380d5f86dfdd -r d1c195e989cc docs/man/xl.cfg.pod.5 > > --- a/docs/man/xl.cfg.pod.5 Tue May 15 02:26:51 2012 +0000 > > +++ b/docs/man/xl.cfg.pod.5 Tue May 15 02:26:53 2012 +0000 > > @@ -91,6 +91,10 @@ The following options apply to guests of > > Specifies the UUID of the domain. If not specified, a fresh unique > > UUID will be generated. > > > > +=item B<vncviewer=BOOLEAN> > > + > > +Automatically spawn a vncviewer when creating/restoring a guest > > + > > =item B<pool="CPUPOOLNAME"> > > > > Put the guest's vcpus into the named cpu pool. > > diff -r 380d5f86dfdd -r d1c195e989cc docs/man/xl.pod.1 > > --- a/docs/man/xl.pod.1 Tue May 15 02:26:51 2012 +0000 > > +++ b/docs/man/xl.pod.1 Tue May 15 02:26:53 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,16 @@ See the corresponding option of the I<cr > > > > Enable debug messages. > > > > +=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. > > + > > + > > + > > =back > > > > =item B<save> [I<OPTIONS>] I<domain-id> I<CheckpointFile> [I<ConfigFile>] > > diff -r 380d5f86dfdd -r d1c195e989cc tools/libxl/xl_cmdimpl.c > > --- a/tools/libxl/xl_cmdimpl.c Tue May 15 02:26:51 2012 +0000 > > +++ b/tools/libxl/xl_cmdimpl.c Tue May 15 02:26:53 2012 +0000 > > @@ -127,6 +127,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 */ > > @@ -204,9 +206,8 @@ 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) > > +static int vncviewer(uint32_t domid, int autopass) > > { > > - find_domain(domain_spec); > > libxl_vncviewer_exec(ctx, domid, autopass); > > fprintf(stderr, "Unable to execute vncviewer\n"); > > return 1; > > @@ -549,7 +550,9 @@ vcpp_out: > > static void parse_config_data(const char *configfile_filename_report, > > const char *configfile_data, > > int configfile_len, > > - libxl_domain_config *d_config) > > + libxl_domain_config *d_config, > > + struct domain_create *dom_info) > > + > > { > > const char *buf; > > long l; > > @@ -754,6 +757,13 @@ static void parse_config_data(const char > > if (!xlu_cfg_get_long(config, "rtc_timeoffset", &l, 0)) > > b_info->rtc_timeoffset = l; > > > > + if (dom_info && !xlu_cfg_get_long(config, "vncviewer", &l, 0)) { > > + /* Command line arguments must take precedence over what's > > + * specified in the configuration file. */ > > + if (!dom_info->vnc) > > + dom_info->vnc = l; > > + } > > + > > xlu_cfg_get_defbool(config, "localtime", &b_info->localtime, 0); > > > > if (!xlu_cfg_get_long (config, "videoram", &l, 0)) > > @@ -1531,6 +1541,7 @@ static int create_domain(struct domain_c > > int daemonize = dom_info->daemonize; > > int monitor = dom_info->monitor; > > int paused = dom_info->paused; > > + 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; > > @@ -1654,7 +1665,7 @@ static int create_domain(struct domain_c > > if (!dom_info->quiet) > > printf("Parsing config file %s\n", config_file); > > > > - parse_config_data(config_file, config_data, config_len, &d_config); > > + parse_config_data(config_file, config_data, config_len, &d_config, > > dom_info); > > > > if (migrate_fd >= 0) { > > if (d_config.c_info.name) { > > @@ -1741,6 +1752,9 @@ start: > > if (!daemonize && !monitor) > > goto out; > > > > + if (dom_info->vnc) > > + vncviewer(domid, vncautopass); > > + > > if (need_daemon) { > > char *fullname, *name; > > pid_t child1, got_child; > > @@ -1867,7 +1881,7 @@ start: > > libxl_domain_config_dispose(&d_config); > > libxl_domain_config_init(&d_config); > > parse_config_data(config_file, config_data, config_len, > > - &d_config); > > + &d_config, dom_info); > > > > /* > > * XXX FIXME: If this sleep is not there then domain > > @@ -2218,7 +2232,9 @@ int main_vncviewer(int argc, char **argv > > return 2; > > } > > > > - if (vncviewer(argv[optind], autopass)) > > + find_domain(argv[optind]); > > + > > + if (vncviewer(domid, autopass)) > > return 1; > > return 0; > > } > > @@ -2493,7 +2509,7 @@ static void list_domains_details(const l > > continue; > > CHK_ERRNO(asprintf(&config_file, "<domid %d data>", > > info[i].domid)); > > libxl_domain_config_init(&d_config); > > - parse_config_data(config_file, (char *)data, len, &d_config); > > + parse_config_data(config_file, (char *)data, len, &d_config, NULL); > > printf_info(default_output_format, info[i].domid, &d_config); > > libxl_domain_config_dispose(&d_config); > > free(data); > > @@ -3043,13 +3059,26 @@ 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) { > > + int option_index = 0; > > + static struct option long_options[] = { > > + {"vncviewer", 0, 0, 'V'}, > > + {"vncviewer-autopass", 0, 0, 'A'}, > > + {0, 0, 0, 0} > > + }; > > + > > + while (1) { > > + opt = getopt_long(argc, argv, "FhcpdeVA", long_options, > > &option_index); > > + if (opt == -1) > > + break; > > + > > switch (opt) { > > case 0: case 2: > > return opt; > > + case 'h': > > + help("restore"); > > + return 2; > > case 'c': > > console_autoconnect = 1; > > break; > > @@ -3066,6 +3095,12 @@ int main_restore(int argc, char **argv) > > daemonize = 0; > > monitor = 0; > > break; > > + case 'V': > > + vnc = 1; > > + break; > > + case 'A': > > + vnc = vncautopass = 1; > > + break; > > } > > } > > > > @@ -3087,6 +3122,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; > > > > @@ -3394,7 +3431,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[] = { > > @@ -3402,6 +3439,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} > > }; > > > > @@ -3411,7 +3450,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; > > > > @@ -3444,6 +3483,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; > > @@ -3473,6 +3518,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; > > > > @@ -3575,7 +3622,7 @@ int main_config_update(int argc, char ** > > > > libxl_domain_config_init(&d_config); > > > > - parse_config_data(filename, config_data, config_len, &d_config); > > + parse_config_data(filename, config_data, config_len, &d_config, NULL); > > > > if (debug || dryrun_only) > > printf_info(default_output_format, -1, &d_config); > > diff -r 380d5f86dfdd -r d1c195e989cc tools/libxl/xl_cmdtable.c > > --- a/tools/libxl/xl_cmdtable.c Tue May 15 02:26:51 2012 +0000 > > +++ b/tools/libxl/xl_cmdtable.c Tue May 15 02:26:53 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, > > @@ -144,10 +147,12 @@ struct cmd_spec cmd_table[] = { > > &main_restore, 0, > > "Restore a domain from a saved state", > > "[options] [<ConfigFile>] <CheckpointFile>", > > - "-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." > > + "-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.\n" > > + "-V, --vncviewer Connect to the VNC display after the > > domain is created.\n" > > + "-A, --vncviewer-autopass Pass VNC password to viewer via stdin." > > }, > > { "migrate-receive", > > &main_migrate_receive, 0, > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |