All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] RFC: QMP event notification for disk media eject
@ 2011-01-11 13:11 Luiz Capitulino
  2011-01-11 13:28 ` [Qemu-devel] " Kevin Wolf
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Luiz Capitulino @ 2011-01-11 13:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, stefanha, Markus Armbruster

Hi there,

I need feedback on a new QMP event.

Problem
=======

There's no way for a management tool to detect that a guest OS has ejected the
media in a CDROM or Floppy disk drive (I'm discarding polling, because it's
undesirable at best).

The end result is that the management tool can get confused, this is happening
with libvirt when migration is involved: if the guest is saved/restored or
migrated, then libvirt will start the guest again with media still present.

NOTE: Most of the analysis here was done by Daniel Berrange.

Solution
========

We need a new QMP event to solve that. There are two possible events, a
general one and a very specific one.

There are 3 scenarios in which both events should be emitted:

 1. When guest OS ejects media
 2. When 'eject' monitor command is run
 3. When 'change' monitor command is run

BLOCK_MEDIA_CHANGE
------------------

This is the general event, it's emitted when any removable block device
is changed.

Ideally, the event should contain two pieces of info:

 - qdev device name
 - new file path (to allow distinguishing eject from change)

Example:

  { "event": "BLOCK_MEDIA_CHANGE", "data": { "qdev-id": "myid",
                                             "new-path": "/foo/bar/dir/distro.iso" },
                                             ... }

BLOCK_MEDIA_EJECT
-----------------

This event is only emitted when a CDROM or a floppy disk is ejected.

The event contains one info one:

 - device name

Example:

  { "event": "BLOCK_MEDIA_EJECT", "data": { "device-name": "ide1-cd0" }, ... }

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] Re: RFC: QMP event notification for disk media eject
  2011-01-11 13:11 [Qemu-devel] RFC: QMP event notification for disk media eject Luiz Capitulino
@ 2011-01-11 13:28 ` Kevin Wolf
  2011-01-11 17:45   ` Luiz Capitulino
  2011-01-11 14:06 ` Anthony Liguori
  2011-01-11 14:13 ` [Qemu-devel] " Markus Armbruster
  2 siblings, 1 reply; 9+ messages in thread
From: Kevin Wolf @ 2011-01-11 13:28 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: stefanha, qemu-devel, Markus Armbruster

Am 11.01.2011 14:11, schrieb Luiz Capitulino:
> Hi there,
> 
> I need feedback on a new QMP event.
> 
> Problem
> =======
> 
> There's no way for a management tool to detect that a guest OS has ejected the
> media in a CDROM or Floppy disk drive (I'm discarding polling, because it's
> undesirable at best).
> 
> The end result is that the management tool can get confused, this is happening
> with libvirt when migration is involved: if the guest is saved/restored or
> migrated, then libvirt will start the guest again with media still present.
> 
> NOTE: Most of the analysis here was done by Daniel Berrange.
> 
> Solution
> ========
> 
> We need a new QMP event to solve that. There are two possible events, a
> general one and a very specific one.
> 
> There are 3 scenarios in which both events should be emitted:
> 
>  1. When guest OS ejects media
>  2. When 'eject' monitor command is run
>  3. When 'change' monitor command is run
> 
> BLOCK_MEDIA_CHANGE
> ------------------
> 
> This is the general event, it's emitted when any removable block device
> is changed.
> 
> Ideally, the event should contain two pieces of info:
> 
>  - qdev device name

Is there a reason why you use the device name instead of the drive
name/blockdev ID here?

>  - new file path (to allow distinguishing eject from change)

How do you distinguish? Would this key be missing for ejects? An empty
string? Something else?

> Example:
> 
>   { "event": "BLOCK_MEDIA_CHANGE", "data": { "qdev-id": "myid",
>                                              "new-path": "/foo/bar/dir/distro.iso" },
>                                              ... }
> 
> BLOCK_MEDIA_EJECT
> -----------------
> 
> This event is only emitted when a CDROM or a floppy disk is ejected.
> 
> The event contains one info one:
> 
>  - device name
> 
> Example:
> 
>   { "event": "BLOCK_MEDIA_EJECT", "data": { "device-name": "ide1-cd0" }, ... }

I think it's called drive name in most other places.

Kevin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] Re: RFC: QMP event notification for disk media eject
  2011-01-11 13:11 [Qemu-devel] RFC: QMP event notification for disk media eject Luiz Capitulino
  2011-01-11 13:28 ` [Qemu-devel] " Kevin Wolf
@ 2011-01-11 14:06 ` Anthony Liguori
  2011-01-11 14:29   ` Markus Armbruster
  2011-01-11 14:13 ` [Qemu-devel] " Markus Armbruster
  2 siblings, 1 reply; 9+ messages in thread
From: Anthony Liguori @ 2011-01-11 14:06 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: kwolf, stefanha, qemu-devel, Markus Armbruster

On 01/11/2011 07:11 AM, Luiz Capitulino wrote:
> Hi there,
>
> I need feedback on a new QMP event.
>
> Problem
> =======
>
> There's no way for a management tool to detect that a guest OS has ejected the
> media in a CDROM or Floppy disk drive (I'm discarding polling, because it's
> undesirable at best).
>
> The end result is that the management tool can get confused, this is happening
> with libvirt when migration is involved: if the guest is saved/restored or
> migrated, then libvirt will start the guest again with media still present.
>
> NOTE: Most of the analysis here was done by Daniel Berrange.
>
> Solution
> ========
>
> We need a new QMP event to solve that. There are two possible events, a
> general one and a very specific one.
>
> There are 3 scenarios in which both events should be emitted:
>
>   1. When guest OS ejects media
>   2. When 'eject' monitor command is run
>   3. When 'change' monitor command is run
>
> BLOCK_MEDIA_CHANGE
> ------------------
>
> This is the general event, it's emitted when any removable block device
> is changed.
>
> Ideally, the event should contain two pieces of info:
>
>   - qdev device name
>   - new file path (to allow distinguishing eject from change)
>
> Example:
>
>    { "event": "BLOCK_MEDIA_CHANGE", "data": { "qdev-id": "myid",
>                                               "new-path": "/foo/bar/dir/distro.iso" },
>                                               ... }
>    

I think this is short sighted as block devices are not simply expressed 
in terms of new-path.  You would need to do something like:

{ 'blockdev': {'file': '/foo/bar/dir/distro.iso', 'cache', 'off', ...}}

And that adds a lot of complexity that I'm not sure is really 
justified.  Tray status is really what you're interested in.  The user 
cannot directly change the media, only the management tools can so why 
would the management tools need to be notified about something that they 
did?

Regards,

Anthony Liguori

> BLOCK_MEDIA_EJECT
> -----------------
>
> This event is only emitted when a CDROM or a floppy disk is ejected.
>
> The event contains one info one:
>
>   - device name
>
> Example:
>
>    { "event": "BLOCK_MEDIA_EJECT", "data": { "device-name": "ide1-cd0" }, ... }
>    

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] RFC: QMP event notification for disk media eject
  2011-01-11 13:11 [Qemu-devel] RFC: QMP event notification for disk media eject Luiz Capitulino
  2011-01-11 13:28 ` [Qemu-devel] " Kevin Wolf
  2011-01-11 14:06 ` Anthony Liguori
@ 2011-01-11 14:13 ` Markus Armbruster
  2011-01-11 17:53   ` Luiz Capitulino
  2 siblings, 1 reply; 9+ messages in thread
From: Markus Armbruster @ 2011-01-11 14:13 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: kwolf, stefanha, qemu-devel

Luiz Capitulino <lcapitulino@redhat.com> writes:

> Hi there,
>
> I need feedback on a new QMP event.
>
> Problem
> =======
>
> There's no way for a management tool to detect that a guest OS has ejected the
> media in a CDROM or Floppy disk drive (I'm discarding polling, because it's
> undesirable at best).
>
> The end result is that the management tool can get confused, this is happening
> with libvirt when migration is involved: if the guest is saved/restored or
> migrated, then libvirt will start the guest again with media still present.
>
> NOTE: Most of the analysis here was done by Daniel Berrange.
>
> Solution
> ========
>
> We need a new QMP event to solve that. There are two possible events, a
> general one and a very specific one.
>
> There are 3 scenarios in which both events should be emitted:
>
>  1. When guest OS ejects media
>  2. When 'eject' monitor command is run
>  3. When 'change' monitor command is run
>
> BLOCK_MEDIA_CHANGE
> ------------------
>
> This is the general event, it's emitted when any removable block device
> is changed.
>
> Ideally, the event should contain two pieces of info:
>
>  - qdev device name
>  - new file path (to allow distinguishing eject from change)
>
> Example:
>
>   { "event": "BLOCK_MEDIA_CHANGE", "data": { "qdev-id": "myid",
>                                              "new-path": "/foo/bar/dir/distro.iso" },
>                                              ... }

What if a host block device that isn't currently connected to a qdev
goes through a media change?

What if the connected qdev doesn't have an ID?

> BLOCK_MEDIA_EJECT
> -----------------
>
> This event is only emitted when a CDROM or a floppy disk is ejected.
>
> The event contains one info one:
>
>  - device name
>
> Example:
>
>   { "event": "BLOCK_MEDIA_EJECT", "data": { "device-name": "ide1-cd0" }, ... }

What makes CD-ROM and floppy special?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Re: RFC: QMP event notification for disk media eject
  2011-01-11 14:06 ` Anthony Liguori
@ 2011-01-11 14:29   ` Markus Armbruster
  2011-01-11 17:47     ` Luiz Capitulino
  0 siblings, 1 reply; 9+ messages in thread
From: Markus Armbruster @ 2011-01-11 14:29 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kwolf, stefanha, qemu-devel, Luiz Capitulino

Anthony Liguori <anthony@codemonkey.ws> writes:

> On 01/11/2011 07:11 AM, Luiz Capitulino wrote:
>> Hi there,
>>
>> I need feedback on a new QMP event.
>>
>> Problem
>> =======
>>
>> There's no way for a management tool to detect that a guest OS has ejected the
>> media in a CDROM or Floppy disk drive (I'm discarding polling, because it's
>> undesirable at best).
>>
>> The end result is that the management tool can get confused, this is happening
>> with libvirt when migration is involved: if the guest is saved/restored or
>> migrated, then libvirt will start the guest again with media still present.
>>
>> NOTE: Most of the analysis here was done by Daniel Berrange.
>>
>> Solution
>> ========
>>
>> We need a new QMP event to solve that. There are two possible events, a
>> general one and a very specific one.
>>
>> There are 3 scenarios in which both events should be emitted:
>>
>>   1. When guest OS ejects media
>>   2. When 'eject' monitor command is run
>>   3. When 'change' monitor command is run
>>
>> BLOCK_MEDIA_CHANGE
>> ------------------
>>
>> This is the general event, it's emitted when any removable block device
>> is changed.
>>
>> Ideally, the event should contain two pieces of info:
>>
>>   - qdev device name
>>   - new file path (to allow distinguishing eject from change)
>>
>> Example:
>>
>>    { "event": "BLOCK_MEDIA_CHANGE", "data": { "qdev-id": "myid",
>>                                               "new-path": "/foo/bar/dir/distro.iso" },
>>                                               ... }
>>    
>
> I think this is short sighted as block devices are not simply
> expressed in terms of new-path.  You would need to do something like:
>
> { 'blockdev': {'file': '/foo/bar/dir/distro.iso', 'cache', 'off', ...}}
>
> And that adds a lot of complexity that I'm not sure is really
> justified.  Tray status is really what you're interested in.

I figure the important bit is the notification that tray status changed.
If management software wants to know more, it can query when it gets the
event.

>                                                               The user
> cannot directly change the media, only the management tools can so why
> would the management tools need to be notified about something that
> they did?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] Re: RFC: QMP event notification for disk media eject
  2011-01-11 13:28 ` [Qemu-devel] " Kevin Wolf
@ 2011-01-11 17:45   ` Luiz Capitulino
  2011-01-11 18:21     ` Daniel P. Berrange
  0 siblings, 1 reply; 9+ messages in thread
From: Luiz Capitulino @ 2011-01-11 17:45 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: stefanha, qemu-devel, Markus Armbruster

On Tue, 11 Jan 2011 14:28:23 +0100
Kevin Wolf <kwolf@redhat.com> wrote:

> Am 11.01.2011 14:11, schrieb Luiz Capitulino:
> > Hi there,
> > 
> > I need feedback on a new QMP event.
> > 
> > Problem
> > =======
> > 
> > There's no way for a management tool to detect that a guest OS has ejected the
> > media in a CDROM or Floppy disk drive (I'm discarding polling, because it's
> > undesirable at best).
> > 
> > The end result is that the management tool can get confused, this is happening
> > with libvirt when migration is involved: if the guest is saved/restored or
> > migrated, then libvirt will start the guest again with media still present.
> > 
> > NOTE: Most of the analysis here was done by Daniel Berrange.
> > 
> > Solution
> > ========
> > 
> > We need a new QMP event to solve that. There are two possible events, a
> > general one and a very specific one.
> > 
> > There are 3 scenarios in which both events should be emitted:
> > 
> >  1. When guest OS ejects media
> >  2. When 'eject' monitor command is run
> >  3. When 'change' monitor command is run
> > 
> > BLOCK_MEDIA_CHANGE
> > ------------------
> > 
> > This is the general event, it's emitted when any removable block device
> > is changed.
> > 
> > Ideally, the event should contain two pieces of info:
> > 
> >  - qdev device name
> 
> Is there a reason why you use the device name instead of the drive
> name/blockdev ID here?

Good question, this is a copy & paste from Daniel initial request, so
he's the best person to answer that question.

> >  - new file path (to allow distinguishing eject from change)
> 
> How do you distinguish? Would this key be missing for ejects? An empty
> string? Something else?

Yes, I think it would be optional and thus only part of the change
command.

> > Example:
> > 
> >   { "event": "BLOCK_MEDIA_CHANGE", "data": { "qdev-id": "myid",
> >                                              "new-path": "/foo/bar/dir/distro.iso" },
> >                                              ... }
> > 
> > BLOCK_MEDIA_EJECT
> > -----------------
> > 
> > This event is only emitted when a CDROM or a floppy disk is ejected.
> > 
> > The event contains one info one:
> > 
> >  - device name
> > 
> > Example:
> > 
> >   { "event": "BLOCK_MEDIA_EJECT", "data": { "device-name": "ide1-cd0" }, ... }
> 
> I think it's called drive name in most other places.

Ok, please note that we won't implement both events, we have to choose
one or the other.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Re: RFC: QMP event notification for disk media eject
  2011-01-11 14:29   ` Markus Armbruster
@ 2011-01-11 17:47     ` Luiz Capitulino
  0 siblings, 0 replies; 9+ messages in thread
From: Luiz Capitulino @ 2011-01-11 17:47 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: kwolf, stefanha, qemu-devel

On Tue, 11 Jan 2011 15:29:12 +0100
Markus Armbruster <armbru@redhat.com> wrote:

> Anthony Liguori <anthony@codemonkey.ws> writes:
> 
> > On 01/11/2011 07:11 AM, Luiz Capitulino wrote:
> >> Hi there,
> >>
> >> I need feedback on a new QMP event.
> >>
> >> Problem
> >> =======
> >>
> >> There's no way for a management tool to detect that a guest OS has ejected the
> >> media in a CDROM or Floppy disk drive (I'm discarding polling, because it's
> >> undesirable at best).
> >>
> >> The end result is that the management tool can get confused, this is happening
> >> with libvirt when migration is involved: if the guest is saved/restored or
> >> migrated, then libvirt will start the guest again with media still present.
> >>
> >> NOTE: Most of the analysis here was done by Daniel Berrange.
> >>
> >> Solution
> >> ========
> >>
> >> We need a new QMP event to solve that. There are two possible events, a
> >> general one and a very specific one.
> >>
> >> There are 3 scenarios in which both events should be emitted:
> >>
> >>   1. When guest OS ejects media
> >>   2. When 'eject' monitor command is run
> >>   3. When 'change' monitor command is run
> >>
> >> BLOCK_MEDIA_CHANGE
> >> ------------------
> >>
> >> This is the general event, it's emitted when any removable block device
> >> is changed.
> >>
> >> Ideally, the event should contain two pieces of info:
> >>
> >>   - qdev device name
> >>   - new file path (to allow distinguishing eject from change)
> >>
> >> Example:
> >>
> >>    { "event": "BLOCK_MEDIA_CHANGE", "data": { "qdev-id": "myid",
> >>                                               "new-path": "/foo/bar/dir/distro.iso" },
> >>                                               ... }
> >>    
> >
> > I think this is short sighted as block devices are not simply
> > expressed in terms of new-path.  You would need to do something like:
> >
> > { 'blockdev': {'file': '/foo/bar/dir/distro.iso', 'cache', 'off', ...}}
> >
> > And that adds a lot of complexity that I'm not sure is really
> > justified.  Tray status is really what you're interested in.
> 
> I figure the important bit is the notification that tray status changed.
> If management software wants to know more, it can query when it gets the
> event.

Which means you're in favor of the BLOCK_MEDIA_EJECT event, right?

> 
> >                                                               The user
> > cannot directly change the media, only the management tools can so why
> > would the management tools need to be notified about something that
> > they did?
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] RFC: QMP event notification for disk media eject
  2011-01-11 14:13 ` [Qemu-devel] " Markus Armbruster
@ 2011-01-11 17:53   ` Luiz Capitulino
  0 siblings, 0 replies; 9+ messages in thread
From: Luiz Capitulino @ 2011-01-11 17:53 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: kwolf, stefanha, qemu-devel

On Tue, 11 Jan 2011 15:13:40 +0100
Markus Armbruster <armbru@redhat.com> wrote:

> Luiz Capitulino <lcapitulino@redhat.com> writes:
> 
> > Hi there,
> >
> > I need feedback on a new QMP event.
> >
> > Problem
> > =======
> >
> > There's no way for a management tool to detect that a guest OS has ejected the
> > media in a CDROM or Floppy disk drive (I'm discarding polling, because it's
> > undesirable at best).
> >
> > The end result is that the management tool can get confused, this is happening
> > with libvirt when migration is involved: if the guest is saved/restored or
> > migrated, then libvirt will start the guest again with media still present.
> >
> > NOTE: Most of the analysis here was done by Daniel Berrange.
> >
> > Solution
> > ========
> >
> > We need a new QMP event to solve that. There are two possible events, a
> > general one and a very specific one.
> >
> > There are 3 scenarios in which both events should be emitted:
> >
> >  1. When guest OS ejects media
> >  2. When 'eject' monitor command is run
> >  3. When 'change' monitor command is run
> >
> > BLOCK_MEDIA_CHANGE
> > ------------------
> >
> > This is the general event, it's emitted when any removable block device
> > is changed.
> >
> > Ideally, the event should contain two pieces of info:
> >
> >  - qdev device name
> >  - new file path (to allow distinguishing eject from change)
> >
> > Example:
> >
> >   { "event": "BLOCK_MEDIA_CHANGE", "data": { "qdev-id": "myid",
> >                                              "new-path": "/foo/bar/dir/distro.iso" },
> >                                              ... }
> 
> What if a host block device that isn't currently connected to a qdev
> goes through a media change?
> 
> What if the connected qdev doesn't have an ID?

We could add the blockdev id too.

> > BLOCK_MEDIA_EJECT
> > -----------------
> >
> > This event is only emitted when a CDROM or a floppy disk is ejected.
> >
> > The event contains one info one:
> >
> >  - device name
> >
> > Example:
> >
> >   { "event": "BLOCK_MEDIA_EJECT", "data": { "device-name": "ide1-cd0" }, ... }
> 
> What makes CD-ROM and floppy special?

Those are the only devices that support the eject operation (or have a tray
status? Sorry for my bad terminology) and are the ones that we have a concrete
use case to handle.

We might want to be more general, but it does have a complexity cost and
its possible user cases are theoretical IMHO.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] Re: RFC: QMP event notification for disk media eject
  2011-01-11 17:45   ` Luiz Capitulino
@ 2011-01-11 18:21     ` Daniel P. Berrange
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrange @ 2011-01-11 18:21 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: Kevin Wolf, stefanha, qemu-devel, Markus Armbruster

On Tue, Jan 11, 2011 at 03:45:49PM -0200, Luiz Capitulino wrote:
> On Tue, 11 Jan 2011 14:28:23 +0100
> Kevin Wolf <kwolf@redhat.com> wrote:
> 
> > Am 11.01.2011 14:11, schrieb Luiz Capitulino:
> > > Hi there,
> > > 
> > > I need feedback on a new QMP event.
> > > 
> > > Problem
> > > =======
> > > 
> > > There's no way for a management tool to detect that a guest OS has ejected the
> > > media in a CDROM or Floppy disk drive (I'm discarding polling, because it's
> > > undesirable at best).
> > > 
> > > The end result is that the management tool can get confused, this is happening
> > > with libvirt when migration is involved: if the guest is saved/restored or
> > > migrated, then libvirt will start the guest again with media still present.
> > > 
> > > NOTE: Most of the analysis here was done by Daniel Berrange.
> > > 
> > > Solution
> > > ========
> > > 
> > > We need a new QMP event to solve that. There are two possible events, a
> > > general one and a very specific one.
> > > 
> > > There are 3 scenarios in which both events should be emitted:
> > > 
> > >  1. When guest OS ejects media
> > >  2. When 'eject' monitor command is run
> > >  3. When 'change' monitor command is run
> > > 
> > > BLOCK_MEDIA_CHANGE
> > > ------------------
> > > 
> > > This is the general event, it's emitted when any removable block device
> > > is changed.
> > > 
> > > Ideally, the event should contain two pieces of info:
> > > 
> > >  - qdev device name
> > 
> > Is there a reason why you use the device name instead of the drive
> > name/blockdev ID here?
> 
> Good question, this is a copy & paste from Daniel initial request, so
> he's the best person to answer that question.

There isn't any reason I chose one over the other, libvirt
certainly doesn't care - we can hook into either option.
I assume the best thing is to use the same identifier
that we already use in BLOCK_IO_ERROR event, for sake
of consistency.

Daniel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-01-11 18:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-11 13:11 [Qemu-devel] RFC: QMP event notification for disk media eject Luiz Capitulino
2011-01-11 13:28 ` [Qemu-devel] " Kevin Wolf
2011-01-11 17:45   ` Luiz Capitulino
2011-01-11 18:21     ` Daniel P. Berrange
2011-01-11 14:06 ` Anthony Liguori
2011-01-11 14:29   ` Markus Armbruster
2011-01-11 17:47     ` Luiz Capitulino
2011-01-11 14:13 ` [Qemu-devel] " Markus Armbruster
2011-01-11 17:53   ` Luiz Capitulino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.