[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/9] Add support for event tray moved of removable disks

On 03/12/2012 04:31 PM, Daniel Veillard wrote:
On Fri, Mar 09, 2012 at 06:49:20PM +0800, Osier Yang wrote:
On 2012年03月09日 16:55, Daniel Veillard wrote:
On Mon, Mar 05, 2012 at 06:25:39PM +0800, Osier Yang wrote:
This patch introduces a new event type for the QMP event
DEVICE_TRAY_MOVED, which occurs when the tray of a removable
disk is moved (i.e opened or closed):


The event's data includes the device alias and the tray's
status, which indicates whether the tray has been opened
or closed.  Thus the callback definition for the event is:

typedef void
(*virConnectDomainEventTrayMovedCallback)(virConnectPtr conn,
                                           virDomainPtr dom,
                                           const char *devAlias,
                                           unsigned int trayOpened,
                                           void *opaque);

   Hum ... could we make that slightly more generic.
Instead of just being able to report on tray opened or not (i.e. closed)
Let's report TrayChangeCallback,  and have an 'int reason' instead.

Hmm, yes, 'int reason' is good idea.

But for the name, TrayMoved might describe the real action more
precisely. Unlike DiskChange, it says there was some medium was
changed, TrayMoved only intends to report the tray status changeing
event, nothing really changed, or we can rename it to TrayStatusChange
to indicate the tray status is changed, but IMO it's not much
difference except getting a longer name. :-)

Then for example the API would be able to cope with more set of events,
one of the thing I can think of now would be the ability to emulate
multiple device in one as disk changers,

What does "emulate multiple device" mean? is it "s/device/event/"?

   Nahh, I was thinking of thinks like cdrom changers, where the
   enclosure can hold multiple disks and swap them. But in retrospect
   I dould we will have much need to emulate such hardware ever...

I see, :-)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]