Bug 737879 - Qemu-kvm fails to exit when given invalid "-drive" option name or option value
Summary: Qemu-kvm fails to exit when given invalid "-drive" option name or option value
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.2
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Markus Armbruster
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-13 10:23 UTC by Shaolong Hu
Modified: 2013-01-10 00:18 UTC (History)
8 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.214.el6
Doc Type: Bug Fix
Doc Text:
Cause: Invalid -drive arguments are handled incorrectly. Consequence: Some errors are reported, others aren't. Then we continue with a misconfigured drive. Fix: Correct the validation of -drive arguments. Results: Invalid -drive arguments are diagnosed, and qemu-kvm refuses to run.
Clone Of:
Environment:
Last Closed: 2012-06-20 11:34:19 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0746 normal SHIPPED_LIVE qemu-kvm bug fix and enhancement update 2012-06-19 19:31:48 UTC

Description Shaolong Hu 2011-09-13 10:23:27 UTC
Description of problem:
------------------------
Qemu-kvm fails to exit when given invalid "-drive" option name or option value.


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


How reproducible:
------------------
100%


Steps to Reproduce:
--------------------
1.boot guest with:
#/usr/libexec/qemu-kvm -drive option[,option[,option[,...]]]

  
Actual results:
----------------
1.
# /usr/libexec/qemu-kvm -drive 123
qemu-kvm: -drive 123: Invalid parameter '123'
VNC server running on `::1:5903'

2.
# /usr/libexec/qemu-kvm -drive bus=123
qemu: too many IDE bus
(exit)
# /usr/libexec/qemu-kvm -drive bus=sfdsd
qemu-kvm: -drive bus=sfdsd: Parameter 'bus' expects a number
VNC server running on `::1:5904'

3.
# /usr/libexec/qemu-kvm -drive index=dfs
qemu-kvm: -drive index=dfs: Parameter 'index' expects a number
VNC server running on `::1:5905'

4.
/usr/libexec/qemu-kvm -drive cyls=sdf
qemu-kvm: -drive cyls=sdf: Parameter 'cyls' expects a number
VNC server running on `::1:5906'
# /usr/libexec/qemu-kvm -drive heads=sdfsd
qemu-kvm: -drive heads=sdfsd: Parameter 'heads' expects a number
VNC server running on `::1:5906'
/usr/libexec/qemu-kvm -drive secs=sdfsd
qemu-kvm: -drive secs=sdfsd: Parameter 'secs' expects a number
VNC server running on `::1:5906'

5.
/usr/libexec/qemu-kvm -drive snapshot=123
qemu-kvm: -drive snapshot=123: Parameter 'snapshot' expects 'on' or 'off'
VNC server running on `::1:5906'

6.
/usr/libexec/qemu-kvm -drive serial=dsfs
VNC server running on `::1:5906'


Expected results:
------------------
After prompt error above, it should exit.


Additional info:
-----------------
Currently, we have "file/if/bus/index/media/cyls/heads/secs/trans/snapshot/cache/aio/format/serial/addr" options for "-drive", tests suggest, when some of them encounter invalid value, they prompt error and exit correctly, ones won't exit are listed in actual results.

Comment 2 Markus Armbruster 2011-11-29 07:31:12 UTC
I reproduced the reported results.

Test case 2 part "bus=123" works as expected.  The error message could use polish, though.

For all other test cases, upstream exits unsuccessfully, as it should.

Additionally, upstream reports for test case 6:
qemu: Device needs media, but drive is empty
qemu: Initialization of device ide-hd failed

Comment 3 Markus Armbruster 2011-12-07 12:17:39 UTC
Need at least upstream commit e2982c3a.

Comment 4 Markus Armbruster 2011-12-20 10:31:03 UTC
Also need upstream commit 98f28ad7 for test case 6.

Comment 5 Markus Armbruster 2011-12-20 14:14:33 UTC
Test case 7:
$ qemu-kvm -drive if=ide

Actual results:
VNC server running on `127.0.0.1:5900'
block I/O error in device 'ide0-hd0': No medium found (123)
[doesn't terminate]

Expected results:

upstream-qemu: Device needs media, but drive is empty
upstream-qemu: Initialization of device ide-hd failed
[Exit 1 ]

Comment 6 Markus Armbruster 2011-12-20 14:20:02 UTC
Test case 8:
$ qemu-kvm -drive if=virtio

Actual results:
VNC server running on `127.0.0.1:5900'
[doesn't terminate]

Expected results:
upstream-qemu: -drive if=virtio: Device needs media, but drive is empty
upstream-qemu: -drive if=virtio: Device 'virtio-blk' could not be initialized
[Exit 1 ]

Comment 9 Shaolong Hu 2012-02-01 08:09:17 UTC
Verified on qemu-kvm-0.12.1.2-2.222.el6:

1.# /usr/libexec/qemu-kvm -drive 123
qemu-kvm: -drive 123: Invalid parameter '123'

2.# /usr/libexec/qemu-kvm -drive bus=sfdsd
qemu-kvm: -drive bus=sfdsd: Parameter 'bus' expects a number

3.# /usr/libexec/qemu-kvm -drive index=dfs
qemu-kvm: -drive index=dfs: Parameter 'index' expects a number

4.# /usr/libexec/qemu-kvm -drive cyls=sdf
qemu-kvm: -drive cyls=sdf: Parameter 'cyls' expects a number
# /usr/libexec/qemu-kvm -drive heads=sdfsd
qemu-kvm: -drive heads=sdfsd: Parameter 'heads' expects a number
# /usr/libexec/qemu-kvm -drive secs=sdfsd
qemu-kvm: -drive secs=sdfsd: Parameter 'secs' expects a number

5.# /usr/libexec/qemu-kvm -drive snapshot=123
qemu-kvm: -drive snapshot=123: Parameter 'snapshot' expects 'on' or 'off'

6.# /usr/libexec/qemu-kvm -drive serial=dsfs
qemu-kvm: Device needs media, but drive is empty
qemu-kvm: Initialization of device ide-drive failed

7./usr/libexec/qemu-kvm -drive if=ide
qemu-kvm: Device needs media, but drive is empty
qemu-kvm: Initialization of device ide-drive failed

8./usr/libexec/qemu-kvm -drive if=virtio
qemu-kvm: -drive if=virtio: Device needs media, but drive is empty
qemu-kvm: -drive if=virtio: Device 'virtio-blk-pci' could not be initialized


Based on above results, verified.

Comment 11 Michal Novotny 2012-05-03 17:34:32 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:
Cause:
Run qemu-kvm with invalid -drive option name or option value.

Consequence:
Qemu-kvm fails to run.

Fix:
[NEEDINFO: Markus, could you please add info? Thanks!]

Results:
Qemu-kvm starts smoothly.

Comment 12 Markus Armbruster 2012-05-03 19:29:59 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,11 +1,11 @@
 Cause:
-Run qemu-kvm with invalid -drive option name or option value.
+Invalid -drive arguments are handled incorrectly.
 
 Consequence:
-Qemu-kvm fails to run.
+Some errors are reported, others aren't.  Then we continue with a misconfigured drive.
 
 Fix:
-[NEEDINFO: Markus, could you please add info? Thanks!]
+Correct the validation of -drive arguments.
 
 Results:
-Qemu-kvm starts smoothly.+Invalid -drive arguments are diagnosed, and qemu-kvm refuses to run.

Comment 13 errata-xmlrpc 2012-06-20 11:34:19 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/RHBA-2012-0746.html


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