[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] qapi: convert device_del
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] qapi: convert device_del |
Date: |
Thu, 29 Mar 2012 14:39:49 +0100 |
On Thu, Mar 29, 2012 at 2:17 PM, Luiz Capitulino <address@hidden> wrote:
> On Thu, 29 Mar 2012 08:08:51 +0100
> Stefan Hajnoczi <address@hidden> wrote:
>
>> 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.
>
> Good point, I'll change it.
>
>>
>> (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.
>
> There's no event, I'll document it. Is there any preferred method for
> polling? query-pci?
I took a quick peek at libvirt and am none the wiser. If we don't
know what the recommended approach is then let's leave it.
Stefan