Add vncviewer xm compatibility options
PATCH 1/1 Add vncviewer xm compatibility options
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.
PATCH 1/1 Update xl man page to include vncviewer options
docs/man/xl.pod.1 +16 -0
@@ -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>]
Re: [PATCH 1 of 6] Update xl man page to include vncviewer options
Quoted 21 lines · Goncalo Gomes
Signed-off-by Goncalo Gomes <[email protected]>diff -r
0f53540494f7-r53f124f82cfddocs/man/xl.pod.1docs/man/xl.pod.1 +8
-0@@ -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
docs/man/xl.pod.1 See the corresponding option of the I<cr · line 450
Quoted 10 lines
docs/man/xl.pod.1 +7
-0@@ -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?
Quoted 4 lines
docs/man/xl.pod.1 +1
-0+ =back =item B<save> [I<OPTIONS>] I<domain-id> I<CheckpointFile> [I<ConfigFile>]
Re: [PATCH 1 of 6] Update xl man page to include vncviewer options
Quoted 25 lines · Ian Campbell
Quoted 24 lines · Goncalo Gomes
Signed-off-by Goncalo Gomes <[email protected]>diff -r
0f53540494f7-r53f124f82cfddocs/man/xl.pod.1docs/man/xl.pod.1 +8
-0@@ -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.
Quoted 9 lines
docs/man/xl.pod.1 See the corresponding option of the I<cr · line 450
Quoted 7 lines
docs/man/xl.pod.1 +7
-0+=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
Quoted 6 lines
Quoted 4 lines
docs/man/xl.pod.1 +1
-0+ =back =item B<save> [I<OPTIONS>] I<domain-id> I<CheckpointFile> [I<ConfigFile>]
PATCH 1/1 Update xl.cfg man page to introduce new config option
In reply to Goncalo Gomesdocs/man/xl.cfg.pod.5 +5 -0
@@ -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.
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"):
Quoted 6 lines
Signed-off-by Goncalo Gomes <[email protected]>diff -r
53f124f82cfd-r79526068a874docs/man/xl.cfg.pod.5
docs/man/xl.cfg.pod.5 frequency changes. · line 631
Quoted 8 lines
docs/man/xl.cfg.pod.5 +5
-0@@ -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. +
PATCH 1/1 libxl: add vncviewer boolean options
In reply to Goncalo Gomestools/libxl/libxl_create.c +1 -0
@@ -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);
tools/libxl/libxl_types.idl +1 -0
@@ -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),
Re: [PATCH 3 of 6] libxl: add vncviewer boolean options
Quoted 17 lines · Goncalo Gomes
Signed-off-by Goncalo Gomes <[email protected]>diff -r
79526068a874-r497a6061df08tools/libxl/libxl_create.ctools/libxl/libxl_create.c +1
-0@@ -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-r497a6061df08tools/libxl/libxl_types.idl
tools/libxl/libxl_types.idl libxl_domain_build_info = Struct("domain · line 253
Quoted 4 lines
tools/libxl/libxl_types.idl +1
-0@@ -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.
PATCH 1/1 xl: move vncviewer function closer to the start of file so it can be seen by create_domain
In reply to Goncalo Gomestools/libxl/xl_cmdimpl.c +8 -8
@@ -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[] = {
Re: [PATCH 4 of 6] xl: move vncviewer function closer to the start of file so it can be seen by create_domain
Quoted 1 line · Goncalo Gomes
Signed-off-by Goncalo Gomes <[email protected]>
Quoted 34 lines
diff -r
497a6061df08-r0663afbb57f5tools/libxl/xl_cmdimpl.ctools/libxl/xl_cmdimpl.c +8
-8@@ -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[] = {
PATCH 1/1 xl: Add vncviewer options to create and restore
In reply to Goncalo Gomestools/libxl/xl_cmdimpl.c +35 -4
@@ -736,6 +736,7 @@ static void parse_config_data(const charif (!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_cint 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 ;
Re: [PATCH 5 of 6] xl: Add vncviewer options to create and restore
tools/libxl/xl_cmdimpl.c start: · line 1742
Quoted 5 lines · Goncalo Gomes
tools/libxl/xl_cmdimpl.c +1
-0@@ -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.
tools/libxl/xl_cmdimpl.c start: · line 1743
Quoted 1 line
tools/libxl/xl_cmdimpl.c +1
-0+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.
tools/libxl/xl_cmdimpl.c start: · line 1752
Quoted 9 lines
tools/libxl/xl_cmdimpl.c +6
-0+if (domspec) { +vncviewer (domspec, vncautopass); +free (domsec); + } + } +if (need_daemon) {char *fullname, *name;pid_t child1, got_child;
Ian.
PATCH 1/1 xl: extend the help options of the create and restore commands
In reply to Goncalo Gomestools/libxl/xl_cmdtable.c +7 -2
@@ -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,
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."
tools/libxl/xl_cmdtable.c struct cmd_spec cmd_table[] = { · line 36
Quoted 4 lines
tools/libxl/xl_cmdtable.c +4
-0+"-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."
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.
Quoted 2 lines · Goncalo Gomes
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.