From patchwork Tue Jul 19 08:58:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 9236495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84AE9602F0 for ; Tue, 19 Jul 2016 09:01:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 731DC26247 for ; Tue, 19 Jul 2016 09:01:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 677632624D; Tue, 19 Jul 2016 09:01:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ACD7326247 for ; Tue, 19 Jul 2016 09:01:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPQrA-0002NW-Os; Tue, 19 Jul 2016 08:58:24 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPQr9-0002NP-8s for xen-devel@lists.xenproject.org; Tue, 19 Jul 2016 08:58:23 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id B9/3A-13744-EABED875; Tue, 19 Jul 2016 08:58:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrrBXnfd695 wg6NT+Cy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozjt74xFvzRqHh34CxTA+MZ2S5GTg4JAX+J Hbdvs4DYbAI6Ehfn7mTrYuTgEBFQkbi91wAkzCwQL/FhQi8riC0s4CmxZs0FJhCbRUBVoru9g R3E5hVwlni6/AQjxEhdiYfnfrNCxAUlTs58wgIxR1OidftvdghbXqJ562xmEFtIQFGif94DNo hebonbp6cyT2DknYWkfRaS9llI2hcwMq9iVC9OLSpLLdI11EsqykzPKMlNzMzRNTQw08tNLS5 OTE/NSUwq1kvOz93ECAwoBiDYwbjzudMhRkkOJiVRXlXR3nAhvqT8lMqMxOKM+KLSnNTiQ4wy HBxKErxBr4BygkWp6akVaZk5wNCGSUtw8CiJ8CqBpHmLCxJzizPTIVKnGBWlxHmNQBICIImM0 jy4Nlg8XWKUlRLmZQQ6RIinILUoN7MEVf4VozgHo5IwxHaezLwSuOmvgBYzAS02UO0GWVySiJ CSamCsSw3amf/19GUGr9D5ZySep/HrzTv74MYey/jqE7evlN1/JLD4bYvB4j7r3uQvb3lkODm fJPy0m8m7LUXZ1CAvasuDk+si5j/9HTXVK8Vi96YD99QtjARqDqqaWpkEuLj/YlYNunZ+P//M ex6+VwJUP0oln74mMaFpT+8zY77WyWIGOo+LbUSVWIozEg21mIuKEwGQv+VaogIAAA== X-Env-Sender: prvs=001e8c31d=roger.pau@citrix.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1468918700!24499784!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 39697 invoked from network); 19 Jul 2016 08:58:22 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-8.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 19 Jul 2016 08:58:22 -0000 X-IronPort-AV: E=Sophos;i="5.28,388,1464652800"; d="scan'208";a="373984487" From: Roger Pau Monne To: Date: Tue, 19 Jul 2016 10:58:15 +0200 Message-ID: <1468918695-2633-1-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.7.4 (Apple Git-66) MIME-Version: 1.0 X-DLP: MIA2 Cc: wei.liu2@citrix.com, Ian.Jackson@eu.citrix.com, Roger Pau Monne Subject: [Xen-devel] [PATCH v2] xl: add option to leave domain paused after migration X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is useful for debugging domains that crash on resume from migration. Signed-off-by: Roger Pau Monné Acked-by: Wei Liu --- Cc: Ian.Jackson@eu.citrix.com Cc: wei.liu2@citrix.com --- Changes since v1: - Document the newly added option in the xl man page. --- docs/man/xl.pod.1 | 4 ++++ tools/libxl/xl_cmdimpl.c | 29 +++++++++++++++++++---------- tools/libxl/xl_cmdtable.c | 3 ++- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1 index f4dc32c..f3a2bcb 100644 --- a/docs/man/xl.pod.1 +++ b/docs/man/xl.pod.1 @@ -443,6 +443,10 @@ Send instead of config file from creation. Print huge (!) amount of debug during the migration process. +=item B<-p> + +Leave the domain on the receive side paused after migration. + =back =item B [I] I I diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index d8530f0..fd80442 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -4742,7 +4742,7 @@ static void migrate_domain(uint32_t domid, const char *rune, int debug, exit(EXIT_FAILURE); } -static void migrate_receive(int debug, int daemonize, int monitor, +static void migrate_receive(int debug, int daemonize, int monitor, int pause, int send_fd, int recv_fd, libxl_checkpointed_stream checkpointed, char *colo_proxy_script) @@ -4850,8 +4850,10 @@ static void migrate_receive(int debug, int daemonize, int monitor, if (rc) goto perhaps_destroy_notify_rc; } - rc = libxl_domain_unpause(ctx, domid); - if (rc) goto perhaps_destroy_notify_rc; + if (!pause) { + rc = libxl_domain_unpause(ctx, domid); + if (rc) goto perhaps_destroy_notify_rc; + } fprintf(stderr, "migration target: Domain started successsfully.\n"); rc = 0; @@ -4965,7 +4967,7 @@ int main_restore(int argc, char **argv) int main_migrate_receive(int argc, char **argv) { - int debug = 0, daemonize = 1, monitor = 1; + int debug = 0, daemonize = 1, monitor = 1, pause = 0; libxl_checkpointed_stream checkpointed = LIBXL_CHECKPOINTED_STREAM_NONE; int opt; char *script = NULL; @@ -4976,7 +4978,7 @@ int main_migrate_receive(int argc, char **argv) COMMON_LONG_OPTS }; - SWITCH_FOREACH_OPT(opt, "Fedr", opts, "migrate-receive", 0) { + SWITCH_FOREACH_OPT(opt, "Fedrp", opts, "migrate-receive", 0) { case 'F': daemonize = 0; break; @@ -4996,13 +4998,16 @@ int main_migrate_receive(int argc, char **argv) case 0x200: script = optarg; break; + case 'p': + pause = 1; + break; } if (argc-optind != 0) { help("migrate-receive"); return EXIT_FAILURE; } - migrate_receive(debug, daemonize, monitor, + migrate_receive(debug, daemonize, monitor, pause, STDOUT_FILENO, STDIN_FILENO, checkpointed, script); @@ -5048,14 +5053,14 @@ int main_migrate(int argc, char **argv) const char *ssh_command = "ssh"; char *rune = NULL; char *host; - int opt, daemonize = 1, monitor = 1, debug = 0; + int opt, daemonize = 1, monitor = 1, debug = 0, pause = 0; static struct option opts[] = { {"debug", 0, 0, 0x100}, {"live", 0, 0, 0x200}, COMMON_LONG_OPTS }; - SWITCH_FOREACH_OPT(opt, "FC:s:e", opts, "migrate", 2) { + SWITCH_FOREACH_OPT(opt, "FC:s:ep", opts, "migrate", 2) { case 'C': config_filename = optarg; break; @@ -5069,6 +5074,9 @@ int main_migrate(int argc, char **argv) daemonize = 0; monitor = 0; break; + case 'p': + pause = 1; + break; case 0x100: /* --debug */ debug = 1; break; @@ -5096,12 +5104,13 @@ int main_migrate(int argc, char **argv) } else { verbose_len = (minmsglevel_default - minmsglevel) + 2; } - xasprintf(&rune, "exec %s %s xl%s%.*s migrate-receive%s%s", + xasprintf(&rune, "exec %s %s xl%s%.*s migrate-receive%s%s%s", ssh_command, host, pass_tty_arg ? " -t" : "", verbose_len, verbose_buf, daemonize ? "" : " -e", - debug ? " -d" : ""); + debug ? " -d" : "", + pause ? " -p" : ""); } migrate_domain(domid, rune, debug, config_filename); diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index bf69ffb..85c1e0f 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -164,7 +164,8 @@ struct cmd_spec cmd_table[] = { " migrate-receive [-d -e]\n" "-e Do not wait in the background (on ) for the death\n" " of the domain.\n" - "--debug Print huge (!) amount of debug during the migration process." + "--debug Print huge (!) amount of debug during the migration process.\n" + "-p Do not unpause domain after migrating it." }, { "restore", &main_restore, 0, 1,