qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] Add 'blockdev-del' command
@ 2015-10-13 13:48 Alberto Garcia
  2015-10-13 13:48 ` [Qemu-devel] [PATCH 1/3] block: Add blk_get_refcnt() Alberto Garcia
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Alberto Garcia @ 2015-10-13 13:48 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Alberto Garcia, qemu-block, Markus Armbruster,
	Max Reitz, Stefan Hajnoczi

Here's my first attempt at the 'blockdev-del' command.

This series goes on top of Max's "BlockBackend and media" v6:

https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg02810.html

With Max's code, 'blockdev-add' can now create a BlockDriverState with
or without a BlockBackend (depending on whether the 'id' parameter is
passed).

Therefore, 'blockdev-del' can be used to delete a backend and/or a
BDS.

The way it works is simple: it receives a single 'device' parameter
which can refer to a block backend or a node name.

 - If it's a block backend, it will delete it along with its attached
   BDS (if any).

 - If it's a node name, it will delete the BDS along with the backend
   it is attached to (if any).

 - If you're wondering whether it's possible to delete the BDS but not
   the backend it is attached to, there is already eject or
   blockdev-remove-medium for that.

If either the backend or the BDS are being used (refcount > 1, or if
the BDS has any parents) the command fails.

The series includes bunch of test cases with different scenarios
(nodes with and without backend, empty backend, backing images, block
jobs, Quorum).

Regards,

Berto

Alberto Garcia (3):
  block: Add blk_get_refcnt()
  block: Add 'blockdev-del' QMP command
  iotests: Add test for the blockdev-del command

 block/block-backend.c          |   5 ++
 blockdev.c                     |  42 +++++++++
 include/sysemu/block-backend.h |   1 +
 qapi/block-core.json           |  21 +++++
 qmp-commands.hx                |  36 ++++++++
 tests/qemu-iotests/139         | 189 +++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/139.out     |   5 ++
 tests/qemu-iotests/group       |   1 +
 8 files changed, 300 insertions(+)
 create mode 100644 tests/qemu-iotests/139
 create mode 100644 tests/qemu-iotests/139.out

-- 
2.6.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-10-22 11:48 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 13:48 [Qemu-devel] [PATCH 0/3] Add 'blockdev-del' command Alberto Garcia
2015-10-13 13:48 ` [Qemu-devel] [PATCH 1/3] block: Add blk_get_refcnt() Alberto Garcia
2015-10-17 18:06   ` Max Reitz
2015-10-13 13:48 ` [Qemu-devel] [PATCH 2/3] block: Add 'blockdev-del' QMP command Alberto Garcia
2015-10-17 18:06   ` Max Reitz
2015-10-19 14:20     ` Alberto Garcia
2015-10-17 18:23   ` Max Reitz
2015-10-17 18:32     ` Alberto Garcia
2015-10-13 13:48 ` [Qemu-devel] [PATCH 3/3] iotests: Add test for the blockdev-del command Alberto Garcia
2015-10-19 11:27 ` [Qemu-devel] [PATCH 0/3] Add 'blockdev-del' command Kevin Wolf
2015-10-19 14:15   ` Alberto Garcia
2015-10-19 15:04     ` Kevin Wolf
2015-10-20 15:02       ` Alberto Garcia
2015-10-22 10:38         ` Kevin Wolf
2015-10-22 11:08           ` Alberto Garcia
2015-10-22 11:25             ` Kevin Wolf
2015-10-22 11:31               ` Alberto Garcia
2015-10-22 11:47                 ` Kevin Wolf
2015-10-19 14:38   ` Max Reitz
2015-10-21  8:57 ` Markus Armbruster
2015-10-21  9:06   ` Alberto Garcia

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).