From patchwork Thu Feb 17 08:57:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Tao X-Patchwork-Id: 83428 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 1F279B70F7 for ; Thu, 17 Feb 2011 20:00:24 +1100 (EST) Received: from localhost ([127.0.0.1]:44160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ppzin-0005Fw-IU for incoming@patchwork.ozlabs.org; Thu, 17 Feb 2011 04:00:21 -0500 Received: from [140.186.70.92] (port=51283 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpzfR-0004Z8-I9 for qemu-devel@nongnu.org; Thu, 17 Feb 2011 03:56:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PpzfQ-0007P0-Gw for qemu-devel@nongnu.org; Thu, 17 Feb 2011 03:56:53 -0500 Received: from [222.73.24.84] (port=51229 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PpzfQ-0007Mv-8M for qemu-devel@nongnu.org; Thu, 17 Feb 2011 03:56:52 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 688C41700BD for ; Thu, 17 Feb 2011 16:56:37 +0800 (CST) Received: from mailserver.fnst.cn.fujitus.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id p1H8ovuL004565 for ; Thu, 17 Feb 2011 16:50:57 +0800 Received: from localhost ([10.167.225.29]) by mailserver.fnst.cn.fujitus.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2011021716554056-159512 ; Thu, 17 Feb 2011 16:55:40 +0800 Date: Thu, 17 Feb 2011 16:57:48 +0800 From: Hu Tao To: qemu-devel-list Message-ID: <20110217085748.GA22623@localhost.localdomain> MIME-Version: 1.0 User-Agent: Mutt/1.5.21 (2010-09-15) X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-02-17 16:55:40, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-02-17 16:55:40, Serialize complete at 2011-02-17 16:55:40 Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: FreeBSD 6.x (1) X-Received-From: 222.73.24.84 Subject: [Qemu-devel] [PATCH] Add drive_add/drive_del to qmp_commands.hx 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 enables drive_add/drive_del qmp commands, which are required by libvirt when connecting to qemu using QMP. Signed-off-by: Hu Tao --- qmp-commands.hx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/qmp-commands.hx b/qmp-commands.hx index df40a3d..cf1cd13 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1774,3 +1774,62 @@ Example: EQMP + { + .name = "drive_add", + .args_type = "pci_addr:s,opts:s", + .params = "[[:]:]\n" + "[file=file][,if=type][,bus=n]\n" + "[,unit=m][,media=d][index=i]\n" + "[,cyls=c,heads=h,secs=s[,trans=t]]\n" + "[snapshot=on|off][,cache=on|off]", + + .help = "add drive to PCI storage controller", + .mhandler.cmd = drive_hot_add, + }, + +SQMP +drive_add +--------- + +Add drive to PCI storage controller. + +Arguments: + +- "pci_addr": pci address. +- "opts": options of the drive to be added. + +Example: + +-> { "execute": "drive_add", "arguments": { "pci_addr": "dummy", "opts": "file=/path/to/disk.img, if=none, id=drive-virtio-disk1, format=raw" } } +<- { "return": {} } + +EQMP + + { + .name = "drive_del", + .args_type = "id:s", + .params = "device", + .help = "remove host block device", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_drive_del, + }, + +SQMP +drive_del +--------- + +Remove host block device. The result is that guest generated IO is no longer +submitted against the host device underlying the disk. Once a drive has +been deleted, the QEMU Block layer returns -EIO which results in IO +errors in the guest for applications that are reading/writing to the device. + +Arguments: + +- "id": id of device to be removed. + +Examples: + +-> { "execute": "drive_del", "arguments": { "id": "drive-virtio-disk1"} } +<- { "return": {} } + +EQMP