From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDFfQ-0005iZ-Vx for qemu-devel@nongnu.org; Wed, 06 Mar 2013 09:50:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDFfJ-00031A-Sd for qemu-devel@nongnu.org; Wed, 06 Mar 2013 09:50:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:10459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDFfJ-000303-Lh for qemu-devel@nongnu.org; Wed, 06 Mar 2013 09:49:57 -0500 Date: Wed, 6 Mar 2013 16:50:13 +0200 From: "Michael S. Tsirkin" Message-ID: <20130306145013.GA30575@redhat.com> References: <20130306130055.GA29446@redhat.com> <51375650.1060800@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51375650.1060800@redhat.com> Subject: Re: [Qemu-devel] [PATCH] qdev: DEVICE_DELETED event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , Anthony Liguori , Eduardo Habkost , Stefan Hajnoczi , Markus Armbruster , qemu-devel@nongnu.org, Gerd Hoffmann , laine@redhat.com, Paolo Bonzini , Luiz Capitulino , Andreas =?iso-8859-1?Q?F=E4rber?= 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 > > > > 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