Red Hat Bugzilla – Bug 731645
cpu-baseline should support the complete <capabilities> elements
Last modified: 2018-05-24 09:51:54 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>
Created attachment 518817 [details] capabilities.xml
Created attachment 518818 [details] test2.xml
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.
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.
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>
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
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