Received: from eggs.gnu.org ([2001:4830:134:3::10]:54825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3f2C-0005T3-SQ for qemu-devel@nongnu.org; Mon, 29 Jul 2013 00:26:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3f26-0005yA-RU for qemu-devel@nongnu.org; Mon, 29 Jul 2013 00:26:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3f26-0005y5-IB for qemu-devel@nongnu.org; Mon, 29 Jul 2013 00:26:06 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6T4Q5Nr011257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 29 Jul 2013 00:26:06 -0400 From: Fam Zheng Date: Mon, 29 Jul 2013 12:25:32 +0800 Message-Id: <1375071932-31627-5-git-send-email-famz@redhat.com> In-Reply-To: <1375071932-31627-1-git-send-email-famz@redhat.com> References: <1375071932-31627-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [RFC PATCH 4/4] hmp: add -s switch to nbd_server_add List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com, imain@redhat.com, stefanha@redhat.com, pbonzini@redhat.com The switch is equivalent to "snapshot=on" option in QMP nbd-server-add. Signed-off-by: Fam Zheng --- hmp-commands.hx | 4 ++-- hmp.c | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 8c6b91a..2cbd717 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1382,8 +1382,8 @@ ETEXI { .name = "nbd_server_add", - .args_type = "writable:-w,device:B", - .params = "nbd_server_add [-w] device", + .args_type = "writable:-w,snapshot:-s,device:B", + .params = "nbd_server_add [-w] [-s] device", .help = "export a block device via NBD", .mhandler.cmd = hmp_nbd_server_add, }, diff --git a/hmp.c b/hmp.c index 5cc97fe..03d668b 100644 --- a/hmp.c +++ b/hmp.c @@ -1440,8 +1440,8 @@ void hmp_nbd_server_start(Monitor *mon, const QDict *qdict) continue; } - qmp_nbd_server_add(info->value->device, true, writable, false, false, - &local_err); + qmp_nbd_server_add(info->value->device, true, writable, + true, false, &local_err); if (local_err != NULL) { qmp_nbd_server_stop(NULL); @@ -1459,9 +1459,11 @@ void hmp_nbd_server_add(Monitor *mon, const QDict *qdict) { const char *device = qdict_get_str(qdict, "device"); int writable = qdict_get_try_bool(qdict, "writable", 0); + int snapshot = qdict_get_try_bool(qdict, "snapshot", 0); Error *local_err = NULL; - qmp_nbd_server_add(device, true, writable, false, false, &local_err); + qmp_nbd_server_add(device, true, writable, + true, snapshot, &local_err); if (local_err != NULL) { hmp_handle_error(mon, &local_err); -- 1.8.3.4