[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 0/5] Add 'x-blockdev-del' command
From: |
Alberto Garcia |
Subject: |
[Qemu-devel] [PATCH v2 0/5] Add 'x-blockdev-del' command |
Date: |
Thu, 22 Oct 2015 18:13:54 +0300 |
Here's the new version of the blockdev-del command.
The first change is that I renamed it to 'x-blockdev-del' as Markus
suggested.
I also extended the test cases, which should be way more robust
now. This actually made me realize that there's tricky scenarios that
require changes in other parts of the code.
The main example is the 'drive-mirror' block job. During the operation
the target image has a node name and is only referenced by the
monitor, so there's nothing preventing its deletion using
'x-blockdev-del'. I added an extra reference to solve that.
'drive-backup' has the same problem. Although the user cannot set the
node name here, we are auto-generating them now so the command is also
vulnerable to this.
The semantics of 'x-blockdev-del' also changed a bit, trying to mirror
the semantics of 'blockdev-add' as I discussed with Kevin on the
previous thread. There's two parameters: 'id' and 'node-name' and only
one can be specified.
1) 'x-blockdev-del id=foo' deletes the backend foo with its BDS, if
and only if neither have more than 1 reference and the BDS has
no parents.
2) 'x-blockdev-del node-name=foo' deletes the BDS foo, if and only
if it only has one reference, no parents AND it is not attached
to any block backend.
Thank you all for your feedback.
Regards,
Berto
v2:
- Rename it as 'x-blockdev-del' and label it as experimental.
- Use two parameters instead of just one. If you try to delete a BDS,
it must not be attached to any backend.
- New test cases.
- Hold extra references during the mirror and backup block jobs.
v1: https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg02999.html
- Initial implementation
Alberto Garcia (5):
mirror: keep an extra reference to the target image during the job
backup: keep an extra reference to the target image during the job
block: Add blk_get_refcnt()
block: Add 'x-blockdev-del' QMP command
iotests: Add tests for the x-blockdev-del command
block/backup.c | 5 +
block/block-backend.c | 5 +
block/mirror.c | 6 +
blockdev.c | 66 +++++++
include/sysemu/block-backend.h | 1 +
qapi/block-core.json | 32 +++-
qmp-commands.hx | 46 ++++-
tests/qemu-iotests/139 | 408 +++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/139.out | 5 +
tests/qemu-iotests/group | 1 +
10 files changed, 571 insertions(+), 4 deletions(-)
create mode 100644 tests/qemu-iotests/139
create mode 100644 tests/qemu-iotests/139.out
--
2.6.1
- [Qemu-devel] [PATCH v2 0/5] Add 'x-blockdev-del' command,
Alberto Garcia <=
- [Qemu-devel] [PATCH v2 1/5] mirror: keep an extra reference to the target image during the job, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v2 2/5] backup: keep an extra reference to the target image during the job, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v2 3/5] block: Add blk_get_refcnt(), Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v2 4/5] block: Add 'x-blockdev-del' QMP command, Alberto Garcia, 2015/10/22
- [Qemu-devel] [PATCH v2 5/5] iotests: Add tests for the x-blockdev-del command, Alberto Garcia, 2015/10/22