qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block: forbid x-blockdev-del from acting on DriveInfo
@ 2016-03-31 13:07 Paolo Bonzini
  2016-04-04 10:53 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2016-03-31 13:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, armbru, mreitz

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>
---
 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;
-- 
2.5.5

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

* Re: [Qemu-devel] [PATCH] block: forbid x-blockdev-del from acting on DriveInfo
  2016-03-31 13:07 [Qemu-devel] [PATCH] block: forbid x-blockdev-del from acting on DriveInfo Paolo Bonzini
@ 2016-04-04 10:53 ` Kevin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2016-04-04 10:53 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: armbru, qemu-devel, mreitz

Am 31.03.2016 um 15:07 hat Paolo Bonzini geschrieben:
> 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>

Thanks, applied to the block branch.

Kevin

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

end of thread, other threads:[~2016-04-04 10:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31 13:07 [Qemu-devel] [PATCH] block: forbid x-blockdev-del from acting on DriveInfo Paolo Bonzini
2016-04-04 10:53 ` Kevin Wolf

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