From: Ian Campbell Subject: Re: [PATCH] tools/xc: restore logging in xc_save Date: Mon, 4 Feb 2013 10:12:00 +0000 Message-ID: <1359972720.5281.20.camel@zakaz.uk.xensource.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Olaf Hering Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Fri, 2013-02-01 at 18:58 +0000, Olaf Hering wrote: > # HG changeset patch > # User Olaf Hering > # Date 1359745022 -3600 > # Node ID d76b38b799293ff17fed8eaaac8fbbebced1b72f > # Parent 6d1d516ecaade56f796e3216e9931fdcc12282cd > tools/xc: restore logging in xc_save > > Prior to xen-4.1 the helper xc_save would print some progress during > migration. With the new xc_interface_open API no more messages were > printed because no logger was configured. > > Restore previous behaviour by providing a logger. The progress in > xc_domain_save will be disabled because its output lacks a linefeed > which makes xend.log look ugly. > > Signed-off-by: Olaf Hering > > diff -r 6d1d516ecaad -r d76b38b79929 tools/xcutils/xc_save.c > --- a/tools/xcutils/xc_save.c > +++ b/tools/xcutils/xc_save.c > @@ -166,17 +166,15 @@ static int switch_qemu_logdirty(int domi > int > main(int argc, char **argv) > { > - unsigned int maxit, max_f; > + unsigned int maxit, max_f, lflags; > int io_fd, ret, port; > struct save_callbacks callbacks; > + xentoollog_level lvl; > + xentoollog_logger *l; > > if (argc != 6) > errx(1, "usage: %s iofd domid maxit maxf flags", argv[0]); > > - si.xch = xc_interface_open(0,0,0); > - if (!si.xch) > - errx(1, "failed to open control interface"); > - > io_fd = atoi(argv[1]); > si.domid = atoi(argv[2]); > maxit = atoi(argv[3]); > @@ -185,6 +183,13 @@ main(int argc, char **argv) > > si.suspend_evtchn = -1; > > + lvl = si.flags & XCFLAGS_DEBUG ? XTL_DEBUG: XTL_DETAIL; > + lflags = XTL_STDIOSTREAM_HIDE_PROGRESS; Would it be useful (as an extension) to implement an XTL_STDIOSTREAM flag which makes it output something more suitable for logging, e.g. ...10%...20%...30%... (or perhaps automatic based on isatty(outputfd)?) > + l = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, lvl, lflags); Might this fail and therefore require error handling? The lvl and lflags variables seem a bit useless to me. > + si.xch = xc_interface_open(l, 0, 0); > + if (!si.xch) > + errx(1, "failed to open control interface"); > + > si.xce = xc_evtchn_open(NULL, 0); > if (si.xce == NULL) > warnx("failed to open event channel handle"); > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel