From patchwork Fri Jun 12 13:26:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 49827 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 257E520C81 for ; Fri, 12 Jun 2015 13:26:25 +0000 (UTC) Received: by wgv5 with SMTP id 5sf9385129wgv.0 for ; Fri, 12 Jun 2015 06:26:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=8OttcbwulM2HP2Z4LUQd5mU32+Wi91Mhzc+PItkyWAY=; b=SJoMWAN9uII9VFwo60TVcqHd6XWZ+P2ruMd43RqjvwM1Zup8Xj3OQ48Nhz9xHSy8YM Dm75CYAFOpm09yGm2hIcwEvb4I+aojr2S3DUAGRE2R6HX340qrsbjJA4ZwXnfTiE+0DN PQkwkeBxT5JlbQRruuiwdPJyEbtZZo9FoWx5NR2h/4OqO1gmAEJ1dIoJZvEsYPkXicdK kceNLsZqoB2EmIJV7dG2qmGBxcC3/vEV2mQIifz4xE/WXqgj0JeQs72UhyhTum08cUt2 A0uXEBPwvG+g0lLQ6GA8rHjK1VqwLfwN2HWGVxlMVlZGpkrrLiiNIc+OFMX0Dcj3xYiP mOuQ== X-Gm-Message-State: ALoCoQngvJ/HsnPQHBo8DQiVZP+Pv70UREdtmcrLKxmP2O6e8Tnv6F5XPix2duZO+xJmO5bXXAhL X-Received: by 10.152.27.130 with SMTP id t2mr9144133lag.2.1434115584431; Fri, 12 Jun 2015 06:26:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.195 with SMTP id da3ls577960lac.43.gmail; Fri, 12 Jun 2015 06:26:24 -0700 (PDT) X-Received: by 10.152.3.33 with SMTP id 1mr152905laz.109.1434115584268; Fri, 12 Jun 2015 06:26:24 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id q16si3406706laa.25.2015.06.12.06.26.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 06:26:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lacdj3 with SMTP id dj3so1759075lac.0 for ; Fri, 12 Jun 2015 06:26:24 -0700 (PDT) X-Received: by 10.112.204.6 with SMTP id ku6mr15134814lbc.73.1434115584129; Fri, 12 Jun 2015 06:26:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp565629lbb; Fri, 12 Jun 2015 06:26:23 -0700 (PDT) X-Received: by 10.66.193.164 with SMTP id hp4mr23195648pac.23.1434115582454; Fri, 12 Jun 2015 06:26:22 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id sg10si5342868pbb.130.2015.06.12.06.26.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 12 Jun 2015 06:26:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Z3OyO-0001t1-3I; Fri, 12 Jun 2015 14:26:16 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Markus Armbruster , Kevin Wolf , qemu-block@nongnu.org Subject: [PATCH 3/4] qdev-properties-system: Improve error message for drive assignment conflict Date: Fri, 12 Jun 2015 14:26:14 +0100 Message-Id: <1434115575-7214-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1434115575-7214-1-git-send-email-peter.maydell@linaro.org> References: <1434115575-7214-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If the user forgot if=none on their drive specification they're likely to get an error message because the drive is assigned once automatically by QEMU and once by the manual id=/drive= user command line specification. Improve the error message produced in this case to explicitly guide the user towards if=none. Signed-off-by: Peter Maydell --- hw/core/qdev-properties-system.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 56954b4..bde9e12 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -78,8 +78,20 @@ static void parse_drive(DeviceState *dev, const char *str, void **ptr, return; } if (blk_attach_dev(blk, dev) < 0) { - error_setg(errp, "Property '%s.%s' can't take value '%s', it's in use", - object_get_typename(OBJECT(dev)), propname, str); + DriveInfo *dinfo = blk_legacy_dinfo(blk); + + if (dinfo->auto_claimed) { + error_setg(errp, "Property '%s.%s' can't be set to drive ID '%s'; " + "that drive has been automatically connected to another " + "device. Use if=none if you do not want that automatic " + "connection.", + object_get_typename(OBJECT(dev)), propname, str); + } else { + error_setg(errp, "Property '%s.%s' can't be set to drive ID '%s'; " + "that drive has already been connected to another " + "device.", + object_get_typename(OBJECT(dev)), propname, str); + } return; } *ptr = blk;