From patchwork Thu Feb 18 21:44:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Silbe X-Patchwork-Id: 8354761 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 888E8C0553 for ; Thu, 18 Feb 2016 21:44:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3994203DB for ; Thu, 18 Feb 2016 21:44:37 +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 38853203A0 for ; Thu, 18 Feb 2016 21:44:37 +0000 (UTC) Received: from localhost ([::1]:45902 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWWNH-0005ze-G8 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Feb 2016 16:44:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWWN4-0005zK-2c for qemu-devel@nongnu.org; Thu, 18 Feb 2016 16:44:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWWMv-0003nB-0s for qemu-devel@nongnu.org; Thu, 18 Feb 2016 16:44:22 -0500 Received: from e06smtp07.uk.ibm.com ([195.75.94.103]:39644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWWMu-0003m0-MK for qemu-devel@nongnu.org; Thu, 18 Feb 2016 16:44:12 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Feb 2016 21:44:10 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 18 Feb 2016 21:44:08 -0000 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: silbe@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id BBFEA1B08069 for ; Thu, 18 Feb 2016 21:44:25 +0000 (GMT) Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u1ILi85h59572280 for ; Thu, 18 Feb 2016 21:44:08 GMT Received: from d06av03.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u1ILi72E017473 for ; Thu, 18 Feb 2016 14:44:07 -0700 Received: from s38lp35.boeblingen.de.ibm.com (dyn-9-152-222-219.boeblingen.de.ibm.com [9.152.222.219]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u1ILi7GP017446; Thu, 18 Feb 2016 14:44:07 -0700 From: Sascha Silbe To: qemu-devel@nongnu.org, "Michael S. Tsirkin" , Cornelia Huck , Christian Borntraeger , Markus Armbruster Date: Thu, 18 Feb 2016 22:44:12 +0100 Message-Id: <1455831854-49013-2-git-send-email-silbe@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455831854-49013-1-git-send-email-silbe@linux.vnet.ibm.com> References: <1455831854-49013-1-git-send-email-silbe@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16021821-0029-0000-0000-000005E017A9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.103 Subject: [Qemu-devel] [PATCH v2 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 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 Reviewed-by: Cornelia Huck --- v1->v2: new patch --- 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; }