qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alberto Garcia <berto@igalia.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Alberto Garcia <berto@igalia.com>,
	qemu-block@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Max Reitz <mreitz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 0/3] Add 'blockdev-del' command
Date: Tue, 13 Oct 2015 16:48:49 +0300	[thread overview]
Message-ID: <cover.1444743418.git.berto@igalia.com> (raw)

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

             reply	other threads:[~2015-10-13 13:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 13:48 Alberto Garcia [this message]
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

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=cover.1444743418.git.berto@igalia.com \
    --to=berto@igalia.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).