diff mbox

[3/3] block: remove legacy_dinfo at blk_detach_dev time

Message ID 56F1C2D3.3050904@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini March 22, 2016, 10:10 p.m. UTC
On 21/03/2016 18:39, Kevin Wolf wrote:
> > When I wrote my review, I forgot that I expect x-blockdev-del to accept
> > only backends created with blockdev-add.  With that, my question is
> > indeed moot.
> > 
> > However, I've now tested my expectation, and it turned out to be wrong.
> > I'm inclined to call that a bug.
> 
> Yes.

Like this?


Paolo

Comments

Markus Armbruster March 23, 2016, 8:37 a.m. UTC | #1
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 21/03/2016 18:39, Kevin Wolf wrote:
>> > When I wrote my review, I forgot that I expect x-blockdev-del to accept
>> > only backends created with blockdev-add.  With that, my question is
>> > indeed moot.
>> > 
>> > However, I've now tested my expectation, and it turned out to be wrong.
>> > I'm inclined to call that a bug.
>> 
>> Yes.
>
> Like this?
>
> diff --git a/blockdev.c b/blockdev.c
> index 3eb05d1..0bc7ea2 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -4023,6 +4023,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;

Matches hmp_drive_del().

Reviewed-by: Markus Armbruster <armbru@redhat.com>
diff mbox

Patch

diff --git a/blockdev.c b/blockdev.c
index 3eb05d1..0bc7ea2 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -4023,6 +4023,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;