[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 6/7] qdev-properties-system: Improve error message fo
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 6/7] qdev-properties-system: Improve error message for drive assignment conflict |
Date: |
Fri, 26 Jun 2015 14:31:22 +0100 |
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 <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
---
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;
--
1.9.1
- [Qemu-devel] [PULL 0/7] target-arm queue, Peter Maydell, 2015/06/26
- [Qemu-devel] [PULL 4/7] target-arm: A64: Print ELR when taking exceptions, Peter Maydell, 2015/06/26
- [Qemu-devel] [PULL 5/7] qdev-properties-system: Change set_pointer's parse callback to use Error, Peter Maydell, 2015/06/26
- [Qemu-devel] [PULL 6/7] qdev-properties-system: Improve error message for drive assignment conflict,
Peter Maydell <=
- [Qemu-devel] [PULL 7/7] hw/arm/virt: Make block devices default to virtio, Peter Maydell, 2015/06/26
- [Qemu-devel] [PULL 1/7] hw/arm/virt-acpi-build: Fix table revision and some comments, Peter Maydell, 2015/06/26
- [Qemu-devel] [PULL 3/7] target-arm: default empty semihosting cmdline, Peter Maydell, 2015/06/26
- [Qemu-devel] [PULL 2/7] hw/arm/virt-acpi-build: Add GICv2m description in ACPI MADT table, Peter Maydell, 2015/06/26
- Re: [Qemu-devel] [PULL 0/7] target-arm queue, Peter Maydell, 2015/06/26