mirror of https://gitee.com/openkylin/libvirt.git
cpu-data.py: Allow for more than child in feature nodes
cpu-data.py assumes that all "feature" nodes have exactly one child. This assumption will no longer be true when the cpumap includes alias- names for features. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
56de80cb79
commit
10a41a8cbd
|
@ -445,12 +445,15 @@ def parseMap():
|
||||||
|
|
||||||
cpuMap = dict()
|
cpuMap = dict()
|
||||||
for f in xml.etree.ElementTree.parse(path).getroot().iter("feature"):
|
for f in xml.etree.ElementTree.parse(path).getroot().iter("feature"):
|
||||||
if f[0].tag not in ("cpuid", "msr"):
|
data = f.find("cpuid")
|
||||||
|
if data is None:
|
||||||
|
data = f.find("msr")
|
||||||
|
if data is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
feature = {"type": f[0].tag}
|
feature = {"type": data.tag}
|
||||||
for reg in _KEYS[f[0].tag] + _REGS[f[0].tag]:
|
for reg in _KEYS[data.tag] + _REGS[data.tag]:
|
||||||
feature[reg] = int(f[0].attrib.get(reg, "0"), 0)
|
feature[reg] = int(data.attrib.get(reg, "0"), 0)
|
||||||
cpuMap[f.attrib["name"]] = feature
|
cpuMap[f.attrib["name"]] = feature
|
||||||
return cpuMap
|
return cpuMap
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue