[libvirt] [Qemu-devel] Close the BlockDriverState when guest eject the media

Eric Blake eblake at redhat.com
Fri Oct 24 18:32:50 UTC 2014


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 complete. The drive is
>>>> still not close.
>>>>
>>>> So the result of the monitor command "eject" is not to remove the medium 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?
>>
> 
> Cc'ing Eric for more attention.
> 
> 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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141024/7234e0e4/attachment-0001.sig>


More information about the libvir-list mailing list