[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 2/2] hmp: Extend drive_del to delete nodes witho
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH 2/2] hmp: Extend drive_del to delete nodes without BB |
Date: |
Wed, 24 Feb 2016 18:54:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 23.02.2016 18:16, Kevin Wolf wrote:
> Now that we can use drive_add to create new nodes without a BB, we also
> want to be able to delete such nodes again.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> blockdev.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/blockdev.c b/blockdev.c
> index 3f46bc1..b76b6cd 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -2816,6 +2816,15 @@ void hmp_drive_del(Monitor *mon, const QDict *qdict)
> AioContext *aio_context;
> Error *local_err = NULL;
>
> + bs = bdrv_find_node(id);
> + if (bs) {
> + qmp_x_blockdev_del(false, NULL, true, id, &local_err);
> + if (local_err) {
> + error_report_err(local_err);
> + }
> + return;
> + }
> +
> blk = blk_by_name(id);
> if (!blk) {
> error_report("Device '%s' not found", id);
>
It's a bit strange to require the user to specify the node name using
"node-name" for drive_add, but the to use "id" in drive_del; especially
because x-blockdev-del uses "node-name", too.
Up to your discretion.
Reviewed-by: Max Reitz <address@hidden>
signature.asc
Description: OpenPGP digital signature