Red Hat Bugzilla – Bug 627585
Improve error messages for bad options in -drive and -device
Last modified: 2013-01-09 18:03:43 EST
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:
*** Bug 627178 has been marked as a duplicate of this bug. ***
Markus, can you take care of this one? It's not that important, but can cause things like bug 627178.
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.
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'
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.
(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
Fixed upstream (commit 4e5d9b57).
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
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.
(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
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.
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.
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
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