qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: pkrempa@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] hmp: Extend drive_del to delete nodes without BB
Date: Wed, 24 Feb 2016 18:54:45 +0100	[thread overview]
Message-ID: <56CDEE65.3060906@redhat.com> (raw)
In-Reply-To: <1456247799-9593-3-git-send-email-kwolf@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1171 bytes --]

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 <kwolf@redhat.com>
> ---
>  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 <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-02-24 17:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-23 17:16 [Qemu-devel] [PATCH 0/2] block: drive_add/del without BlockBackend Kevin Wolf
2016-02-23 17:16 ` [Qemu-devel] [PATCH 1/2] hmp: 'drive_add -n' for creating a node without BB Kevin Wolf
2016-02-24 17:50   ` Max Reitz
2016-02-24 18:24     ` Kevin Wolf
2016-02-25 13:18   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2016-02-25 16:05     ` Eric Blake
2016-02-23 17:16 ` [Qemu-devel] [PATCH 2/2] hmp: Extend drive_del to delete nodes " Kevin Wolf
2016-02-24 17:54   ` Max Reitz [this message]
2016-02-24 18:23     ` Kevin Wolf
2016-02-26 13:09       ` Max Reitz
2016-02-25 12:51     ` Peter Krempa
2016-02-26 13:11       ` Max Reitz
2016-03-09 10:54 ` [Qemu-devel] [PATCH 0/2] block: drive_add/del without BlockBackend Kevin Wolf

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=56CDEE65.3060906@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).