From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH] xl/libxtl: Remove glitch in xl migrate log output
Date: Thu, 27 May 2010 16:55:21 +0100 [thread overview]
Message-ID: <1274975721-3777-15-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1274975721-3777-14-git-send-email-ian.jackson@eu.citrix.com>
* 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@eu.citrix.com>
---
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 --git a/tools/libxc/xentoollog.h b/tools/libxc/xentoollog.h
index d467168..40ac3c4 100644
--- a/tools/libxc/xentoollog.h
+++ b/tools/libxc/xentoollog.h
@@ -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;
@@ -61,6 +62,12 @@ xentoollog_logger_stdiostream *xtl_createlogger_stdiostream
/* 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 --git a/tools/libxc/xtl_logger_stdio.c b/tools/libxc/xtl_logger_stdio.c
index abe274a..1bfa9a9 100644
--- a/tools/libxc/xtl_logger_stdio.c
+++ b/tools/libxc/xtl_logger_stdio.c
@@ -75,6 +75,9 @@ static void stdiostream_progress(struct xentoollog_logger *logger_in,
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 xentoollog_logger *logger_in) {
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 --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index abe4c9d..b55029a 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1917,6 +1917,8 @@ static void migrate_domain(char *domain_spec, const char *rune,
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);
@@ -1926,13 +1928,17 @@ static void migrate_domain(char *domain_spec, const char *rune,
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
* domain away ourselves */
--
1.5.6.5
next prev parent reply other threads:[~2010-05-27 15:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-27 15:55 [PATCH 00/14] Logging cleanups, libxc API change Ian Jackson
2010-05-27 15:55 ` [PATCH] xl: Combine headers into one header file Ian Jackson
2010-05-27 15:55 ` [PATCH] xl: Move "extern" declarations to xl.h Ian Jackson
2010-05-27 15:55 ` [PATCH] stubdom/newlib: Provide correct names for time.h timezone variables Ian Jackson
2010-05-27 15:55 ` [PATCH] libxc: xc_domain_save.c: rename "write_exact" macro Ian Jackson
2010-05-27 15:55 ` [PATCH] libelf: Tidy up logging and remove dependency on stdio Ian Jackson
2010-05-27 15:55 ` [PATCH] xtl: New xentoollog mini-library Ian Jackson
2010-05-27 15:55 ` [PATCH] libxc: eliminate static variables, use xentoollog; API change Ian Jackson
2010-05-27 15:55 ` [PATCH] libxc: Use new DBGPRINTF for a few debugging output messages Ian Jackson
2010-05-27 15:55 ` [PATCH] libxl: Fix up some incorrect printf formats Ian Jackson
2010-05-27 15:55 ` [PATCH] libxl: Use the caller's logger (xentoollog) Ian Jackson
2010-05-27 15:55 ` [PATCH] xl: Allow control of logging level Ian Jackson
2010-05-27 15:55 ` [PATCH] libxc: save/restore error handling fixes Ian Jackson
2010-05-27 15:55 ` [PATCH] libxc: remove \n from strings passed to PERROR Ian Jackson
2010-05-27 15:55 ` Ian Jackson [this message]
2010-05-27 15:58 ` [PATCH 00/14] Logging cleanups, libxc API change Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1274975721-3777-15-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).