From: Ian Jackson Subject: Re: [PATCH 4/5] xl: Pass -v options on to migration receiver Date: Tue, 18 Mar 2014 18:07:46 +0000 Message-ID: <21288.35698.605377.884397@mariner.uk.xensource.com> References: <1395072199-326-1-git-send-email-ian.jackson@eu.citrix.com> <1395072199-326-5-git-send-email-ian.jackson@eu.citrix.com> <1395164211.11824.51.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1395164211.11824.51.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [PATCH 4/5] xl: Pass -v options on to migration receiver"): > On Mon, 2014-03-17 at 16:03 +0000, Ian Jackson wrote: > > Compute a -v option to pass to the migration receiver. > > +extern xentoollog_level minmsglevel; > > +#define minmsglevel_default XTL_PROGRESS > > Was your intention to use this to initialise minmsglevel? Oops, yes. Fixed version below. > Is verbose_len needed here vs verbose_buf[0] ? vebose_buf : "" > > Oh, I see the verbose_len = 0 above. Makes sense. (I initially misread > the preceding code as doing stuff with minmsglevel - minmsglevel_default > to produce exactly the required string) Yes. >From c7eada4addca817bd17038918e54f04b4e38bb8f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 7 Jan 2014 18:40:05 +0000 Subject: [PATCH v2 4/9] xl: Pass -v options on to migration receiver Compute a -v option to pass to the migration receiver. Signed-off-by: Ian Jackson CC: Ian Campbell --- v2: Use minmsglevel_default to initialise minmsglevel. --- tools/libxl/xl.c | 2 +- tools/libxl/xl.h | 2 ++ tools/libxl/xl_cmdimpl.c | 14 +++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c index 7fdc155..1d157fe 100644 --- a/tools/libxl/xl.c +++ b/tools/libxl/xl.c @@ -50,7 +50,7 @@ enum output_format default_output_format = OUTPUT_FORMAT_JSON; int claim_mode = 1; bool progress_use_cr = 0; -static xentoollog_level minmsglevel = XTL_PROGRESS; +xentoollog_level minmsglevel = minmsglevel_default; /* Get autoballoon option based on presence of dom0_mem Xen command line option. */ diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h index 1a71234..280d39c 100644 --- a/tools/libxl/xl.h +++ b/tools/libxl/xl.h @@ -153,6 +153,8 @@ extern int run_hotplug_scripts; extern int dryrun_only; extern int claim_mode; extern bool progress_use_cr; +extern xentoollog_level minmsglevel; +#define minmsglevel_default XTL_PROGRESS extern char *lockfile; extern char *default_vifscript; extern char *default_bridge; diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index d52b933..8990020 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -4115,9 +4115,21 @@ int main_migrate(int argc, char **argv) if (!ssh_command[0]) { rune= host; } else { - if (asprintf(&rune, "exec %s %s xl%s migrate-receive%s%s", + char verbose_buf[minmsglevel_default+3]; + int verbose_len; + verbose_buf[0] = ' '; + verbose_buf[1] = '-'; + memset(verbose_buf+2, 'v', minmsglevel_default); + verbose_buf[sizeof(verbose_buf)-1] = 0; + if (minmsglevel == minmsglevel_default) { + verbose_len = 0; + } else { + verbose_len = (minmsglevel_default - minmsglevel) + 2; + } + if (asprintf(&rune, "exec %s %s xl%s%.*s migrate-receive%s%s", ssh_command, host, pass_tty_arg ? " -t" : "", + verbose_len, verbose_buf, daemonize ? "" : " -e", debug ? " -d" : "") < 0) return 1; -- 1.7.10.4