Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 627585

Summary: Improve error messages for bad options in -drive and -device
Product: Red Hat Enterprise Linux 6 Reporter: Luiz Capitulino <lcapitulino>
Component: qemu-kvmAssignee: Markus Armbruster <armbru>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.1CC: amit.shah, gcosta, juzhang, kcao, lihuang, mkenneth, tburke, virt-maint, wdai, xfu
Target Milestone: rcKeywords: Triaged
Target Release: 6.1   
Hardware: All   
OS: Linux   
Whiteboard:
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 15:43:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 580954    

Description Luiz Capitulino 2010-08-26 13:25:02 UTC
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 13:27:25 UTC
*** Bug 627178 has been marked as a duplicate of this bug. ***

Comment 3 Luiz Capitulino 2010-11-10 17:07:14 UTC
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 14:12:38 UTC
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 14:18:20 UTC
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 14:21:25 UTC
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 22:48:22 UTC
(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 08:25:31 UTC
Fixed upstream (commit 4e5d9b57).

Comment 14 juzhang 2011-06-14 07:11:05 UTC
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 07:56:28 UTC
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 08:06:44 UTC
(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-05 02:34:50 UTC
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-05 03:13:04 UTC
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 10:45:28 UTC
    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 15:43:14 UTC
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