From patchwork Mon Nov 2 13:41:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Schour X-Patchwork-Id: 37415 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 60B301007D2 for ; Tue, 3 Nov 2009 00:13:03 +1100 (EST) Received: from localhost ([127.0.0.1]:33725 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4whp-00009X-0M for incoming@patchwork.ozlabs.org; Mon, 02 Nov 2009 08:12:21 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N4wbj-0005sU-IZ for qemu-devel@nongnu.org; Mon, 02 Nov 2009 08:06:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N4wbZ-0005en-73 for qemu-devel@nongnu.org; Mon, 02 Nov 2009 08:05:57 -0500 Received: from [199.232.76.173] (port=54159 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4wbZ-0005eZ-2Q for qemu-devel@nongnu.org; Mon, 02 Nov 2009 08:05:53 -0500 Received: from mtagate7.de.ibm.com ([195.212.17.167]:60409) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N4wbX-0003s2-Rs for qemu-devel@nongnu.org; Mon, 02 Nov 2009 08:05:52 -0500 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate7.de.ibm.com (8.13.1/8.13.1) with ESMTP id nA2D5nxQ002575 for ; Mon, 2 Nov 2009 13:05:49 GMT Received: from d12av03.megacenter.de.ibm.com (d12av03.megacenter.de.ibm.com [9.149.165.213]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nA2D5nh01409178 for ; Mon, 2 Nov 2009 14:05:49 +0100 Received: from d12av03.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av03.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id nA2D5nUH022082 for ; Mon, 2 Nov 2009 14:05:49 +0100 Received: from localhost.localdomain (im4-64s.haifa.ibm.com [9.148.27.41]) by d12av03.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id nA2D5mi7022065; Mon, 2 Nov 2009 14:05:48 +0100 From: lirans@il.ibm.com To: qemu-devel@nongnu.org Date: Mon, 2 Nov 2009 15:41:13 +0200 Message-Id: <12571692732388-git-send-email-lirans@il.ibm.com> X-Mailer: git-send-email 1.5.2.4 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Liran Schour Subject: [Qemu-devel] [PATCH 3/3 v5] Enable migration without shared storage from the monitor X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds the option to activate non-shared storage migration from the monitor. The migration command is as follows: (qemu) migrate -d tcp:0:4444 # for ordinary live migration (qemu) migrate -d -b tcp:0:4444 # for live migration with complete storage copy (qemu) migrate -d -i tcp:0:4444 # for live migration with incremental storage copy, storage is cow based. Changes from v4: - Minor coding style issues. Signed-off-by: Liran Schour diff --git a/monitor.c b/monitor.c index 109ff5c..456b18e 100644 --- a/monitor.c +++ b/monitor.c @@ -2908,6 +2908,18 @@ static int default_fmt_size = 4; #define MAX_ARGS 16 +static int is_valid_option(const char *c, const char *typestr) +{ + char option[3]; + + option[0] = '-'; + option[1] = *c; + option[2] = '\0'; + + typestr = strstr(typestr, option); + return (typestr != NULL); +} + static const mon_cmd_t *monitor_parse_command(Monitor *mon, const char *cmdline, QDict *qdict) @@ -3100,7 +3112,8 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon, break; case '-': { - int has_option; + const char *tmp = p; + int has_option, skip_key = 0; /* option */ c = *typestr++; @@ -3111,13 +3124,22 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon, has_option = 0; if (*p == '-') { p++; - if (*p != c) { - monitor_printf(mon, "%s: unsupported option -%c\n", - cmdname, *p); - goto fail; + if(c != *p) { + if(!is_valid_option(p, typestr)) { + + monitor_printf(mon, "%s: unsupported option -%c\n", + cmdname, *p); + goto fail; + } else { + skip_key = 1; + } + } + if(skip_key) { + p = tmp; + } else { + p++; + has_option = 1; } - p++; - has_option = 1; } qdict_put(qdict, key, qint_from_int(has_option)); } diff --git a/qemu-monitor.hx b/qemu-monitor.hx index bb01c14..62e395b 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -724,16 +724,23 @@ ETEXI { .name = "migrate", - .args_type = "detach:-d,uri:s", - .params = "[-d] uri", - .help = "migrate to URI (using -d to not wait for completion)", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_migrate, + .args_type = "detach:-d,blk:-b,inc:-i,uri:s", + .params = "[-d] [-b] [-i] uri", + .help = "migrate to URI (using -d to not wait for completion)" + "\n\t\t\t -b for migration without shared storage with" + " full copy of disk\n\t\t\t -i for migration without " + "shared storage with incremental copy of disk " + "(base image shared between src and destination)", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_migrate, }, + STEXI -@item migrate [-d] @var{uri} +@item migrate [-d] [-b] [-i] @var{uri} Migrate to @var{uri} (using -d to not wait for completion). + -b for migration with full copy of disk + -i for migration with incremental copy of disk (base image is shared) ETEXI {