Bug 852642

Summary: qemu process should exit when a invaild value set for "-smp"
Product: Red Hat Enterprise Linux 6 Reporter: Xu Tian <xutian>
Component: qemu-kvmAssignee: Markus Armbruster <armbru>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 6.4CC: acathrow, areis, bsarathy, dyasny, ehabkost, juzhang, mkenneth, shuang, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-07 20:29:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xu Tian 2012-08-29 08:11:19 UTC
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):


How reproducible:


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
  
Actual results:

guest boot up without any warning or error messgae about invaid value detected

Expected results:

qemu exit and with error message print out

Additional info:

Comment 1 Markus Armbruster 2012-09-07 10:19:14 UTC
Yes, parsing of -smp's argument is sloppy.  Same upstream.

-help claims number of CPUs is mandatory, but the code treats it as optional.

Additional funnies:

* -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
  -smp 1,qemu=moron

  Unknown parameters are silently ignored.

Comment 2 Ademar Reis 2012-09-07 20:29:05 UTC

*** This bug has been marked as a duplicate of bug 745047 ***