From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhjgD-0005af-PA for qemu-devel@nongnu.org; Fri, 24 Oct 2014 14:33:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xhjg8-0006iU-Ns for qemu-devel@nongnu.org; Fri, 24 Oct 2014 14:33:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7468) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xhjg8-0006i6-GB for qemu-devel@nongnu.org; Fri, 24 Oct 2014 14:33:36 -0400 Message-ID: <544A9B52.504@redhat.com> Date: Fri, 24 Oct 2014 12:32:50 -0600 From: Eric Blake MIME-Version: 1.0 References: <54423AC9.2030302@huawei.com> <20141020094149.GC3585@noname.redhat.com> <5444F1B2.9090700@huawei.com> <20141020113947.GH3585@noname.redhat.com> <5445F4CF.9050307@huawei.com> <5445F8F2.9080509@huawei.com> In-Reply-To: <5445F8F2.9080509@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="noIq8tuVVo3UKPHA6muBnCoqasvswqf85" Subject: Re: [Qemu-devel] Close the BlockDriverState when guest eject the media List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gonglei , Weidong Huang Cc: libvir-list@redhat.com, Kevin Wolf , "qemu-devel@nongnu.org" , stefanha@redhat.com, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --noIq8tuVVo3UKPHA6muBnCoqasvswqf85 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/21/2014 12:10 AM, Gonglei wrote: >>>> There is a problem. >>>> >>>> 1. Qemu receive the "eject" command. >>>> 2. Runs "eject_request_cb" when an eject request is issued from the = monitor, the tray >>>> is closed, and the medium is locked. But the drive is not closed. >>>> 3. Guest agree with opening tray and qemu will call bdrv_eject to co= mplete. The drive is >>>> still not close. >>>> >>>> So the result of the monitor command "eject" is not to remove the me= dium in this situation. >>> >>> Now I understand, thanks for explaining. >>> >>> But I think libvirt can actually work correctly with what qemu offers= >>> today. qemu returns an error if the medium cannot be removed with the= >>> 'eject' command and it only sends an eject request to the guest. This whole area of interaction is messy, and this is not the first time someone has tried to improve it. Is qemu actually issuing an error message in this case, and is it distinguishable from other errors? >>> >>> With this error, libvirt can know that the DEVICE_TRAY_MOVED event >>> doesn't mean that the medium has removed, but that it needs to issue >>> another 'eject' command. >>> >>> If this isn't implemented correctly in libvirt today, this needs a >>> libvirt fix rather than a qemu one. Yes, patching libvirt to recognize this situation and try a second time to remove the disk from the tray once the guest has opened the try, in order to completely close out the drive, makes sense. >>> >> >> >> hi all! >> >> How about fix it in libvirt? >> >=20 > Cc'ing Eric for more attention. >=20 > Maybe He can give you some suggestion :) At this point, it may be best to make sure there is a bugzilla entry against libvirt, to make sure it is not forgotten. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --noIq8tuVVo3UKPHA6muBnCoqasvswqf85 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUSptSAAoJEKeha0olJ0NqaRIH/2PxMXP1xAs0XLGTeu4N2E9I yRfP8VxD4BqzRsi75Rv/jmIL+9l3E7whLu94F8177md9VU32Tg04JM3uJjiOwJ2e imGrYridKIpyP60FDYmar/Qklc43CAwIpEat0MSbAh86KnWjC9StcuvBwkOyG0Zi PY7mHKDzZbSEH2OmhgqUZckCtgzfg6L9b+s5nEZBLFmavo59co27tPISRkYAd8KY 7UZrYQZt7+mXitoYNwOr0JwOax6ncxcugQomOr+w23qWrsw1Oo/0hppKsaI8KYMy ghy8bBaa8fqhAUfWIIlwSjJ+wr8iRVBPPWW8zz47RSybmdoDRZYDJCdCfRaWf9c= =gOMg -----END PGP SIGNATURE----- --noIq8tuVVo3UKPHA6muBnCoqasvswqf85--