From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46658 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFX3a-0005Ia-09 for qemu-devel@nongnu.org; Mon, 08 Nov 2010 14:07:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFX3Y-0002Ak-Ep for qemu-devel@nongnu.org; Mon, 08 Nov 2010 14:07:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PFX3Y-0002Ab-4u for qemu-devel@nongnu.org; Mon, 08 Nov 2010 14:07:04 -0500 Date: Mon, 8 Nov 2010 19:06:56 +0000 From: "Daniel P. Berrange" Subject: Re: [Qemu-devel] [PATCH 0/3] v4 Decouple block device removal from device removal Message-ID: <20101108190656.GG26714@redhat.com> References: <20101105162218.GM22381@us.ibm.com> <20101108021926.GV22381@us.ibm.com> <20101108104906.GA855@redhat.com> <20101108140250.GW22381@us.ibm.com> <20101108165602.GF7962@redhat.com> <20101108183901.GB22381@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101108183901.GB22381@us.ibm.com> Reply-To: "Daniel P. Berrange" List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ryan Harper Cc: Kevin Wolf , yamahata@valinux.co.jp, "Michael S. Tsirkin" , qemu-devel@nongnu.org, Markus Armbruster , Anthony Liguori , Stefan Hajnoczi On Mon, Nov 08, 2010 at 12:39:01PM -0600, Ryan Harper wrote: > * Michael S. Tsirkin [2010-11-08 10:57]: > > On Mon, Nov 08, 2010 at 08:02:50AM -0600, Ryan Harper wrote: > > > * Markus Armbruster [2010-11-08 06:04]: > > > > "Michael S. Tsirkin" writes: > > > > > > > > > On Mon, Nov 08, 2010 at 11:32:01AM +0100, Markus Armbruster wrote: > > > > Daniel, I'd like your input here: can you live with > > device diappearing from info block and parsing > > qdev tree info to figure out whether device is really gone? > > AFAICT, libvirt doesn't look at or use info block at all. > > I'd rather not have to add info block to libvirt; but currently I can't > see how else we can determine if we should call drive_unplug if we do a > device_del() and the guest removes it before we call drive_unplug(). > > What happens is that the guest removes the device and when we call > drive_unplug() it fails to find the target device (since it was deleted > by the guest). Then we fail the PCiDelDisk and libvirt keeps the device > config around even though the guest has finished removing it. This needs drive_unplug to return an explicitly identifiable 'no such device' error code, which libvirt can catch and ignore. Making the call to drive_unplug conditional on a check to query-block/query-qdev is really a bug, because it has an designed in race condition which means you need to check for a 'no such device' error code regardless. So it is better to just blindly call drive_unplug and handle the non-fatal failure conditions every time - this ensures that codepath gets exercised more frequently too :-) Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|