From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYGa7-0003pu-AE for qemu-devel@nongnu.org; Tue, 23 Feb 2016 12:17:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYGa2-0000Pz-Cq for qemu-devel@nongnu.org; Tue, 23 Feb 2016 12:17:03 -0500 From: Kevin Wolf Date: Tue, 23 Feb 2016 18:16:39 +0100 Message-Id: <1456247799-9593-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1456247799-9593-1-git-send-email-kwolf@redhat.com> References: <1456247799-9593-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] hmp: Extend drive_del to delete nodes without BB List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, pkrempa@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com 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 --- blockdev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/blockdev.c b/blockdev.c index 3f46bc1..b76b6cd 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2816,6 +2816,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); -- 1.8.3.1