[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 2/3] block: Add 'blockdev-del' QMP command
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-block] [PATCH 2/3] block: Add 'blockdev-del' QMP command |
Date: |
Sat, 17 Oct 2015 20:32:00 +0200 |
User-agent: |
Notmuch/0.13.2 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) |
On Sat 17 Oct 2015 08:23:26 PM CEST, Max Reitz <address@hidden> wrote:
>> +void qmp_blockdev_del(const char *device, Error **errp)
>> +{
>> + AioContext *aio_context;
>> + BlockBackend *blk;
>> + BlockDriverState *bs;
>> +
>> + blk = blk_by_name(device);
>> + if (blk) {
>> + bs = blk_bs(blk);
>> + aio_context = blk_get_aio_context(blk);
>> + } else {
>> + bs = bdrv_find_node(device);
>> + if (!bs) {
>> + error_setg(errp, "Cannot find block device %s", device);
>> + return;
>> + }
>> + blk = bs->blk;
>
> After seeing testBlockBackendUsingNodeName() in patch 3, I don't know
> about this. We often have this notion of "If you need a BDS, you can
> specify both the BB and the node name", but here it's the other way
> around: One "needs" a BB (at least that's what the command will work
> on) and one gets it by specifying a node name. That seems a bit
> strange to me.
I'm also not completely sure about this to be honest and I'm not
surprised that you don't like it. I was thinking about this these last
couple of days and I think that this alternative is probably better:
- If you specify the name of a backend, delete the backend and its BDS
(if there's any).
- If you specify the name of a BDS (using its node name), delete the
BDS and only the BDS.
Berto
- [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command, Alberto Garcia, 2015/10/13
- [Qemu-block] [PATCH 1/3] block: Add blk_get_refcnt(), Alberto Garcia, 2015/10/13
- [Qemu-block] [PATCH 2/3] block: Add 'blockdev-del' QMP command, Alberto Garcia, 2015/10/13
- [Qemu-block] [PATCH 3/3] iotests: Add test for the blockdev-del command, Alberto Garcia, 2015/10/13
- Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command, Kevin Wolf, 2015/10/19
- Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command, Alberto Garcia, 2015/10/19
- Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command, Kevin Wolf, 2015/10/19
- Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command, Alberto Garcia, 2015/10/20
- Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command, Kevin Wolf, 2015/10/22
- Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command, Alberto Garcia, 2015/10/22
- Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command, Kevin Wolf, 2015/10/22
- Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command, Alberto Garcia, 2015/10/22
- Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command, Kevin Wolf, 2015/10/22