Bug 601540

Summary: qemu requires ability to verify location of cpu model definition file..
Product: Red Hat Enterprise Linux 6 Reporter: john cooper <john.cooper>
Component: qemu-kvmAssignee: john cooper <john.cooper>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: juzhang, mjenner, mkenneth, nobody, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.86.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 619259 (view as bug list) Environment:
Last Closed: 2010-11-10 21:25:31 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: 619259    

Description john cooper 2010-06-08 07:13:51 UTC
+++ This bug was initially created as a clone of Bug #569661 +++

Description of problem:

This is a nagging problem since the new cpu models were added
to qemu.  By default qemu attempts to open config files at
the build configured paths and silently fails if they aren't
available.  This was an effort to preserve preexisting qemu
behavior but is causing confusion in test of this new
functionality.

Version-Release number of selected component (if applicable):
How reproducible:
Steps to Reproduce:
Actual results:

launch qemu without a properly installed cpu config
file.  No warnings are generated, and no new models
are defined.

Expected results:

A flag or equivalent method is needed to detail the
build configured conf file path and some warning
generated to the user when such wasn't accessible.
 

Additional info:

In general/upstream qemu usage the new models are not
yet in common usage so burping out a warning when config
files aren't located isn't realistic.  It _should_ be
trivial to simply add a flag to echo the build configured
file paths and warn when the config files are not found.
However the existing structure of qemu config file handling
makes this messier than it need be.

Comment 2 RHEL Program Management 2010-06-08 07:33:06 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 6 juzhang 2010-08-05 10:08:12 UTC
Tested on qemu-kvm-0.12.1.2-2.82.el6(unfixed version)

#/usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig ?
read config ?: No such file or directory


#/usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig /etc/qemu/target-x86_64.conf
VNC server running on `127.0.0.1:5900'

Results:
We must tell qemu-kvm where is cpu model definition file.


Tested on qemu-kvm-0.12.1.2-2.106.el6(fixed version)
I make 4 scenarios cover this issue.

1.Don't tell where is cpu model definition file,using ? instead

# /usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig ?
parsed config file /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf
can't open config file /etc/qemu/qemu.conf: No such file or directory
can't open config file /etc/qemu/target-x86_64.conf: No such file or directory
VNC server running on `::1:5900'

Results:
qemu-kvm can verify location of cpu model definition file.

2. Using invalided file and ? 
# /usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig foo -readconfig ?
parsed config file /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf
can't open config file /etc/qemu/qemu.conf: No such file or directory
can't open config file /etc/qemu/target-x86_64.conf: No such file or directory
can't open config file foo: No such file or directory

3. tell qemu-kvm the cpu model definition file.
#/usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf
VNC server running on `::1:5900'

4.2 cpu model definition file in host. cp /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf /etc/quem/target-x86_64.conf.now in host,have two configure file.
#/usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig /etc/qemu/target-x86_64.conf
VNC server running on `::1:5900'

If I add option "-readconfig /etc/qemu/target-x86_64.conf"
Please note.there have two "Opteron_G3,Opteron_G2.......",with my understand,qemu-kvm both read "/etc/qemu/target-x86_64.conf" and "/usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf".would you please tell me it's problem?
#/usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig /etc/qemu/target-x86_64.conf -cpu ?model
x86       Opteron_G3  AMD Opteron 23xx (Gen 3 Class Opteron)          
x86       Opteron_G2  AMD Opteron 22xx (Gen 2 Class Opteron)          
x86       Opteron_G1  AMD Opteron 240 (Gen 1 Class Opteron)           
x86          Nehalem  Intel Core i7 9xx (Nehalem Class Core i7)       
x86           Conroe  Intel Celeron_4x0 (Conroe/Merom Class Core 2)   
x86       Opteron_G3  AMD Opteron 23xx (Gen 3 Class Opteron)          
x86       Opteron_G2  AMD Opteron 22xx (Gen 2 Class Opteron)          
x86       Opteron_G1  AMD Opteron 240 (Gen 1 Class Opteron)           
x86          Nehalem  Intel Core i7 9xx (Nehalem Class Core i7)       
x86           Penryn  Intel Core 2 Duo P9xxx (Penryn Class Core 2)    
x86           Conroe  Intel Celeron_4x0 (Conroe/Merom Class Core 2)   
x86           [n270]  Intel(R) Atom(TM) CPU N270   @ 1.60GHz          
x86         [athlon]  QEMU Virtual CPU version 0.12.1                 
x86       [pentium3]                                                  
x86       [pentium2]                                                  
x86        [pentium]                                                  
x86            [486]                                                  
x86        [coreduo]  Genuine Intel(R) CPU           T2600  @ 2.16GHz 
x86         [qemu32]  QEMU Virtual CPU version 0.12.1                 
x86          [kvm64]  Common KVM processor                            
x86       [core2duo]  Intel(R) Core(TM)2 Duo CPU     T7700  @ 2.40GHz 
x86         [phenom]  AMD Phenom(tm) 9550 Quad-Core Processor         
x86         [qemu64]  QEMU Virtual CPU version 0.12.1    


John,

   If scenario is not a problem,would you please tell me my testing cover this issue?

Comment 7 john cooper 2010-08-07 04:56:17 UTC
(In reply to comment #6)
> Tested on qemu-kvm-0.12.1.2-2.106.el6(fixed version)
> I make 4 scenarios cover this issue.
> 
> 1.Don't tell where is cpu model definition file,using ? instead
> 
> # /usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig ?
> parsed config file /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf
> can't open config file /etc/qemu/qemu.conf: No such file or directory
> can't open config file /etc/qemu/target-x86_64.conf: No such file or directory
> VNC server running on `::1:5900'
> 
> Results:
> qemu-kvm can verify location of cpu model definition file.

Yes.  Note we've added "cpu-x86_64.conf" as a third default
configuration file of sorts for rhel6.0.  So the user doesn't
need to do anything other than let qemu find and read in
the installed config files.

> 2. Using invalided file and ? 
> # /usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig foo -readconfig ?
> parsed config file /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf
> can't open config file /etc/qemu/qemu.conf: No such file or directory
> can't open config file /etc/qemu/target-x86_64.conf: No such file or directory
> can't open config file foo: No such file or directory

This is correct behavior.  Basically it is still attempting to
use all default config files, plus the added test "foo" file,
and is honoring the "?" query informing the user of its operation.

> 3. tell qemu-kvm the cpu model definition file.
> #/usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig
> /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf
> VNC server running on `::1:5900'

Qemu is doing what is being asked.  But this is not
really something you want to do as it causes qemu to
read "cpu-x86_64.conf" twice.  That causes the replicated
definitions to occur as explained below.
 
> 4.2 cpu model definition file in host. cp
> /usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf /etc/quem/target-x86_64.conf.now
> in host,have two configure file.
> #/usr/libexec/qemu-kvm -m 4G -smp 2  -readconfig /etc/qemu/target-x86_64.conf
> VNC server running on `::1:5900'
> 
> If I add option "-readconfig /etc/qemu/target-x86_64.conf"
> Please note.there have two "Opteron_G3,Opteron_G2.......",with my
> understand,qemu-kvm both read "/etc/qemu/target-x86_64.conf" and
> "/usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf".would you please tell me it's
> problem?

You don't really want to do this as it replicates the same default
cpu config file contents.  This is similar to using an
/etc/qemu/target-x86_64.conf" from an older qemu installation.  The
old "/etc/qemu/target-x86_64.conf" contents were moved to
/usr/share/qemu-kvm/cpu-model/cpu-x86_64.conf".  This was in fact a
caution I had called out in the associated patch.  If an old
"target-x86_64.conf" happens to exist from a prior qemu installation,
you'll get this behavior as well.

Ugly details: the file parser is relatively simple and just reads in
whatever it is told to without any knowledge of whether a particular
config file has been already seen.  Also definitions are trivially
read into a list with the most recently read definitions residing at
the head of the list.  So later definitions will overshadow exact prior
definitions.  This is intentional as it allows the user to overshadow
the built-in definitions (eg: qemu64, etc..) with config file
re-definitions.

> John,
> 
>    If scenario is not a problem,would you please tell me my testing cover this
> issue?    

I think you can test whether a "/etc/qemu/target-x86_64.conf" file
exists prior to launching qemu.  We know it will pull this file
in if present and cause the above problem.  Note this should not
happen unless the new qemu version is installed over an existing
older qemu version.  Thus this should be limited to internal test
scenarios and not exist with a clean rhel6 install.

Comment 8 juzhang 2010-08-09 02:01:14 UTC
> 
> > John,
> > 
> >    If scenario is not a problem,would you please tell me my testing cover this
> > issue?    
> 
> I think you can test whether a "/etc/qemu/target-x86_64.conf" file
> exists prior to launching qemu.  We know it will pull this file
> in if present and cause the above problem.  Note this should not
> happen unless the new qemu version is installed over an existing
> older qemu version.  Thus this should be limited to internal test
> scenarios and not exist with a clean rhel6 install.    

Tested on qemu-kvm-0.12.1.2-2.106.el6(fresh installation)
#cd /etc/qemu
#ls

#ls | wc -l
0

Results:
No "/etc/qemu/target-x86_64.conf" file exists prior to launching qemu.

Comment 9 juzhang 2010-08-09 02:05:57 UTC
According to comment6 and comment8,mark this issue as verified.

Comment 10 releng-rhel@redhat.com 2010-11-10 21:25:31 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.