Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 627585 - Improve error messages for bad options in -drive and -device
Improve error messages for bad options in -drive and -device
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.1
All Linux
low Severity medium
: rc
: 6.1
Assigned To: Markus Armbruster
Virtualization Bugs
: Triaged
: 627178 (view as bug list)
Depends On:
Blocks: 580954
  Show dependency treegraph
 
Reported: 2010-08-26 09:25 EDT by Luiz Capitulino
Modified: 2013-01-09 18:03 EST (History)
10 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.166.el6
Doc Type: Bug Fix
Doc Text:
No description necessary
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-06 10:43:14 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:1531 normal SHIPPED_LIVE Moderate: qemu-kvm security, bug fix, and enhancement update 2011-12-05 20:23:30 EST

  None (edit)
Description Luiz Capitulino 2010-08-26 09:25:02 EDT
Description of problem:

Some error messages when using bad options for -drive or -device parameters are misleading.


Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.110.el6.x86_64

How reproducible:


Steps to Reproduce:
1. Run the following command (make sure the images exist, of course):

# qemu-kvm \
  -drive file=image.qcow2,if=none,id=drive-virtio-disk1 \
  -device virtio-blk-pci,drive=drive-virtio-disk1,id=virtio-disk1 \
  -drive file=i386cd-5.0.2.iso,index=0,if=none,id=foo \
  -device ide-drive,drive=foo,id=ide0-0-0

Actual results:

The following error message is printed:

"""
property "ide-drive.drive": failed to parse "foo"
can't set property "drive" to "foo" for "ide-drive"
"""

Expected results:

The real problem here is that we're setting the second's drive index to 0 and it conflicts with the first drive (check at vl.c:2447). We should print the appropriate error message.

Another related problem is that setting index _and_ unit at the same time shouldn't be allowed.

Additional info:
Comment 1 Luiz Capitulino 2010-08-26 09:27:25 EDT
*** Bug 627178 has been marked as a duplicate of this bug. ***
Comment 3 Luiz Capitulino 2010-11-10 12:07:14 EST
Markus, can you take care of this one? It's not that important, but can cause things like bug 627178.
Comment 4 Markus Armbruster 2011-01-14 09:12:38 EST
Re "Another related problem is that setting index _and_ unit at the same time
shouldn't be allowed": if I try that, qemu fails with "qemu: index cannot be used with bus and unit".  So scratch that part.
Comment 5 Markus Armbruster 2011-01-14 09:18:20 EST
For what it's worth, the error message is no longer

property "ide-drive.drive": failed to parse "foo"
can't set property "drive" to "foo" for "ide-drive"

but

qemu-system-x86_64: -device ide-drive,drive=foo,id=ide0-0-0: Property 'ide-drive.drive' can't find value 'foo'
Comment 6 Markus Armbruster 2011-01-14 09:21:25 EST
If you give multiple -drive for the same if and index, all but the first are silently ignored.  I don't know why, but it's clearly intentional in the code.  When you then attempt to use such an ignored drive with -device, it doesn't exist.

Perhaps we can convince upstream to reject duplicate -drive with a sensible error message.
Comment 7 Dor Laor 2011-01-15 17:48:22 EST
(In reply to comment #6)
> If you give multiple -drive for the same if and index, all but the first are
> silently ignored.  I don't know why, but it's clearly intentional in the code. 
> When you then attempt to use such an ignored drive with -device, it doesn't
> exist.
> 
> Perhaps we can convince upstream to reject duplicate -drive with a sensible
> error message.

Sounds that its needed. We can also get it downstream into rhel in case upstream opposes since we can just add a standalone check function. Hope it will get accepted upstream
Comment 8 Markus Armbruster 2011-02-16 03:25:31 EST
Fixed upstream (commit 4e5d9b57).
Comment 14 juzhang 2011-06-14 03:11:05 EDT
Reproduced with qemu-kvm-0.12.1.2-2.163.el6.x86_64,mark qa_ack +

I tried two scenario

1. as same as comment0
results:
qemu-kvm: -device ide-drive,drive=zhang,id=ide1: Property 'ide-drive.drive' can't find value 'zhang'

2. use index and bus unit at same time
-drive file=/root/image/image/image100.qcow2,index=2,if=none,id=foo,bus=1,unit=0 -device ide-drive,drive=zhang,id=ide1

results:
qemu: index cannot be used with bus and unit
Comment 15 Markus Armbruster 2011-06-14 03:56:28 EDT
Re test case "2. use index and bus unit at same time": yes, that should not be allowed (as noted in comment#0), but it has always been caught (comment#4), so there's nothing to fix.  The test case's result is the expected result.  Test case can be dropped.
Comment 16 juzhang 2011-06-14 04:06:44 EDT
(In reply to comment #15)
> Re test case "2. use index and bus unit at same time": yes, that should not be
> allowed (as noted in comment#0), but it has always been caught (comment#4), so
> there's nothing to fix.  The test case's result is the expected result.  Test
> case can be dropped.

got it,when we verify this issue,we will just try scenario1,thanks
Comment 20 FuXiangChun 2011-08-04 22:34:50 EDT
Verified on qemu-kvm-0.12.1.2-2.175.el6.x86_64
reproduce on qemu-kvm-0.12.1.2-2.160.el6.x86_64

steps to reproduce:
1.# /usr/libexec/qemu-kvm  -drive file=image.qcow2,if=none,id=drive-virtio-disk1  -device virtio-blk-pci,drive=drive-virtio-disk1,id=virtio-disk1 -drive file=i386cd-5.0.2.iso,index=0,if=none,id=foo -device ide-drive,drive=foo,id=ide0-0-0


2./usr/libexec/qemu-kvm  -drive file=image.qcow2,if=none,id=drive-virtio-disk1,index=2,unit=0  -device virtio-blk-pci,drive=drive-virtio-disk1,id=virtio-disk1 -drive file=i386cd-5.0.2.iso,index=0,if=none,id=foo -device ide-drive,drive=foo,id=ide0-0-0

Actual Results:
 on qemu-kvm-0.12.1.2-2.160.el6.x86_64
1.Using CPU model "cpu64-rhel6"
qemu-kvm: -device ide-drive,drive=foo,id=ide0-0-0: Property 'ide-drive.drive' can't find value 'foo'

2.qemu: index cannot be used with bus and unit

 
on qemu-kvm-0.12.1.2-2.175.el6.x86_64
1.qemu-kvm: -drive file=i386cd-5.0.2.iso,index=0,if=none,id=foo: drive with bus=0, unit=0 (index=0) exists

2.qemu-kvm: -drive file=image.qcow2,if=none,id=drive-virtio-disk1,index=2,unit=0: index cannot be used with bus and unit

Based on above ,this issue has been fixed.
Comment 21 FuXiangChun 2011-08-04 23:13:04 EDT
since above result look a little confusing, i will update it again.

reproduce on qemu-kvm-0.12.1.2-2.160.el6.x86_64
 steps to reproduce:
 1.# /usr/libexec/qemu-kvm  -drive
file=image.qcow2,if=none,id=drive-virtio-disk1  -device
virtio-blk-pci,drive=drive-virtio-disk1,id=virtio-disk1 -drive
file=i386cd-5.0.2.iso,index=0,if=none,id=foo -device
ide-drive,drive=foo,id=ide0-0-0

Using CPU model "cpu64-rhel6"
qemu-kvm: -device ide-drive,drive=foo,id=ide0-0-0: Property 'ide-drive.drive'
can't find value 'foo'

 2./usr/libexec/qemu-kvm  -drive
file=image.qcow2,if=none,id=drive-virtio-disk1,index=2,unit=0  -device
virtio-blk-pci,drive=drive-virtio-disk1,id=virtio-disk1 -drive
file=i386cd-5.0.2.iso,index=0,if=none,id=foo -device
ide-drive,drive=foo,id=ide0-0-0

qemu: index cannot be used with bus and unit

verify on qemu-kvm-0.12.1.2-2.175.el6.x86_64

 using the same aboves steps

result:
 1.qemu-kvm: -drive file=i386cd-5.0.2.iso,index=0,if=none,id=foo: drive with
bus=0, unit=0 (index=0) exists

2.qemu-kvm: -drive
file=image.qcow2,if=none,id=drive-virtio-disk1,index=2,unit=0: index cannot be
used with bus and unit


  Based on above ,this issue has been fixed.
Comment 23 Markus Armbruster 2011-11-18 05:45:28 EST
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No description necessary
Comment 24 errata-xmlrpc 2011-12-06 10:43:14 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2011-1531.html

Note You need to log in before you can comment on or make changes to this bug.