From nobody Thu Dec 18 17:50:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1559072346; cv=none; d=zoho.com; s=zohoarc; b=OwneBfXVeFTcn5+f+kx8Safv65rc3WdhKxszLvZixZl/lU9eGCfWElgtvAZVr1+jJCIMydVUex4dlB+4kT935MjVlDiTpuGJKUUBa3Q7hIxeCAYAyZND7im83iVf6pXgZ0GbBYHs8dRtbdC7Z7TdD2goDqvdNnCZ4bLKdo/MxTI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559072346; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wON7Kh98/E/DFU++2S9sF64uLgZXwb0hIWoYoZE5z8A=; b=XBoqmTKreYkInuE7RS/tBCD6WeURMWPXMcXMFU0tP3Ngz2YX9Y4QuL7Ra0RibWkUQFdgR6U/abPfkPg5X/L8GSUUUal+4jlyXxX7GFFWXC36Js+qE/7ZBSDaPBnlkJ2bwK0tReHrsJTTjnO7qoEsLhDNwLenJrEkGc8KkqDPuvE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559072346534202.44437160128496; Tue, 28 May 2019 12:39:06 -0700 (PDT) Received: from localhost ([127.0.0.1]:41613 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVhw0-0007WD-G1 for importer@patchew.org; Tue, 28 May 2019 15:38:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVhoH-0001kx-Tr for qemu-devel@nongnu.org; Tue, 28 May 2019 15:30:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVhoA-000272-J6 for qemu-devel@nongnu.org; Tue, 28 May 2019 15:30:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36698) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hVhny-0001Lf-OI; Tue, 28 May 2019 15:30:39 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0BBA67E426; Tue, 28 May 2019 19:29:51 +0000 (UTC) Received: from localhost (unknown [10.40.205.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 94560189A2; Tue, 28 May 2019 19:29:50 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 28 May 2019 21:28:47 +0200 Message-Id: <20190528192847.2730-22-mreitz@redhat.com> In-Reply-To: <20190528192847.2730-1-mreitz@redhat.com> References: <20190528192847.2730-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 28 May 2019 19:29:57 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 21/21] blockdev: loosen restrictions on drive-backup source node X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: John Snow We mandate that the source node must be a root node; but there's no reason I am aware of that it needs to be restricted to such. In some cases, we need to make sure that there's a medium present, but in the general case we can allow the backup job itself to do the graph checking. This patch helps improve the error message when you try to backup from the same node more than once, which is reflected in the change to test 056. For backups with bitmaps, it will also show a better error message that the bitmap is in use instead of giving you something cryptic like "need a root node." Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1707303 Signed-off-by: John Snow Message-id: 20190521210053.8864-1-jsnow@redhat.com Signed-off-by: Max Reitz --- blockdev.c | 7 ++++++- tests/qemu-iotests/056 | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 79fbac8450..bc339d7818 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3450,11 +3450,16 @@ static BlockJob *do_drive_backup(DriveBackup *backu= p, JobTxn *txn, backup->compress =3D false; } =20 - bs =3D qmp_get_root_bs(backup->device, errp); + bs =3D bdrv_lookup_bs(backup->device, backup->device, errp); if (!bs) { return NULL; } =20 + if (!bs->drv) { + error_setg(errp, "Device has no medium"); + return NULL; + } + aio_context =3D bdrv_get_aio_context(bs); aio_context_acquire(aio_context); =20 diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056 index 3df323984d..f40fc11a09 100755 --- a/tests/qemu-iotests/056 +++ b/tests/qemu-iotests/056 @@ -214,7 +214,7 @@ class BackupTest(iotests.QMPTestCase): res =3D self.vm.qmp('query-block-jobs') self.assert_qmp(res, 'return[0]/status', 'concluded') # Leave zombie job un-dismissed, observe a failure: - res =3D self.qmp_backup_and_wait(serror=3D'Need a root block node', + res =3D self.qmp_backup_and_wait(serror=3D"Node 'drive0' is busy: = block device is in use by block job: backup", device=3D'drive0', format=3Diotests= .imgfmt, sync=3D'full', target=3Dself.dest_i= mg, auto_dismiss=3DFalse) --=20 2.21.0