Re: [Qemu-devel] [PATCH 2/3] block: Add 'blockdev-del' QMP command

2015-10-19 Thread Alberto Garcia
On Sat 17 Oct 2015 08:06:19 PM CEST, Max Reitz wrote: >> +if (blk_get_refcnt(blk) > 1 || >> +(bs && (bs->refcnt > 1 || !QLIST_EMPTY(&bs->parents { >> +error_setg(errp, "Block device %s is being used", device); >> +goto out; >> +} > > I can't think of a way off th

Re: [Qemu-devel] [PATCH 2/3] block: Add 'blockdev-del' QMP command

2015-10-17 Thread Alberto Garcia
On Sat 17 Oct 2015 08:23:26 PM CEST, Max Reitz 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);

Re: [Qemu-devel] [PATCH 2/3] block: Add 'blockdev-del' QMP command

2015-10-17 Thread Max Reitz
On 13.10.2015 15:48, Alberto Garcia wrote: > This is the companion to 'blockdev-add'. It allows deleting a > BlockBackend with its associated BlockDriverState tree, or a > BlockDriverState that is not attached to any backend. > > In either case, the command fails if the reference count is greater

Re: [Qemu-devel] [PATCH 2/3] block: Add 'blockdev-del' QMP command

2015-10-17 Thread Max Reitz
On 13.10.2015 15:48, Alberto Garcia wrote: > This is the companion to 'blockdev-add'. It allows deleting a > BlockBackend with its associated BlockDriverState tree, or a > BlockDriverState that is not attached to any backend. > > In either case, the command fails if the reference count is greater

[Qemu-devel] [PATCH 2/3] block: Add 'blockdev-del' QMP command

2015-10-13 Thread Alberto Garcia
This is the companion to 'blockdev-add'. It allows deleting a BlockBackend with its associated BlockDriverState tree, or a BlockDriverState that is not attached to any backend. In either case, the command fails if the reference count is greater than 1 or the BlockDriverState has any parents. Sign