tools changes
v20210209 cover tools changes
As discussed in the v20210111 thread, split out and redo a few xl and configure.ac specific changes.
Olaf
Olaf Hering (4):
tools: move CONFIG_DIR and XEN_CONFIG_DIR in paths.m4
tools: add with-xen-scriptdir configure option
xl: optionally print timestamps when running xl commands
xl: disable --debug option for xl migrate
docs/man/xl.1.pod.in | 8 ++++---- m4/paths.m4 | 23 ++++++++++++++--------- tools/xl/xl.c | 18 +++++++++++++----- tools/xl/xl.h | 1 + tools/xl/xl_cmdtable.c | 1 - tools/xl/xl_migrate.c | 16 +++++++--------- 6 files changed, 39 insertions(+), 28 deletions(-)
PATCH v20210209 1/4 tools: move CONFIG_DIR and XEN_CONFIG_DIR in paths.m4
Upcoming changes need to reuse XEN_CONFIG_DIR.
In its current location the assignment happens too late. Move it up in the file, along with CONFIG_DIR. Their only dependency is sysconfdir, which may also be adjusted in this file.
No functional change intended.
--- m4/paths.m4 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
m4/paths.m4 +6 -6
@@ -34,6 +34,12 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then esac fi +CONFIG_DIR=$sysconfdir +AC_SUBST(CONFIG_DIR) + +XEN_CONFIG_DIR=$CONFIG_DIR/xen +AC_SUBST(XEN_CONFIG_DIR) + AC_ARG_WITH([initddir], AS_HELP_STRING([--with-initddir=DIR], [Path to directory with sysv runlevel scripts. [SYSCONFDIR/init.d]]),
@@ -128,15 +134,9 @@ AC_SUBST(XEN_LIB_DIR) SHAREDIR=$prefix/share AC_SUBST(SHAREDIR) -CONFIG_DIR=$sysconfdir -AC_SUBST(CONFIG_DIR) - INITD_DIR=$initddir_path AC_SUBST(INITD_DIR) -XEN_CONFIG_DIR=$CONFIG_DIR/xen -AC_SUBST(XEN_CONFIG_DIR) - XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts AC_SUBST(XEN_SCRIPT_DIR)
Re: [PATCH v20210209 1/4] tools: move CONFIG_DIR and XEN_CONFIG_DIR in paths.m4
Olaf Hering writes ("[PATCH v20210209 1/4] tools: move CONFIG_DIR and XEN_CONFIG_DIR in paths.m4"):
Quoted 5 lines
Upcoming changes need to reuse
XEN_CONFIG_DIR.In its current location the assignment happens too late. Move it up in the file, along with
CONFIG_DIR. Their only dependency is sysconfdir, which may also be adjusted in this file.
PATCH v20210209 2/4 tools: add with-xen-scriptdir configure option
In reply to Olaf HeringSome distros plan for fresh installations will have an empty /etc, whose content will not be controlled by the package manager anymore.
To make this possible, add a knob to configure to allow storing the hotplug scripts to libexec instead of /etc/xen/scripts.
The current default remains unchanged, which is /etc/xen/scripts.
--- m4/paths.m4 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
m4/paths.m4 +8 -3
@@ -76,6 +76,14 @@ AC_ARG_WITH([libexec-leaf-dir], [libexec_subdir=$withval], [libexec_subdir=$PACKAGE_TARNAME]) +AC_ARG_WITH([xen-scriptdir], + AS_HELP_STRING([--with-xen-scriptdir=DIR], + [Path to directory for dom0 hotplug scripts. [SYSCONFDIR/xen/scripts]]), + [xen_scriptdir_path=$withval], + [xen_scriptdir_path=$XEN_CONFIG_DIR/scripts]) +XEN_SCRIPT_DIR=$xen_scriptdir_path +AC_SUBST(XEN_SCRIPT_DIR) + AC_ARG_WITH([xen-dumpdir], AS_HELP_STRING([--with-xen-dumpdir=DIR], [Path to directory for domU crash dumps. [LOCALSTATEDIR/lib/xen/dump]]),
@@ -137,9 +145,6 @@ AC_SUBST(SHAREDIR) INITD_DIR=$initddir_path AC_SUBST(INITD_DIR) -XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts -AC_SUBST(XEN_SCRIPT_DIR) - case "$host_os" in *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;; *netbsd*) XEN_LOCK_DIR=$rundir_path ;;
Re: [PATCH v20210209 2/4] tools: add with-xen-scriptdir configure option
Olaf Hering writes ("[PATCH v20210209 2/4] tools: add with-xen-scriptdir configure option"):
Quoted 7 lines
Some distros plan for fresh installations will have an empty /etc, whose content will not be controlled by the package manager anymore.
To make this possible, add a knob to configure to allow storing the hotplug scripts to libexec instead of
/etc/xen/scripts.The current default remains unchanged, which is
/etc/xen/scripts.
PATCH v20210209 3/4 xl: optionally print timestamps when running xl commands
In reply to Olaf HeringAdd a global option "-T" to xl to enable timestamps in the output from libxl and libxc. This is most useful with long running commands such as "migrate".
During 'xl -v.. migrate domU host' a large amount of debug is generated. It is difficult to map each line to the sending and receiving side. Also the time spent for migration is not reported.
With 'xl -T migrate domU host' both sides will print timestamps and also the pid of the invoked xl process to make it more obvious which side produced a given log line.
Note: depending on the command, xl itself also produces other output which does not go through libxentoollog. As a result such output will not have timestamps prepended.
This change adds also the missing "-t" flag to "xl help" output.
--- docs/man/xl.1.pod.in | 4 ++++ tools/xl/xl.c | 18 +++++++++++++----- tools/xl/xl.h | 1 + tools/xl/xl_migrate.c | 3 ++- 4 files changed, 20 insertions(+), 6 deletions(-)
docs/man/xl.1.pod.in +4 -0
@@ -86,6 +86,10 @@ Always use carriage-return-based overwriting for displaying progress messages without scrolling the screen. Without -t, this is done only if stderr is a tty. +=item B<-T> + +Include timestamps and pid of the xl process in output. + =back =head1 DOMAIN SUBCOMMANDS
tools/xl/xl.c +13 -5
@@ -52,6 +52,7 @@ libxl_bitmap global_pv_affinity_mask;enum output_format default_output_format =OUTPUT_FORMAT_JSON ;int claim_mode =1 ;bool progress_use_cr =0 ; +bool timestamps =0 ;int max_grant_frames =-1 ;int max_maptrack_frames =-1 ;libxl_domid domid_policy =INVALID_DOMID ;
@@ -365,8 +366,9 @@ int main(int argc, char **argv)int ret;void *config_data =0 ;int config_len =0 ; +unsigned int xtl_flags =0 ; -while ((opt =getopt (argc, argv,"+vftN" )) >=0 ) { +while ((opt =getopt (argc, argv,"+vftTN" )) >=0 ) {switch (opt) {case 'v' :if (minmsglevel >0 ) minmsglevel--;
@@ -380,6 +382,9 @@ int main(int argc, char **argv)case 't' : progress_use_cr =1 ;break ; +case 'T' : + timestamps =1 ; +break ;default :fprintf (stderr,"unknown global option\n" );exit (EXIT_FAILURE );
@@ -394,8 +399,11 @@ int main(int argc, char **argv) } opterr =0 ; - logger =xtl_createlogger_stdiostream (stderr, minmsglevel, - (progress_use_cr ?XTL_STDIOSTREAM_PROGRESS_USE_CR :0 )); +if (progress_use_cr) + xtl_flags |=XTL_STDIOSTREAM_PROGRESS_USE_CR ; +if (timestamps) + xtl_flags |=XTL_STDIOSTREAM_SHOW_DATE |XTL_STDIOSTREAM_SHOW_PID ; + logger =xtl_createlogger_stdiostream (stderr, minmsglevel, xtl_flags);if (!logger)exit (EXIT_FAILURE );xl_ctx_alloc ();
@@ -457,7 +465,7 @@ void help(const char *command)struct cmd_spec *cmd;if (!command || !strcmp (command,"help" )) { -printf ("Usage xl [-vfN] <subcommand> [args]\n\n" ); +printf ("Usage xl [-vfNtT] <subcommand> [args]\n\n" );printf ("xl full list of subcommands:\n\n" );for (i =0 ; i < cmdtable_len; i++) {printf (" %-19s " , cmd_table[i].cmd_name);
@@ -468,7 +476,7 @@ void help(const char *command) }else { cmd =cmdtable_lookup (command);if (cmd) { - printf("Usage: xl [-v%s%s] %s %s\n\n%s.\n\n", + printf("Usage: xl [-vtT%s%s] %s %s\n\n%s.\n\n", cmd->modifies ? "f" : "", cmd->can_dryrun ? "N" : "", cmd->cmd_name,
tools/xl/xl.h +1 -0
@@ -269,6 +269,7 @@ extern int run_hotplug_scripts;extern int dryrun_only;extern int claim_mode;extern bool progress_use_cr; +extern bool timestamps;extern xentoollog_level minmsglevel;#define minmsglevel_default XTL_PROGRESSextern char *lockfile;
tools/xl/xl_migrate.c +2 -1
@@ -592,9 +592,10 @@ int main_migrate(int argc, char **argv) }else { verbose_len = (minmsglevel_default - minmsglevel) +2 ; } - xasprintf(&rune, "exec %s %s xl%s%.*s migrate-receive%s%s%s", + xasprintf(&rune, "exec %s %s xl%s%s%.*s migrate-receive%s%s%s", ssh_command, host, pass_tty_arg ? " -t" : "", + timestamps ? " -T" : "", verbose_len, verbose_buf, daemonize ? "" : " -e", debug ? " -d" : "",
Re: [PATCH v20210209 3/4] xl: optionally print timestamps when running xl commands
Olaf Hering writes ("[PATCH v20210209 3/4] xl: optionally print timestamps when running xl commands"):
Quoted 8 lines
Add a global option "-T" to xl to enable timestamps in the output from libxl and libxc. This is most useful with long running commands such as "migrate".
During 'xl -v.. migrate domU host' a large amount of debug is generated. It is difficult to map each line to the sending and receiving side. Also the time spent for migration is not reported.
Quoted 7 lines
With 'xl -T migrate domU host' both sides will print timestamps and also the pid of the invoked xl process to make it more obvious which side produced a given log line.
Note: depending on the command, xl itself also produces other output which does not go through libxentoollog. As a result such output will not have timestamps prepended.
This is a new feature so it needs a release risk analysis.
The changes are entirely to xl command line handling. The worst / most likely bug would probably be something to do with the way the logger is created. Such a bug would be easy to fix. Or, this patch could easily be reverted.
Quoted 1 line
This change adds also the missing "-t" flag to "xl help" output.
This part of the commit message talks about -t rather than -T. I will fix that on commit.
I'm going to commit the first three now.
Ian.
Re: [PATCH v20210209 3/4] xl: optionally print timestamps when running xl commands
Am Tue, 9 Feb 2021 16:53:06 +0000
schrieb Ian Jackson <[email protected]>:
Quoted 2 lines
This part of the commit message talks about -t rather than -T. I will fix that on commit.
It is really the lowercase t.
01f78a81ae56220dd496a61185ba5dfae30dc2fe did not adjust the output in tools/libxl/xl_cmdimpl.c:help().
Olaf
Re: [PATCH v20210209 3/4] xl: optionally print timestamps when running xl commands
Olaf Hering writes ("Re: [PATCH v20210209 3/4] xl: optionally print timestamps when running xl commands"):
Quoted 9 lines
Am Tue, 9 Feb 2021 16:53:06 +0000
schrieb Ian Jackson <[email protected]>:Quoted 2 lines
This part of the commit message talks about -t rather than -T. I will fix that on commit.
It is really the lowercase t.
01f78a81ae56220dd496a61185ba5dfae30dc2fedid not adjust the output in tools/libxl/xl_cmdimpl.c:help().
OIC, thanks.
Ian.
PATCH v20210209 4/4 xl: disable --debug option for xl migrate
In reply to Olaf Heringxl migrate --debug used to track every pfn in every batch of pages.
Since commit cfa955591caea5d7ec505cdcbf4442f2d6e889e1 from Xen 4.6 the debug flag changed meaning from "verify transferred memory during live migration" to "verify transferred memory in remus/colo". At least xl will not be able to trigger execution of the verifying code in send_domain_memory_live anymore.
Remove "--debug" from "xl migrate -h" output.
Remove "--debug" from from xl man page.
Do not send "-d" as potential option for "xl migrate-receive" anymore. Do not pass the flag LIBXL_SUSPEND_DEBUG anymore to libxl_domain_suspend. Continue to recognize "--debug" as valid option for "xl migrate". Continue to recognize "-d" as valid option for "xl migrate-receive".
--- docs/man/xl.1.pod.in | 4 ---- tools/xl/xl_cmdtable.c | 1 - tools/xl/xl_migrate.c | 15 ++++++--------- 3 files changed, 6 insertions(+), 14 deletions(-)
docs/man/xl.1.pod.in +0 -4
@@ -479,10 +479,6 @@ domain. See the corresponding option of the I<create> subcommand. Send the specified <config> file instead of the file used on creation of the domain. -=item B<--debug> - -Display huge (!) amount of debug information during the migration process. - =item B<-p> Leave the domain on the receive side paused after migration.
tools/xl/xl_cmdtable.c +0 -1
@@ -171,7 +171,6 @@ struct cmd_spec cmd_table[] = {" migrate-receive [-d -e]\n" "-e Do not wait in the background (on <host>) for the death\n" " of the domain.\n" -"--debug Print huge (!) amount of debug during the migration process.\n" "-p Do not unpause domain after migrating it.\n" "-D Preserve the domain id" },
tools/xl/xl_migrate.c +6 -9
@@ -177,8 +177,7 @@ static void migrate_do_preamble(int send_fd, int recv_fd, pid_t child, }static void migrate_domain (uint32_t domid,int preserve_domid, -const char *rune,int debug, -const char *override_config_file) +const char *rune,const char *override_config_file) {pid_t child =-1 ;int rc;
@@ -204,8 +203,6 @@ static void migrate_domain(uint32_t domid, int preserve_domid,xtl_stdiostream_adjust_flags (logger,XTL_STDIOSTREAM_HIDE_PROGRESS ,0 ); -if (debug) - flags |=LIBXL_SUSPEND_DEBUG ; rc =libxl_domain_suspend (ctx, domid, send_fd, flags,NULL );if (rc) { fprintf(stderr, "migration sender: libxl_domain_suspend failed"
@@ -500,6 +497,7 @@ int main_migrate_receive(int argc, char **argv) monitor =0 ;break ;case 'd' : +/* For compatibility with older variants of xl */ debug =1 ;break ;case 'r' :
@@ -537,7 +535,7 @@ int main_migrate(int argc, char **argv)const char *ssh_command ="ssh" ;char *rune =NULL ;char *host; -int opt, daemonize =1 , monitor =1 , debug =0 , pause_after_migration =0 ; +int opt, daemonize =1 , monitor =1 , pause_after_migration =0 ;int preserve_domid =0 ;static struct option opts[] = { {"debug" ,0 ,0 ,0x100 },
@@ -566,7 +564,7 @@ int main_migrate(int argc, char **argv) preserve_domid =1 ;break ;case 0x100 :/* --debug */ - debug =1 ; +/* ignored for compatibility with older variants of xl */ break ;case 0x200 :/* --live */ /* ignored for compatibility with xm */
@@ -592,17 +590,16 @@ int main_migrate(int argc, char **argv) }else { verbose_len = (minmsglevel_default - minmsglevel) +2 ; } -xasprintf (&rune,"exec %s %s xl%s%s%.*s migrate-receive%s%s%s" , +xasprintf (&rune,"exec %s %s xl%s%s%.*s migrate-receive%s%s" , ssh_command, host, pass_tty_arg ?" -t" :"" , timestamps ?" -T" :"" , verbose_len, verbose_buf, daemonize ?"" :" -e" , - debug ?" -d" :"" , pause_after_migration ?" -p" :"" ); } -migrate_domain (domid, preserve_domid, rune, debug, config_filename); +migrate_domain (domid, preserve_domid, rune, config_filename);return EXIT_SUCCESS ; }
Re: [PATCH v20210209 4/4] xl: disable --debug option for xl migrate
Olaf Hering writes ("[PATCH v20210209 4/4] xl: disable --debug option for xl migrate"):
Quoted 8 lines
xl migrate --debug used to track every pfn in every batch of pages.
Since commit
cfa955591caea5d7ec505cdcbf4442f2d6e889e1from Xen 4.6 the debug flag changed meaning from "verify transferred memory during live migration" to "verify transferred memory in remus/colo". At least xl will not be able to trigger execution of the verifying code insend_domain_memory_liveanymore.
Quoted 6 lines
Remove "--debug" from "xl migrate -h" output.
Remove "--debug" from from xl man page.
Do not send "-d" as potential option for "xl migrate-receive" anymore. Do not pass the flagLIBXL_SUSPEND_DEBUGanymore tolibxl_domain_suspend. Continue to recognize "--debug" as valid option for "xl migrate". Continue to recognize "-d" as valid option for "xl migrate-receive".
It seems to me that something is definitely a bug here but I want to understand from Andy what the best thing to do is. I'm hesitant to release-ack removing this at this stage.
Wouldn't it be better to just fix the docs like in your previously suggested patch ?
Also, Olaf, please CC Andy on these migration-related patches.
Thanks,
Ian.
Re: [PATCH v20210209 4/4] xl: disable --debug option for xl migrate
Am Tue, 9 Feb 2021 17:12:28 +0000
schrieb Ian Jackson <[email protected]>:
Quoted 1 line
Also, Olaf, please CC Andy on these migration-related patches.
Can this be automated via MAINTAINERS, so that scripts/get_maintainer.pl addresses the people who feel responsible for it? Right now it ends up in your queue due to 'tools/*'.
Olaf
Re: [PATCH v20210209 4/4] xl: disable --debug option for xl migrate
In reply to Ian JacksonAm Tue, 9 Feb 2021 17:12:28 +0000
schrieb Ian Jackson <[email protected]>:
Quoted 6 lines
It seems to me that something is definitely a bug here but I want to understand from Andy what the best thing to do is. I'm hesitant to release-ack removing this at this stage.
Wouldn't it be better to just fix the docs like in your previously suggested patch ?
To make that initial patch accurate, this additional change is required:
tools/libs/guest/xg_sr_save.c +1 -1
@@ -752,7 +752,7 @@ static int send_domain_memory_live(struct xc_sr_context *ctx)if ( rc ) goto out; -if ( ctx->save.debug && ctx->stream_type !=XC_STREAM_PLAIN ) +if ( ctx->save.debug ) { rc =verify_frames (ctx);if ( rc )
Otherwise there is no way for "xl" to trigger a call into verify_frames.
I will test this patch today.
Olaf
Re: [PATCH v20210209 4/4] xl: disable --debug option for xl migrate
Am Wed, 10 Feb 2021 10:06:06 +0100
schrieb Olaf Hering <[email protected]>:
tools/libs/guest/xg_sr_save.c static int send_domain_memory_live(struct xc_sr_context *ctx) · line 755
Quoted 2 lines
tools/libs/guest/xg_sr_save.c +1
-1-if ( ctx->save.debug && ctx->stream_type !=XC_STREAM_PLAIN ) +if ( ctx->save.debug )
This will do the verification, and finds many errors:
2021-02-10 02:37:03 MST [2149] xc: error: verify pfn 0xfda9 failed (type 0): Internal error
As Andrew said elsewhere, something writes into the memory of the idle, but suspended domU. Likely the netback, since it can not know that the domU will never come back.
No idea if verify_frames would have ways to figure out what purpose a given pfn really has.
Olaf