[libvirt] [PATCH 0/2] Introduce two new virsh commands

Osier Yang jyang at redhat.com
Mon Dec 19 04:41:08 UTC 2011


On 2011年06月30日 00:26, Eric Blake wrote:
> On 06/29/2011 06:19 AM, Osier Yang wrote:
>> These two patches is to introduce two new virsh commands, one is
>> eject-media, which is to eject media from CD or floppy drive, the other
>> is insert-media, which is to insert media into CD or floppy drive.
>>
>> There are commands existed can be used to eject/insert media, such as
>> "update-device", but it's not quite easy to use. That's the original
>> intention of these patches.
>>
>> Both of the two commands only allow to operate on CDROM or floppy disk.
>>
>> [PATCH 1/2] virsh: Introduce two new commands to insert or eject media
>> [PATCH 2/2] doc: Add docs for two new introduced commands
>
> I think that we will eventually need even more; therefore, I'm thinking
> a more generic 'change-disk' command would be better than two specific
> 'eject-media' and 'insert-media' commands.  Recent qemu added [1]:
>
>   o blockdev-tray-open: opens the drive tray. Also Supports removing the
> inserted
>     media. The BLOCK_TRAY_OPEN event is emitted if this command succeeds.
>   o blockdev-tray-close: closes a drive tray. The BLOCK_TRAY_CLOSE event is
>     emitted.
>   o blockdev-media-insert: Inserts a media in the tray. The tray must empty
>     and already opened. No event is emitted.
>
> along with updating to 'eject' and 'change' in terms of these more
> fundamental operations.
>
> [1] http://lists.nongnu.org/archive/html/qemu-devel/2011-06/msg00381.html

There is no news for the these qemu patches since June. Should we
still wait for that?

We don't have to wait for the qemu patches if we seperate the media
and tray management in virsh. i.e.

     insert-media & eject-media: for media management.
     tray-open & tray-close: for tray management (in future)

     OR

     change-media: for media management
     change-tray: for tray management

Before the qemu introduce news monitor commands for media management,
we can use current updateDeviceFlags API (which uses qemu's "change"),
after the qemu commands for media management is introduced, we can
add a simple switch to honor them. (Of course, we need to introduce
new events support if qemu supports to emit events, but that's a
separate work from virsh's point of view).

On the other hand, from a user's point of view, separating management
of media and tray could be more clear. However, having all the
management scenarios for both tray and media in one command could be
a bit confused.

Thoughts?

Regards,
Osier




More information about the libvir-list mailing list