From patchwork Wed Mar 16 09:54:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 8597101 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6E6E09F6E1 for ; Wed, 16 Mar 2016 09:56:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0F28201FE for ; Wed, 16 Mar 2016 09:56:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2294E201F5 for ; Wed, 16 Mar 2016 09:56:25 +0000 (UTC) Received: from localhost ([::1]:54225 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag8Bk-0005Y0-KJ for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Mar 2016 05:56:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag89k-0002ZE-NO for qemu-devel@nongnu.org; Wed, 16 Mar 2016 05:54:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag89f-0008BW-Hl for qemu-devel@nongnu.org; Wed, 16 Mar 2016 05:54:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44306) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag89f-0008BS-Bm for qemu-devel@nongnu.org; Wed, 16 Mar 2016 05:54:15 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 8E30C3DB; Wed, 16 Mar 2016 09:54:14 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-49.ams2.redhat.com [10.36.116.49]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2G9sC94024849 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Mar 2016 05:54:13 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id E649C303F916; Wed, 16 Mar 2016 10:54:11 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2016 10:54:09 +0100 Message-Id: <1458122051-9174-2-git-send-email-armbru@redhat.com> In-Reply-To: <1458122051-9174-1-git-send-email-armbru@redhat.com> References: <1458122051-9174-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Sascha Silbe Subject: [Qemu-devel] [PULL 1/3] qdev-monitor: improve error message when alias device is unavailable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sascha Silbe When trying to instantiate an alias that points to a device class that doesn't exist, the error message looks like qemu misunderstood the request: $ s390x-softmmu/qemu-system-s390x -device virtio-gpu qemu-system-s390x: -device virtio-gpu: 'virtio-gpu-ccw' is not a valid device model name Special-case the error message to make it explicit that alias expansion is going on: $ s390x-softmmu/qemu-system-s390x -device virtio-gpu qemu-system-s390x: -device virtio-gpu: 'virtio-gpu' (alias 'virtio-gpu-ccw') is not a valid device model name Suggested-By: Cornelia Huck Signed-off-by: Sascha Silbe Message-Id: <1455831854-49013-2-git-send-email-silbe@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck Reviewed-by: Michael S. Tsirkin Signed-off-by: Markus Armbruster --- qdev-monitor.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qdev-monitor.c b/qdev-monitor.c index 81e3ff3..e5136d7 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -188,6 +188,7 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp) { ObjectClass *oc; DeviceClass *dc; + const char *original_name = *driver; oc = object_class_by_name(*driver); if (!oc) { @@ -200,7 +201,12 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp) } if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) { - error_setg(errp, "'%s' is not a valid device model name", *driver); + if (*driver != original_name) { + error_setg(errp, "'%s' (alias '%s') is not a valid device model" + " name", original_name, *driver); + } else { + error_setg(errp, "'%s' is not a valid device model name", *driver); + } return NULL; }