From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL 1/4] block: forbid x-blockdev-del from acting on DriveInfo
Date: Tue, 5 Apr 2016 17:41:25 +0200 [thread overview]
Message-ID: <1459870888-9246-2-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1459870888-9246-1-git-send-email-kwolf@redhat.com>
From: Paolo Bonzini <pbonzini@redhat.com>
Failing on -drive/drive_add created BlockBackends was a
requirement for x-blockdev-del, but it sneaked through
the patch review. Let's fix it now.
Example:
$ x86_64-softmmu/qemu-system-x86_64 -drive if=none,file=null-co://,id=null -qmp stdio
>> {'execute':'qmp_capabilities'}
<< {"return": {}}
>> {'execute':'x-blockdev-del','arguments':{'id':'null'}}
<< {"error": {"class": "GenericError", "desc": "Deleting block backend added with drive-add is not supported"}}
And without a DriveInfo:
>> { "execute": "blockdev-add", "arguments": { "options": { "driver":"null-co", "id":"null2"}}}
<< {"return": {}}
>> {'execute':'x-blockdev-del','arguments':{'id':'null2'}}
<< {"return": {}}
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
blockdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/blockdev.c b/blockdev.c
index e50e8ea..332068a 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -4027,6 +4027,11 @@ void qmp_x_blockdev_del(bool has_id, const char *id,
error_setg(errp, "Cannot find block backend %s", id);
return;
}
+ if (blk_legacy_dinfo(blk)) {
+ error_setg(errp, "Deleting block backend added with drive-add"
+ " is not supported");
+ return;
+ }
if (blk_get_refcnt(blk) > 1) {
error_setg(errp, "Block backend %s is in use", id);
return;
--
1.8.3.1
next prev parent reply other threads:[~2016-04-05 15:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 15:41 [Qemu-devel] [PULL 0/4] Block layer patches for 2.6 Kevin Wolf
2016-04-05 15:41 ` Kevin Wolf [this message]
2016-04-05 15:41 ` [Qemu-devel] [PULL 2/4] block: Forbid I/O throttling on nodes with multiple parents " Kevin Wolf
2016-04-05 15:41 ` [Qemu-devel] [PULL 3/4] qemu-iotests: 149: Use "/usr/bin/env python" Kevin Wolf
2016-04-05 15:41 ` [Qemu-devel] [PULL 4/4] crypto: Avoid memory leak on failure Kevin Wolf
2016-04-05 16:44 ` [Qemu-devel] [PULL 0/4] Block layer patches for 2.6 Peter Maydell
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=1459870888-9246-2-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).