Red Hat Bugzilla – Bug 852642
qemu process should exit when a invaild value set for "-smp"
Last modified: 2012-09-07 16:29:05 EDT
Description of problem:
A guest can start up by command "qemu-kvm -smp a,cores=0 -hda /tmp/test.qcow2" , but as we know values of "smp","cores","sockets","threads" and "maxcpus" should be an integer greater than zero;
although, qemu-kvm has instead the invaild values to "1" and startup the guest, and in fact the value of "-smp" option is a invaid value;
And I found "-m" not speicaled , system will use a default value , but if a invaild setted, qemu will exit with error message;
[root@localhost ~]# qemu-kvm -m a
qemu: invalid ram size: a
I hope "-smp" option do same action like "-m" do;
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. create a image with : qemu-img create -f qcow2 /tmp/test.qcow2 1G
2. boot up guest with a invaild value "a" set to -smp option
guest boot up without any warning or error messgae about invaid value detected
qemu exit and with error message print out
Yes, parsing of -smp's argument is sloppy. Same upstream.
-help claims number of CPUs is mandatory, but the code treats it as optional.
* -smp ""
Since all parameters are optional, this has no effect
* -smp 0
Code interprets 0 as "use default", and the default is 1.
Same for all the named parameter values.
* -smp 4294967296
Argument is silently truncated to int, in this case to zero.
* -smp 1,sockets=
Named parameter with empty value is silently ignored.
* -smp 1,sockets=maybe
Named parameter value is parsed just as sloppily as the number of CPUs, in this case as zero.
* -smp 1,silly
Unknown parameters are silently ignored.
*** This bug has been marked as a duplicate of bug 745047 ***