From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55526 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pq2fu-0006Ds-4C for qemu-devel@nongnu.org; Thu, 17 Feb 2011 07:09:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pq2fs-0000tA-Py for qemu-devel@nongnu.org; Thu, 17 Feb 2011 07:09:34 -0500 Received: from mail-vx0-f173.google.com ([209.85.220.173]:63457) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pq2fs-0000sv-HV for qemu-devel@nongnu.org; Thu, 17 Feb 2011 07:09:32 -0500 Received: by vxb40 with SMTP id 40so1096952vxb.4 for ; Thu, 17 Feb 2011 04:09:31 -0800 (PST) Message-ID: <4D5D0FE4.1030603@codemonkey.ws> Date: Thu, 17 Feb 2011 06:09:08 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Add drive_add/drive_del to qmp_commands.hx References: <20110217085748.GA22623@localhost.localdomain> In-Reply-To: <20110217085748.GA22623@localhost.localdomain> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: qemu-devel-list On 02/17/2011 02:57 AM, Hu Tao wrote: > 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" } } > QMP command should not take encoded arguments. Regards, Anthony Liguori > +<- { "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 >