]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hmp: Extend drive_del to delete nodes without BB
authorKevin Wolf <kwolf@redhat.com>
Tue, 23 Feb 2016 16:50:37 +0000 (17:50 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 14 Mar 2016 15:46:43 +0000 (16:46 +0100)
Now that we can use drive_add to create new nodes without a BB, we also
want to be able to delete such nodes again.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
blockdev.c

index 1297c90512c5442cdef7ee8ba8ada8746d3b80a5..322ca03908fda628945a1ab2a16d8f75fa619151 100644 (file)
@@ -2824,6 +2824,15 @@ void hmp_drive_del(Monitor *mon, const QDict *qdict)
     AioContext *aio_context;
     Error *local_err = NULL;
 
+    bs = bdrv_find_node(id);
+    if (bs) {
+        qmp_x_blockdev_del(false, NULL, true, id, &local_err);
+        if (local_err) {
+            error_report_err(local_err);
+        }
+        return;
+    }
+
     blk = blk_by_name(id);
     if (!blk) {
         error_report("Device '%s' not found", id);