From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=38878 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFoGS-0003Fo-GG for qemu-devel@nongnu.org; Tue, 09 Nov 2010 08:29:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFoGR-0008FU-7q for qemu-devel@nongnu.org; Tue, 09 Nov 2010 08:29:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:12203) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PFoGQ-0008DZ-Vz for qemu-devel@nongnu.org; Tue, 09 Nov 2010 08:29:31 -0500 Date: Tue, 9 Nov 2010 15:29:14 +0200 From: "Michael S. Tsirkin" Message-ID: <20101109132914.GG22705@redhat.com> References: <1289269554-6766-1-git-send-email-ryanh@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1289269554-6766-1-git-send-email-ryanh@us.ibm.com> Subject: [Qemu-devel] Re: [PATCH 0/2] v6 Decouple block device removal from device removal List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ryan Harper Cc: Kevin Wolf , qemu-devel@nongnu.org, Markus Armbruster , Anthony Liguori , Stefan Hajnoczi On Mon, Nov 08, 2010 at 08:25:52PM -0600, Ryan Harper wrote: > After *much* discussion, here's version 6. > > This patch series decouples the detachment of a block device from the removal > of the backing pci-device. Removal of a hotplugged pci device requires the > guest to respond before qemu tears down the block device. In some cases, the > guest may not respond leaving the guest with continued access to the block > device. > > The new monitor command, drive_del, will revoke a guests access to the > block device independently of the removal of the pci device. > > The first patch implements drive_del and bdrv_unplug, the second patch > implements the qmp version of the monitor command. > > Changes since v5: > - Removed dangling pointers in guest and host state. This ensures things like > info block no longer displays the deleted drive; though info pci will > continue to display the pci device until the guest responds to the removal > request. > - Renamed drive_unplug -> drive_del > Changes since v4: > - Droppped drive_get_by_id patch and use bdrv_find() instead > - Added additional details about drive_unplug to hmp/qmp interface > > Changes since v3: > - Moved QMP command for drive_unplug() to separate patch > > Changes since v2: > - Added QMP command for drive_unplug() > > Changes since v1: > - CodingStyle fixes > - Added qemu_aio_flush() to bdrv_unplug() > > Signed-off-by: Ryan Harper Acked-by: Michael S. Tsirkin I note that to complete the fix we will need a way for management to check whether the device has been ejected by guest. Quoting a proposal by Daniel: We don't use info block for anything. Having to parse the full qdev tree to determine if a single device is gone seems rather tedious. It would be better if query-qdev took an optional argument, which is the name of the device to root the tree at. Then checking whether a device named 'foo' is gone just means running 'query-qdev foo' and seeing if that returns an error about the device not existing, then we know it has gone. No need to parse anything. Being able to query the qdev data for a single device, or sub-tree of devices seems useful in its own right. -- MST