user: Olaf Hering date: Wed Mar 06 17:05:15 2013 +0100 files: tools/libxc/xenguest.h tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/migrate.py tools/xcutils/xc_save.c description: tools: add xm migrate --log_progress option xc_domain_save does print progress messages. These verbose messages are disabled per default to avoid flood in xend.log. Sometimes it is helpful to see progress when migrating large and busy guests. So add a new option to xm migrate to actually enable the printing of progress messsages. xl migrate is not modified with this change because it does not use the stdio logger. Signed-off-by: Olaf Hering Index: xen-4.4.0-testing/tools/libxc/xenguest.h =================================================================== --- xen-4.4.0-testing.orig/tools/libxc/xenguest.h +++ xen-4.4.0-testing/tools/libxc/xenguest.h @@ -29,6 +29,7 @@ #define XCFLAGS_STDVGA (1 << 3) #define XCFLAGS_CHECKPOINT_COMPRESS (1 << 4) #define XCFLAGS_DOMSAVE_ABORT_IF_BUSY (1 << 5) +#define XCFLAGS_PROGRESS (1 << 6) #define X86_64_B_SIZE 64 #define X86_32_B_SIZE 32 Index: xen-4.4.0-testing/tools/python/xen/xend/XendCheckpoint.py =================================================================== --- xen-4.4.0-testing.orig/tools/python/xen/xend/XendCheckpoint.py +++ xen-4.4.0-testing/tools/python/xen/xend/XendCheckpoint.py @@ -121,16 +121,19 @@ def save(fd, dominfo, network, live, dst max_iters = dominfo.info.get('max_iters', "0") max_factor = dominfo.info.get('max_factor', "0") abort_if_busy = dominfo.info.get('abort_if_busy', "0") + log_save_progress = dominfo.info.get('log_save_progress', "0") if max_iters == "None": max_iters = "0" if max_factor == "None": max_factor = "0" if abort_if_busy == "None": abort_if_busy = "0" + if log_save_progress == "None": + log_save_progress = "0" cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(fd), str(dominfo.getDomid()), max_iters, max_factor, - str( int(live) | (int(hvm) << 2) | (int(abort_if_busy) << 5) ) ] + str( int(live) | (int(hvm) << 2) | (int(abort_if_busy) << 5) | (int(log_save_progress) << 6) ) ] log.debug("[xc_save]: %s", string.join(cmd)) def saveInputHandler(line, tochild): Index: xen-4.4.0-testing/tools/python/xen/xend/XendDomain.py =================================================================== --- xen-4.4.0-testing.orig/tools/python/xen/xend/XendDomain.py +++ xen-4.4.0-testing/tools/python/xen/xend/XendDomain.py @@ -1832,17 +1832,18 @@ class XendDomain: log.exception(ex) raise XendError(str(ex)) - def domain_migrate_constraints_set(self, domid, max_iters, max_factor, abort_if_busy): + def domain_migrate_constraints_set(self, domid, max_iters, max_factor, abort_if_busy, log_save_progress): """Set the Migrate Constraints of this domain. @param domid: Domain ID or Name @param max_iters: Number of iterations before final suspend @param max_factor: Max amount of memory to transfer before final suspend @param abort_if_busy: Abort migration instead of doing final suspend + @param log_save_progress: Log progress of migrate to xend.log """ dominfo = self.domain_lookup_nr(domid) if not dominfo: raise XendInvalidDomain(str(domid)) - dominfo.setMigrateConstraints(max_iters, max_factor, abort_if_busy) + dominfo.setMigrateConstraints(max_iters, max_factor, abort_if_busy, log_save_progress) def domain_maxmem_set(self, domid, mem): """Set the memory limit for a domain. Index: xen-4.4.0-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-4.4.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-4.4.0-testing/tools/python/xen/xend/XendDomainInfo.py @@ -1475,17 +1475,19 @@ class XendDomainInfo: break xen.xend.XendDomain.instance().managed_config_save(self) - def setMigrateConstraints(self, max_iters, max_factor, abort_if_busy): + def setMigrateConstraints(self, max_iters, max_factor, abort_if_busy, log_save_progress): """Set the Migrate Constraints of this domain. @param max_iters: Number of iterations before final suspend @param max_factor: Max amount of memory to transfer before final suspend @param abort_if_busy: Abort migration instead of doing final suspend + @param log_save_progress: Log progress of migrate to xend.log """ log.debug("Setting migration constraints of domain %s (%s) to '%s' '%s' '%s'.", self.info['name_label'], str(self.domid), max_iters, max_factor, abort_if_busy) self.info['max_iters'] = str(max_iters) self.info['max_factor'] = str(max_factor) self.info['abort_if_busy'] = str(abort_if_busy) + self.info['log_save_progress'] = str(log_save_progress) def setMemoryTarget(self, target): """Set the memory target of this domain. Index: xen-4.4.0-testing/tools/python/xen/xm/migrate.py =================================================================== --- xen-4.4.0-testing.orig/tools/python/xen/xm/migrate.py +++ xen-4.4.0-testing/tools/python/xen/xm/migrate.py @@ -67,6 +67,10 @@ gopts.opt('abort_if_busy', fn=set_true, default=0, use="Abort migration instead of doing final suspend.") +gopts.opt('log_progress', + fn=set_true, default=0, + use="Log progress of migration to xend.log") + def help(): return str(gopts) @@ -95,7 +99,8 @@ def main(argv): server.xend.domain.migrate_constraints_set(dom, opts.vals.max_iters, opts.vals.max_factor, - opts.vals.abort_if_busy) + opts.vals.abort_if_busy, + opts.vals.log_progress) server.xend.domain.migrate(dom, dst, opts.vals.live, opts.vals.port, opts.vals.node, Index: xen-4.4.0-testing/tools/xcutils/xc_save.c =================================================================== --- xen-4.4.0-testing.orig/tools/xcutils/xc_save.c +++ xen-4.4.0-testing/tools/xcutils/xc_save.c @@ -184,7 +184,8 @@ main(int argc, char **argv) si.suspend_evtchn = -1; lvl = si.flags & XCFLAGS_DEBUG ? XTL_DEBUG: XTL_DETAIL; - lflags = XTL_STDIOSTREAM_SHOW_PID | XTL_STDIOSTREAM_HIDE_PROGRESS; + lflags = XTL_STDIOSTREAM_SHOW_PID; + lflags |= si.flags & XCFLAGS_PROGRESS ? 0 : XTL_STDIOSTREAM_HIDE_PROGRESS; l = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, lvl, lflags); si.xch = xc_interface_open(l, 0, 0); if (!si.xch)