Received: from eggs.gnu.org ([208.118.235.92]:42967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDAkb-0000BA-D2 for qemu-devel@nongnu.org; Thu, 29 Mar 2012 04:30:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SDAkV-0005kv-1h for qemu-devel@nongnu.org; Thu, 29 Mar 2012 04:30:32 -0400 Received: from mail-ey0-f173.google.com ([209.85.215.173]:45045) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDAkU-0005kC-Pc for qemu-devel@nongnu.org; Thu, 29 Mar 2012 04:30:26 -0400 Received: by mail-ey0-f173.google.com with SMTP id f11so939316eaa.4 for ; Thu, 29 Mar 2012 01:30:25 -0700 (PDT) Date: Thu, 29 Mar 2012 08:08:51 +0100 From: Stefan Hajnoczi Message-ID: <20120329070851.GC13344@stefanha-thinkpad.localdomain> References: <1332967854-29106-1-git-send-email-lcapitulino@redhat.com> <1332967854-29106-3-git-send-email-lcapitulino@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1332967854-29106-3-git-send-email-lcapitulino@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/2] qapi: convert device_del List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Wed, Mar 28, 2012 at 05:50:54PM -0300, Luiz Capitulino wrote: > ret = qdev_unplug(dev, &local_err); > if (error_is_set(&local_err)) { > - qerror_report_err(local_err); > - error_free(local_err); > + error_propagate(errp, local_err); > + } else if (ret) { > + error_set(errp, QERR_UNDEFINED_ERROR); Can we make qdev_unplug() void? I can find no case in QEMU where we return != 0 without setting error. If we fix the function prototype this invalid state can be eliminated forever. (Other functions that take Error **errp are usually void.) > diff --git a/qapi-schema.json b/qapi-schema.json > index 0d11d6e..ace55f3 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -1701,3 +1701,23 @@ > # Since: 1.1 > ## > { 'command': 'xen-save-devices-state', 'data': {'filename': 'str'} } > + > +## > +# @device_del: > +# > +# Remove a device from a guest > +# > +# @id: the name of the device > +# > +# Returns: Nothing on success > +# If @id is not a valid device, DeviceNotFound > +# If the device does not support unplug, BusNoHotplug > +# > +# 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. I have not peeked at the implementation in QEMU or libvirt, but is there a QMP event for actual removal or would the user need to poll? This bit of information would be useful in the documentation. Stefan