Bug 731645 - cpu-baseline should support the complete <capabilities> elements
Summary: cpu-baseline should support the complete <capabilities> elements
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-18 08:01 UTC by min zhan
Modified: 2018-05-24 13:51 UTC (History)
6 users (show)

Fixed In Version: libvirt-0.9.9-1.el6
Doc Type: Bug Fix
Doc Text:
No Documentation needed
Clone Of:
Environment:
Last Closed: 2012-06-20 06:30:06 UTC


Attachments (Terms of Use)
capabilities.xml (4.85 KB, text/plain)
2011-08-18 08:10 UTC, min zhan
no flags Details
test2.xml (1.03 KB, text/plain)
2011-08-18 08:10 UTC, min zhan
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 19:31:38 UTC

Description min zhan 2011-08-18 08:01:04 UTC
Description of problem:
From virsh man page, cpu-baseline not only support file including pure cpu element ,but also support a set of complete <capabilities> elements. But it fails when using capabilities.

Version-Release number of selected component (if applicable):
# uname -r
2.6.32-165.el6.x86_64
qemu-kvm-0.12.1.2-2.175.el6.x86_64
libvirt-0.9.4-4.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1.man virsh
...
       cpu-baseline FILE
           Compute baseline CPU which will be supported by all host CPUs given
           in <file>.  The list of host CPUs is built by extracting all <cpu>
           elements from the <file>. Thus, the <file> can contain either a set
           of <cpu> elements separated by new lines or even a set of complete
           <capabilities> elements printed by capabilities command.

2. Find 2 host and get capabilities of them.
Host 1:
# virsh capabilities > capabilities.xml

Host 2:
# virsh capabilities > capabilities1.xml

# scp capabilities1.xml Host1:/root

Host 1:
# cat capabilities1.xml >> capabilities.xml

3. check cpu-baseline
# virsh cpu-baseline capabilities.xml
error: internal error Missing CPU architecture
  
Actual results:
As above, XML file pls refer to attachments.

Expected results:
It should succeed according to virsh man page.

Additional info:
If I delete the other elements except cpu element in that xml, then cpu-baseline can succeed.
# virsh cpu-baseline test2.xml
<cpu match='exact'>
  <model>Penryn</model>
  <vendor>Intel</vendor>
  <feature policy='require' name='xtpr'/>
  <feature policy='require' name='tm2'/>
  <feature policy='require' name='est'/>
  <feature policy='require' name='vmx'/>
  <feature policy='require' name='ds_cpl'/>
  <feature policy='require' name='monitor'/>
  <feature policy='require' name='pbe'/>
  <feature policy='require' name='tm'/>
  <feature policy='require' name='ht'/>
  <feature policy='require' name='ss'/>
  <feature policy='require' name='acpi'/>
  <feature policy='require' name='ds'/>
  <feature policy='require' name='vme'/>
</cpu>

Comment 1 min zhan 2011-08-18 08:10:01 UTC
Created attachment 518817 [details]
capabilities.xml

Comment 2 min zhan 2011-08-18 08:10:42 UTC
Created attachment 518818 [details]
test2.xml

Comment 3 Jiri Denemark 2011-08-18 08:52:08 UTC
The problem is in virsh which takes all <cpu> elements from the provided xml document. So if capabilities xml contains NUMA topology, virsh selects not only the cpu element describing host CPU but also all <cpu id='N'/> elements that describe what CPUs belong to which NUMA cell. We need to select the cpu elements more strictly, we should only select cpu elements that contain arch (or maybe model) element since that is required to be present in host CPU xml.

Comment 4 Peter Krempa 2011-09-28 07:23:54 UTC
fixed with upstream patch:

commit b0889eae6a526f6097dd397d5ee68bb78a1f454b
Author:     Peter Krempa <pkrempa@redhat.com>
AuthorDate: Thu Sep 15 13:51:01 2011 +0200

    virsh: Allow using complete <capabilities> elements with cpu-baseline
    
    This patch cleans the cpu baseline function using new libvirt helper
    functions and fixes XPath expression that selects <cpu> elements from
    the source file, that can contain concatenated <capabilities> XMLs,
    domain XMLs and bare <cpu> elements. The fixed XPath expression ensures
    not to select NUMA <cpu id=... elements.

Comment 7 min zhan 2012-01-10 06:40:02 UTC
Verified this bug with libvirt-0.9.9-1.el6.

Steps:
1. Make sure 2 host capabilities xml contains NUMA topology

Host 1:
# virsh capabilities > capabilities1.xml

Host 2:
# virsh capabilities > capabilities.xml

# scp capabilities1.xml Host2:/root

Host 2:
# cat capabilities1.xml >> capabilities.xml

3. check cpu-baseline
# virsh cpu-baseline capabilities.xml
<cpu match='exact'>
  <model>Penryn</model>
  <vendor>Intel</vendor>
  <feature policy='require' name='dca'/>
  <feature policy='require' name='pdcm'/>
  <feature policy='require' name='xtpr'/>
  <feature policy='require' name='tm2'/>
  <feature policy='require' name='vmx'/>
  <feature policy='require' name='ds_cpl'/>
  <feature policy='require' name='monitor'/>
  <feature policy='require' name='dtes64'/>
  <feature policy='require' name='pbe'/>
  <feature policy='require' name='tm'/>
  <feature policy='require' name='ht'/>
  <feature policy='require' name='ss'/>
  <feature policy='require' name='acpi'/>
  <feature policy='require' name='ds'/>
  <feature policy='require' name='vme'/>
</cpu>

Comment 8 Peter Krempa 2012-05-02 09:54:37 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:
No Documentation needed

Comment 10 errata-xmlrpc 2012-06-20 06:30:06 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/RHSA-2012-0748.html


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