From nobody Sun Feb 8 15:37:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487683526401504.81762267868885; Tue, 21 Feb 2017 05:25:26 -0800 (PST) Received: from localhost ([::1]:44558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgARX-00047h-QM for importer@patchew.org; Tue, 21 Feb 2017 08:25:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cg9eZ-0007ee-9s for qemu-devel@nongnu.org; Tue, 21 Feb 2017 07:34:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cg9eV-00083F-W1 for qemu-devel@nongnu.org; Tue, 21 Feb 2017 07:34:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38318) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cg9eV-00082q-QA for qemu-devel@nongnu.org; Tue, 21 Feb 2017 07:34:43 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 026A97FB67 for ; Tue, 21 Feb 2017 12:34:44 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF2E965410 for ; Tue, 21 Feb 2017 12:34:43 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id DCB2511386DC; Tue, 21 Feb 2017 13:34:39 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 21 Feb 2017 13:34:34 +0100 Message-Id: <1487680479-15132-7-git-send-email-armbru@redhat.com> In-Reply-To: <1487680479-15132-1-git-send-email-armbru@redhat.com> References: <1487680479-15132-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 21 Feb 2017 12:34:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/11] blockdev: Improve message for orphaned -drive 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We warn when a -drive isn't supported by the machine type (commit a66c9dc): $ qemu-system-x86_64 -S -display none -drive if=3Dmtd Warning: Orphaned drive without device: id=3Dmtd0,file=3D,if=3Dmtd,bus= =3D0,unit=3D0 Improve this to point to the offending bit of configuration: qemu-system-x86_64: -drive if=3Dmtd: warning: machine type does not sup= port if=3Dmtd,bus=3D0,unit=3D0 Especially nice when it's hidden behind -readconfig foo.cfg: qemu-system-x86_64:foo.cfg:140: warning: machine type does not support = if=3Dmtd,bus=3D0,unit=3D0 Signed-off-by: Markus Armbruster Message-Id: <1487153147-11530-7-git-send-email-armbru@redhat.com> Reviewed-by: John Snow --- blockdev.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/blockdev.c b/blockdev.c index db82ac9..eb75f35 100644 --- a/blockdev.c +++ b/blockdev.c @@ -231,6 +231,7 @@ bool drive_check_orphaned(void) { BlockBackend *blk; DriveInfo *dinfo; + Location loc; bool rs =3D false; =20 for (blk =3D blk_next(NULL); blk; blk =3D blk_next(blk)) { @@ -239,10 +240,12 @@ bool drive_check_orphaned(void) /* Unless this is a default drive, this may be an oversight. */ if (!blk_get_attached_dev(blk) && !dinfo->is_default && dinfo->type !=3D IF_NONE) { - fprintf(stderr, "Warning: Orphaned drive without device: " - "id=3D%s,file=3D%s,if=3D%s,bus=3D%d,unit=3D%d\n", - blk_name(blk), blk_bs(blk) ? blk_bs(blk)->filename : "= ", - if_name[dinfo->type], dinfo->bus, dinfo->unit); + loc_push_none(&loc); + qemu_opts_loc_restore(dinfo->opts); + error_report("warning: machine type does not support" + " if=3D%s,bus=3D%d,unit=3D%d", + if_name[dinfo->type], dinfo->bus, dinfo->unit); + loc_pop(&loc); rs =3D true; } } --=20 2.7.4