[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v20210111 07/39] xl: optionally print timestamps during xl 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 migrate -T 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. Signed-off-by: Olaf Hering <olaf@xxxxxxxxx> --- docs/man/xl.1.pod.in | 4 ++++ tools/xl/xl_cmdtable.c | 1 + tools/xl/xl_migrate.c | 25 +++++++++++++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in index df98adc9e4..494a84ee13 100644 --- a/docs/man/xl.1.pod.in +++ b/docs/man/xl.1.pod.in @@ -475,6 +475,10 @@ 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<-T> + +Include timestamps in output. + =item B<--debug> Display huge (!) amount of debug information during the migration process. diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 37710880d3..da0473ddfb 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -167,6 +167,7 @@ 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" + "-T Show timestamps during the migration process.\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" diff --git a/tools/xl/xl_migrate.c b/tools/xl/xl_migrate.c index 0813beb801..856a6e2be1 100644 --- a/tools/xl/xl_migrate.c +++ b/tools/xl/xl_migrate.c @@ -32,6 +32,8 @@ #ifndef LIBXL_HAVE_NO_SUSPEND_RESUME +static bool timestamps; + static pid_t create_migration_child(const char *rune, int *send_fd, int *recv_fd) { @@ -187,6 +189,7 @@ static void migrate_domain(uint32_t domid, int preserve_domid, char rc_buf; uint8_t *config_data; int config_len, flags = LIBXL_SUSPEND_LIVE; + unsigned xtl_flags = XTL_STDIOSTREAM_HIDE_PROGRESS; save_domain_core_begin(domid, preserve_domid, override_config_file, &config_data, &config_len); @@ -202,7 +205,9 @@ static void migrate_domain(uint32_t domid, int preserve_domid, migrate_do_preamble(send_fd, recv_fd, child, config_data, config_len, rune); - xtl_stdiostream_adjust_flags(logger, XTL_STDIOSTREAM_HIDE_PROGRESS, 0); + if (timestamps) + xtl_flags |= XTL_STDIOSTREAM_SHOW_DATE | XTL_STDIOSTREAM_SHOW_PID; + xtl_stdiostream_adjust_flags(logger, xtl_flags, 0); if (debug) flags |= LIBXL_SUSPEND_DEBUG; @@ -328,6 +333,11 @@ static void migrate_receive(int debug, int daemonize, int monitor, char rc_buf; char *migration_domname; struct domain_create dom_info; + unsigned xtl_flags = 0; + + if (timestamps) + xtl_flags |= XTL_STDIOSTREAM_SHOW_DATE | XTL_STDIOSTREAM_SHOW_PID; + xtl_stdiostream_adjust_flags(logger, xtl_flags, 0); signal(SIGPIPE, SIG_IGN); /* if we get SIGPIPE we'd rather just have it as an error */ @@ -491,7 +501,7 @@ int main_migrate_receive(int argc, char **argv) COMMON_LONG_OPTS }; - SWITCH_FOREACH_OPT(opt, "Fedrp", opts, "migrate-receive", 0) { + SWITCH_FOREACH_OPT(opt, "FedrpT", opts, "migrate-receive", 0) { case 'F': daemonize = 0; break; @@ -517,6 +527,9 @@ int main_migrate_receive(int argc, char **argv) case 'p': pause_after_migration = 1; break; + case 'T': + timestamps = 1; + break; } if (argc-optind != 0) { @@ -545,7 +558,7 @@ int main_migrate(int argc, char **argv) COMMON_LONG_OPTS }; - SWITCH_FOREACH_OPT(opt, "FC:s:epD", opts, "migrate", 2) { + SWITCH_FOREACH_OPT(opt, "FC:s:eTpD", opts, "migrate", 2) { case 'C': config_filename = optarg; break; @@ -559,6 +572,9 @@ int main_migrate(int argc, char **argv) daemonize = 0; monitor = 0; break; + case 'T': + timestamps = 1; + break; case 'p': pause_after_migration = 1; break; @@ -592,11 +608,12 @@ 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 migrate-receive%s%s%s%s", ssh_command, host, pass_tty_arg ? " -t" : "", verbose_len, verbose_buf, daemonize ? "" : " -e", + timestamps ? " -T" : "", debug ? " -d" : "", pause_after_migration ? " -p" : ""); }
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |