From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-block@nongnu.org, patches@linaro.org
Subject: [Qemu-devel] [PATCH 3/4] qdev-properties-system: Improve error message for drive assignment conflict
Date: Fri, 12 Jun 2015 14:26:14 +0100 [thread overview]
Message-ID: <1434115575-7214-4-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1434115575-7214-1-git-send-email-peter.maydell@linaro.org>
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 <peter.maydell@linaro.org>
---
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;
--
1.9.1
next prev parent reply other threads:[~2015-06-12 13:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-12 13:26 [Qemu-devel] [PATCH 0/4] block: Improve warnings for doubly-connected drives Peter Maydell
2015-06-12 13:26 ` [Qemu-devel] [PATCH 1/4] block: Warn if an if=<something> drive was also connected manually Peter Maydell
2015-06-22 9:59 ` Markus Armbruster
2015-06-22 13:39 ` Peter Maydell
2015-06-22 14:44 ` Markus Armbruster
2015-06-22 15:20 ` Peter Maydell
2015-06-12 13:26 ` [Qemu-devel] [PATCH 2/4] qdev-properties-system: Change set_pointer's parse callback to use Error Peter Maydell
2015-06-22 9:39 ` Markus Armbruster
2015-06-22 10:11 ` Peter Maydell
2015-06-22 11:18 ` Markus Armbruster
2015-06-12 13:26 ` Peter Maydell [this message]
2015-06-22 9:12 ` [Qemu-devel] [PATCH 3/4] qdev-properties-system: Improve error message for drive assignment conflict Markus Armbruster
2015-06-22 10:13 ` Peter Maydell
2015-06-22 11:11 ` Markus Armbruster
2015-06-12 13:26 ` [Qemu-devel] [PATCH 4/4] hw/arm/virt: Make block devices default to virtio Peter Maydell
2015-06-19 11:08 ` [Qemu-devel] [PATCH 0/4] block: Improve warnings for doubly-connected drives Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1434115575-7214-4-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=patches@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).