Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 731645 - cpu-baseline should support the complete <capabilities> elements
cpu-baseline should support the complete <capabilities> elements
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.2
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-18 04:01 EDT by min zhan
Modified: 2018-05-24 09:51 EDT (History)
6 users (show)

See Also:
Fixed In Version: libvirt-0.9.9-1.el6
Doc Type: Bug Fix
Doc Text:
No Documentation needed
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 02:30:06 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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


External Trackers
Tracker 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 15:31:38 EDT

  None (edit)
Description min zhan 2011-08-18 04:01:04 EDT
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 04:10:01 EDT
Created attachment 518817 [details]
capabilities.xml
Comment 2 min zhan 2011-08-18 04:10:42 EDT
Created attachment 518818 [details]
test2.xml
Comment 3 Jiri Denemark 2011-08-18 04:52:08 EDT
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 03:23:54 EDT
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 01:40:02 EST
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 05:54:37 EDT
    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 02:30:06 EDT
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.