On Sat 17 Oct 2015 08:23:26 PM CEST, Max Reitz <mre...@redhat.com> 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