qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qdev: DEVICE_DELETED event


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH] qdev: DEVICE_DELETED event
Date: Wed, 6 Mar 2013 16:50:13 +0200

On Wed, Mar 06, 2013 at 07:44:32AM -0700, Eric Blake wrote:
> On 03/06/2013 06:00 AM, Michael S. Tsirkin wrote:
> > libvirt has a long-standing bug: when removing the device,
> > it can request removal but does not know when does the
> > removal complete. Add an event so we can fix this in a robust way.
> 
> s/complete/completes/
> 
> > 
> > Signed-off-by: Michael S. Tsirkin <address@hidden>
> > 
> > diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
> > index b2698e4..ec5b810 100644
> > --- a/QMP/qmp-events.txt
> > +++ b/QMP/qmp-events.txt
> > @@ -136,6 +136,21 @@ Example:
> >  Note: The "ready to complete" status is always reset by a BLOCK_JOB_ERROR
> >  event.
> > 
> > +DEVICE_DELETED
> > +-----------------
> > +
> > +It's emitted whenever the device removal completion is acknowledged
> 
> I know this is copy-and-paste from DEVICE_TRAY_MOVED, but most of the
> file uses the more succinct: s/It's emitted/Emitted/
> 
> > +by the guest. At this point, it's safe to reuse the specified device ID.
> > +Device removal can be initiated by the guest or by HMP/QMP commands.
> > +
> > +Data:
> > +
> > +- "device": device name (json-string)
> > +
> > +{ "event": "DEVICE_DELETED",
> > +  "data": { "device": "virtio-net-pci-0" },
> > +  "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
> 
> Long overdue!
> > +++ b/qapi-schema.json
> > @@ -2354,7 +2354,9 @@
> >  # Notes: When this command completes, the device may not be removed from 
> > the
> >  #        guest.  Hot removal is an operation that requires guest 
> > cooperation.
> >  #        This command merely requests that the guest begin the hot removal
> > -#        process.
> > +#        process.  Completion of the device removal process is signaled 
> > with a
> > +#        DEVICE_DELETED event. Guest reset will automatically complete 
> > removal
> > +#        for all devices.
> 
> Question - if libvirt misses the event (for example, if libvirtd
> requests a remove, but then gets restarted, and the event arrives before
> libvirtd is back up), is there a way to poll whether the the removal has
> completed?  The event is great to minimize polling overhead in the
> common case, but we generally provide this sort of information via a
> pollable interface at the same time.

If what you are trying to do is delete the device, you can
simply retry that command and see if it failed.
Is this enough?

> >  #
> >  # Since: 0.14.0
> >  ##
> > ---
> >  QMP/qmp-events.txt        | 15 +++++++++++++++
> >  hw/qdev.c                 |  6 ++++++
> >  include/monitor/monitor.h |  1 +
> >  monitor.c                 |  1 +
> >  qapi-schema.json          |  4 +++-
> >  5 files changed, 26 insertions(+), 1 deletion(-)
> 
> Looks like your patch body is included twice?

Ugh. Yes. Donnu why.

-- 
MST



reply via email to

[Prev in Thread] Current Thread [Next in Thread]