[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xl/libxtl: Remove glitch in xl migrate log output
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1275035936 -3600 # Node ID eca99674800e9072b8ffbc5dffa5823746cd7352 # Parent 2531dc129d81c9243433fb2523aa54dad9b4e2ef xl/libxtl: Remove glitch in xl migrate log output * Provide a new XTL_STDIOSTREAM_HIDE_PROGRESS flag in the stdio logger * Provide a way to adjust the flags after logger setup * Use these to disable progress output from the migration receiver, as the sender is also sending progress information. Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- tools/libxc/xentoollog.h | 11 +++++++++-- tools/libxc/xtl_logger_stdio.c | 15 +++++++++++++++ tools/libxl/xl_cmdimpl.c | 8 +++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff -r 2531dc129d81 -r eca99674800e tools/libxc/xentoollog.h --- a/tools/libxc/xentoollog.h Fri May 28 09:38:18 2010 +0100 +++ b/tools/libxc/xentoollog.h Fri May 28 09:38:56 2010 +0100 @@ -51,8 +51,9 @@ struct xentoollog_logger { /*---------- facilities for consuming log messages ----------*/ -#define XTL_STDIOSTREAM_SHOW_PID 01u -#define XTL_STDIOSTREAM_SHOW_DATE 02u +#define XTL_STDIOSTREAM_SHOW_PID 01u +#define XTL_STDIOSTREAM_SHOW_DATE 02u +#define XTL_STDIOSTREAM_HIDE_PROGRESS 04u typedef struct xentoollog_logger_stdiostream xentoollog_logger_stdiostream; @@ -60,6 +61,12 @@ xentoollog_logger_stdiostream *xtl_creat (FILE *f, xentoollog_level min_level, unsigned flags); /* may return 0 if malloc fails, in which case error was logged */ /* destroy on this logger does not close the file */ + +void xtl_stdiostream_set_minlevel(xentoollog_logger_stdiostream*, + xentoollog_level min_level); +void xtl_stdiostream_adjust_flags(xentoollog_logger_stdiostream*, + unsigned set_flags, unsigned clear_flags); + /* if set_flags and clear_flags overlap, set_flags takes precedence */ void xtl_logger_destroy(struct xentoollog_logger *logger /* 0 is ok */); diff -r 2531dc129d81 -r eca99674800e tools/libxc/xtl_logger_stdio.c --- a/tools/libxc/xtl_logger_stdio.c Fri May 28 09:38:18 2010 +0100 +++ b/tools/libxc/xtl_logger_stdio.c Fri May 28 09:38:56 2010 +0100 @@ -75,6 +75,9 @@ static void stdiostream_progress(struct int newpel, extra_erase; xentoollog_level this_level; + if (!(lg->flags & XTL_STDIOSTREAM_HIDE_PROGRESS)) + return; + if (percent < lg->progress_last_percent) { this_level = XTL_PROGRESS; } else if (percent == lg->progress_last_percent) { @@ -108,6 +111,18 @@ static void stdiostream_destroy(struct x free(lg); } +void xtl_stdiostream_set_minlevel(xentoollog_logger_stdiostream *lg, + xentoollog_level min_level) { + lg->min_level = min_level; +} + +void xtl_stdiostream_adjust_flags(xentoollog_logger_stdiostream *lg, + unsigned set_flags, unsigned clear_flags) { + unsigned new_flags = (lg->flags & ~clear_flags) | set_flags; + if (new_flags & XTL_STDIOSTREAM_HIDE_PROGRESS) + progress_erase(lg); + lg->flags = new_flags; +} xentoollog_logger_stdiostream *xtl_createlogger_stdiostream (FILE *f, xentoollog_level min_level, unsigned flags) { diff -r 2531dc129d81 -r eca99674800e tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Fri May 28 09:38:18 2010 +0100 +++ b/tools/libxl/xl_cmdimpl.c Fri May 28 09:38:56 2010 +0100 @@ -1923,6 +1923,8 @@ static void migrate_domain(char *domain_ save_domain_core_writeconfig(send_fd, "migration stream", config_data, config_len); + xtl_stdiostream_adjust_flags(logger, XTL_STDIOSTREAM_HIDE_PROGRESS, 0); + memset(&suspinfo, 0, sizeof(suspinfo)); suspinfo.flags |= XL_SUSPEND_LIVE; rc = libxl_domain_suspend(&ctx, &suspinfo, domid, send_fd); @@ -1932,12 +1934,16 @@ static void migrate_domain(char *domain_ goto failed_resume; } - fprintf(stderr, "migration sender: Transfer complete.\n"); + //fprintf(stderr, "migration sender: Transfer complete.\n"); + // Should only be printed when debugging as it's a bit messy with + // progress indication. rc = migrate_read_fixedmessage(recv_fd, migrate_receiver_ready, sizeof(migrate_receiver_ready), "ready message", rune); if (rc) goto failed_resume; + + xtl_stdiostream_adjust_flags(logger, 0, XTL_STDIOSTREAM_HIDE_PROGRESS); /* right, at this point we are about give the destination * permission to rename and resume, so we must first rename the _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |