qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 8/8] block: Implement 'block_disconnect' HMP com


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 8/8] block: Implement 'block_disconnect' HMP command
Date: Fri, 27 Nov 2015 11:00:21 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 11/27/2015 07:59 AM, Hannes Reinecke wrote:
> Implement a 'block_disconnect' HMP command to simulate a device
> communication / link failure.
> 
> Signed-off-by: Hannes Reinecke <address@hidden>
> ---

> +++ b/qapi/block-core.json
> @@ -754,6 +754,27 @@
>                                         'size': 'int' }}
>  
>  ##
> +# @block_disconnect

New QMP commands should favor '-' rather than '_'; this should be
'block-disconnect'.

> +#
> +# Simulate block device disconnect while a guest is running.
> +#
> +# Either @device or @node-name must be set but not both.
> +#
> +# @device: #optional the name of the device to get the image resized

Bad copy-and-paste?  We aren't resizing anything here.

> +#
> +# @node-name: #optional graph node name to get the image resized (Since 2.0)

And again. And since the command is new, you don't need a '(Since 2.0)'.

> +#
> +# @disconnect:  true for disconnecting the device
> +#
> +# Returns: nothing on success
> +#          If @device is not a valid block device, DeviceNotFound
> +#
> +##

Missing a '# Since 2.6' line.

> +{ 'command': 'block_disconnect', 'data': { '*device': 'str',
> +                                           '*node-name': 'str',
> +                                           'disconnect': 'bool' }}

Mutually-exclusive 'device' vs. 'node-name' is awkward.  For new
commands, it is sufficient to just use 'node' (and accept both node
names for the direct node to disconnect, or a device name to detach the
BDS node plugged in to that device).


> +block_disconnect
> +----------------
> +
> +Simulate a block device disconnect while a guest is running.
> +
> +Arguments:
> +
> +- "device": the device's ID, must be unique (json-string)
> +- "node-name": the node name in the block driver state graph (json-string)

Awkward that you aren't mentioning the mutual exclusion above; and again
I think that a single parameter is better than two mutually exclusive ones.

> +- "disconnect": whether to simulate a device disconnect (json-bool)

Do I again call the command with 'disconnect':false to undo the
disconnect?  That sounds like a double-negative.  It might make more
sense to have:

{ 'command':'block-set-connection', 'data': { 'node':'str',
'connected':'bool' } }

where I pass 'connected':false to disconnect, and 'connected':true to
reconnect.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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