qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] qapi: convert device_del
Date: Thu, 29 Mar 2012 08:08:51 +0100	[thread overview]
Message-ID: <20120329070851.GC13344@stefanha-thinkpad.localdomain> (raw)
In-Reply-To: <1332967854-29106-3-git-send-email-lcapitulino@redhat.com>

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

  reply	other threads:[~2012-03-29  8:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-28 20:50 [Qemu-devel] [PATCH 0/2]: convert device_del to the qapi Luiz Capitulino
2012-03-28 20:50 ` [Qemu-devel] [PATCH 1/2] qdev: qdev_unplug(): Use error_set() Luiz Capitulino
2012-03-29  7:00   ` Stefan Hajnoczi
2012-03-29 13:15     ` Luiz Capitulino
2012-03-29 13:45       ` Stefan Hajnoczi
2012-03-28 20:50 ` [Qemu-devel] [PATCH 2/2] qapi: convert device_del Luiz Capitulino
2012-03-29  7:08   ` Stefan Hajnoczi [this message]
2012-03-29 13:17     ` Luiz Capitulino
2012-03-29 13:39       ` Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2012-03-29 16:56 [Qemu-devel] [PATCH v2 0/2]: convert device_del to the qapi Luiz Capitulino
2012-03-29 16:56 ` [Qemu-devel] [PATCH 2/2] qapi: convert device_del Luiz Capitulino
2012-03-29 17:55   ` Eric Blake
2012-03-30 13:10     ` Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120329070851.GC13344@stefanha-thinkpad.localdomain \
    --to=stefanha@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).