From patchwork Fri Jun 26 13:31:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 50349 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 472F222902 for ; Fri, 26 Jun 2015 13:32:45 +0000 (UTC) Received: by lagh6 with SMTP id h6sf27060609lag.0 for ; Fri, 26 Jun 2015 06:32:44 -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:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=ezsiMGhJc/yfC2CDFJw4/TBAqpMaD1WZPT4b/SqjvS0=; b=KelmA4JrbuZuAgCLHNVm8oe2YJ8LPLsc/fD0RPKaDzRWqbLgMhMnkneSYV89HNPGyr il0l4ZkTWtzBOhm0U5kk+KfB2u536X5pr3f7B5WZGh0eI3gr4ngvlmsZKgCYYyDH6onq 8ve6byrWQomx0U5MlCxFE3+G30uQASUDJiqEJG6j+DkblIrCyRuA7mIPs7FA9j4kvNIB MD9j7MEzsMNqm0JBKEyUxtJhGoNeUPzjR7glmmdiHdeEewCEibCbEzvvCaf3XguYJ9Uu W8AFcWsHTZ4HT8RC4wLepc6kf538iHUqsbz8TN0yG+wBMCWvlVTDDX0mNOye5V7XZC/0 sQwQ== X-Gm-Message-State: ALoCoQm1ifVByxm67U6J3yiRkNxrsoglSi+yKK9a5G99+dHun6nclAD6fZJjz7n3WVsANm3q98aE X-Received: by 10.180.106.10 with SMTP id gq10mr1937178wib.0.1435325564265; Fri, 26 Jun 2015 06:32:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.232 with SMTP id r8ls470992lal.55.gmail; Fri, 26 Jun 2015 06:32:44 -0700 (PDT) X-Received: by 10.112.25.39 with SMTP id z7mr1686190lbf.102.1435325564071; Fri, 26 Jun 2015 06:32:44 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id ql5si27416146lbb.165.2015.06.26.06.32.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 06:32:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbnk3 with SMTP id k3so64593314lbn.1 for ; Fri, 26 Jun 2015 06:32:43 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr1587633lac.41.1435325563730; Fri, 26 Jun 2015 06:32:43 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1330176lbb; Fri, 26 Jun 2015 06:32:42 -0700 (PDT) X-Received: by 10.55.18.158 with SMTP id 30mr3517044qks.17.1435325562285; Fri, 26 Jun 2015 06:32:42 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w76si32878162qge.98.2015.06.26.06.32.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 26 Jun 2015 06:32:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:60005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8TkH-0003Vo-2D for patch@linaro.org; Fri, 26 Jun 2015 09:32:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8TjC-0002JD-Ja for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:31:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8TjB-0001Wh-EP for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:31:34 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8TjB-0001QX-76 for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:31:33 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Z8Tj2-0005Gn-8z for qemu-devel@nongnu.org; Fri, 26 Jun 2015 14:31:24 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 26 Jun 2015 14:31:22 +0100 Message-Id: <1435325484-20208-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1435325484-20208-1-git-send-email-peter.maydell@linaro.org> References: <1435325484-20208-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 6/7] qdev-properties-system: Improve error message for drive assignment conflict 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.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.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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. We rephrase the "drive conflict but not for an if=something" error as well to keep the wording in line. The two cases that change are: (1) Drive specified as to be auto-connected and also manually connected (and the board does handle this if= type): qemu-system-x86_64 -nodefaults -display none \ -drive if=scsi,file=tmp.qcow2,id=foo -device ide-hd,drive=foo Previously: qemu-system-x86_64: -device ide-hd,drive=foo: Property 'ide-hd.drive' can't take value 'foo', it's in use Now: qemu-system-x86_64: -device ide-hd,drive=foo: Drive 'foo' is already in use because it has been automatically connected to another device (did you need 'if=none' in the drive options?) (2) Drive specified to be manually connected in two different ways: qemu-system-x86_64 -nodefaults -display none \ -drive if=none,file=tmp.qcow2,id=foo -device ide-hd,drive=foo \ -device ide-hd,drive=foo Previously: qemu-system-x86_64: -device ide-hd,drive=foo: Property 'ide-hd.drive' can't take value 'foo', it's in use Now: qemu-system-x86_64: -device ide-hd,drive=foo: Drive 'foo' is already in use by another device Signed-off-by: Peter Maydell Reviewed-by: Markus Armbruster Reviewed-by: Stefan Hajnoczi Message-id: 1435068107-12594-3-git-send-email-peter.maydell@linaro.org --- hw/core/qdev-properties-system.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index c731bc6..921e799 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -78,8 +78,17 @@ 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->type != IF_NONE) { + error_setg(errp, "Drive '%s' is already in use because " + "it has been automatically connected to another " + "device (did you need 'if=none' in the drive options?)", + str); + } else { + error_setg(errp, "Drive '%s' is already in use by another device", + str); + } return; } *ptr = blk;