summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2014-03-12 20:59:33 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2014-03-13 16:50:40 +0100
commit6c2645f0d2a33bdd189858b07ad771d9242ea4a5 (patch)
tree254055b036aebd5db8a959aa9078d432544e02b7
parent143a68959277e01f8fb90f09e2ba9e9d4b0fd9d1 (diff)
downloadvirt-manager-6c2645f0d2a33bdd189858b07ad771d9242ea4a5.tar.gz
virtinst: drop parsing of cpu features
As for the previous patch, this information is not used anywhere and this information should be retrieved using the libvirt baselineCPU API. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r--tests/capabilities.py20
-rw-r--r--virtinst/capabilities.py36
2 files changed, 7 insertions, 49 deletions
diff --git a/tests/capabilities.py b/tests/capabilities.py
index b718dc1c..c062e4c3 100644
--- a/tests/capabilities.py
+++ b/tests/capabilities.py
@@ -225,37 +225,23 @@ class TestCapabilities(unittest.TestCase):
cpu_32 = caps.get_cpu_values("i486")
cpu_random = caps.get_cpu_values("mips")
- def test_cpu_map(cpumap, vendors, cpus):
+ def test_cpu_map(cpumap, cpus):
cpunames = sorted([c.model for c in cpumap.cpus],
key=str.lower)
- for v in vendors:
- self.assertTrue(v in cpumap.vendors)
for c in cpus:
self.assertTrue(c in cpunames)
- def test_single_cpu(cpumap, model, vendor, features):
- cpu = cpumap.get_cpu(model)
- self.assertEquals(cpu.vendor, vendor)
- self.assertEquals(cpu.features, features)
-
self.assertEquals(cpu_64, cpu_32)
- x86_vendors = ["AMD", "Intel"]
x86_cpunames = [
'486', 'athlon', 'Conroe', 'core2duo', 'coreduo', 'n270',
'Nehalem', 'Opteron_G1', 'Opteron_G2', 'Opteron_G3', 'Penryn',
'pentium', 'pentium2', 'pentium3', 'pentiumpro', 'phenom',
'qemu32', 'qemu64']
- test_cpu_map(cpu_64, x86_vendors, x86_cpunames)
- test_cpu_map(cpu_random, [], [])
-
- athlon_features = [
- '3dnow', '3dnowext', 'apic', 'cmov', 'cx8', 'de', 'fpu', 'fxsr',
- 'mce', 'mmx', 'mmxext', 'msr', 'mtrr', 'pae', 'pat', 'pge', 'pse',
- 'pse36', 'sep', 'sse', 'sse2', 'tsc', 'vme']
- test_single_cpu(cpu_64, "athlon", "AMD", athlon_features)
+ test_cpu_map(cpu_64, x86_cpunames)
+ test_cpu_map(cpu_random, [])
if __name__ == "__main__":
unittest.main()
diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py
index 2fe2c0a9..2ab39cdd 100644
--- a/virtinst/capabilities.py
+++ b/virtinst/capabilities.py
@@ -37,34 +37,10 @@ def xpathString(node, path, default=None):
class CPUValuesModel(object):
"""
- Single <model> definition from cpu_map
+ Single CPU model
"""
- def __init__(self, node):
- self.model = node.prop("name")
- self.features = []
- self.parent = None
- self.vendor = None
-
- self._parseXML(node)
-
- def _parseXML(self, node):
- child = node.children
- while child:
- if child.name == "model":
- self.parent = child.prop("name")
- if child.name == "vendor":
- self.vendor = child.prop("name")
- if child.name == "feature":
- self.features.append(child.prop("name"))
-
- child = child.next
-
- self.features.sort()
-
- def inheritParent(self, parentcpu):
- self.vendor = parentcpu.vendor or self.vendor
- self.features += parentcpu.features
- self.features.sort()
+ def __init__(self, model):
+ self.model = model
class CPUValuesArch(object):
@@ -85,11 +61,7 @@ class CPUValuesArch(object):
if child.name == "vendor":
self.vendors.append(child.prop("name"))
if child.name == "model":
- newcpu = CPUValuesModel(child)
- if newcpu.parent:
- for chkcpu in self.cpus:
- if chkcpu.model == newcpu.parent:
- newcpu.inheritParent(chkcpu)
+ newcpu = CPUValuesModel(child.prop("name"))
self.cpus.append(newcpu)
child = child.next