[virt-tools-list] [PATCH virt-manager 1/3] virtinst: drop cpu_map parsing of arch features

Cole Robinson crobinso at redhat.com
Thu Mar 13 15:31:26 UTC 2014


On 03/13/2014 08:51 AM, Giuseppe Scrivano wrote:
> This information is not used anywhere and there is no way to read
> it directly from libvirt without parsing the cpu_map.xml file.
> 
> Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
> ---
>  tests/capabilities.py    | 21 ++++-----------------
>  virtinst/capabilities.py |  6 +-----
>  2 files changed, 5 insertions(+), 22 deletions(-)
> 
> diff --git a/tests/capabilities.py b/tests/capabilities.py
> index b712f8d..b718dc1 100644
> --- a/tests/capabilities.py
> +++ b/tests/capabilities.py
> @@ -1,4 +1,4 @@
> -# Copyright (C) 2013 Red Hat, Inc.
> +# Copyright (C) 2013, 2014 Red Hat, Inc.
>  #
>  # This program is free software; you can redistribute it and/or modify
>  # it under the terms of the GNU General Public License as published by
> @@ -225,14 +225,12 @@ class TestCapabilities(unittest.TestCase):
>          cpu_32 = caps.get_cpu_values("i486")
>          cpu_random = caps.get_cpu_values("mips")
>  
> -        def test_cpu_map(cpumap, vendors, features, cpus):
> +        def test_cpu_map(cpumap, vendors, cpus):
>              cpunames = sorted([c.model for c in cpumap.cpus],
>                                key=str.lower)
>  
>              for v in vendors:
>                  self.assertTrue(v in cpumap.vendors)
> -            for f in features:
> -                self.assertTrue(f in cpumap.features)
>              for c in cpus:
>                  self.assertTrue(c in cpunames)
>  
> @@ -244,25 +242,14 @@ class TestCapabilities(unittest.TestCase):
>          self.assertEquals(cpu_64, cpu_32)
>  
>          x86_vendors = ["AMD", "Intel"]
> -        x86_features = [
> -            '3dnow', '3dnowext', '3dnowprefetch', 'abm', 'acpi', 'apic',
> -            'cid', 'clflush', 'cmov', 'cmp_legacy', 'cr8legacy', 'cx16',
> -            'cx8', 'dca', 'de', 'ds', 'ds_cpl', 'est', 'extapic', 'fpu',
> -            'fxsr', 'fxsr_opt', 'ht', 'hypervisor', 'ia64', 'lahf_lm', 'lm',
> -            'mca', 'mce', 'misalignsse', 'mmx', 'mmxext', 'monitor', 'msr',
> -            'mtrr', 'nx', 'osvw', 'pae', 'pat', 'pbe', 'pdpe1gb', 'pge', 'pn',
> -            'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'sep', 'skinit', 'ss',
> -            'sse', 'sse2', 'sse4.1', 'sse4.2', 'sse4a', 'ssse3', 'svm',
> -            'syscall', 'tm', 'tm2', 'tsc', 'vme', 'vmx', 'wdt', 'x2apic',
> -            'xtpr']
>          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_features, x86_cpunames)
> -        test_cpu_map(cpu_random, [], [], [])
> +        test_cpu_map(cpu_64, x86_vendors, x86_cpunames)
> +        test_cpu_map(cpu_random, [], [])
>  
>          athlon_features = [
>              '3dnow', '3dnowext', 'apic', 'cmov', 'cx8', 'de', 'fpu', 'fxsr',
> diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py
> index b8d3330..2fe2c0a 100644
> --- a/virtinst/capabilities.py
> +++ b/virtinst/capabilities.py
> @@ -1,7 +1,7 @@
>  #
>  # Some code for parsing libvirt's capabilities XML
>  #
> -# Copyright 2007, 2012-2013 Red Hat, Inc.
> +# Copyright 2007, 2012-2014 Red Hat, Inc.
>  # Mark McLoughlin <markmc at redhat.com>
>  #
>  # This program is free software; you can redistribute it and/or modify
> @@ -75,7 +75,6 @@ class CPUValuesArch(object):
>          self.arch = arch
>          self.vendors = []
>          self.cpus = []
> -        self.features = []
>  
>          if node:
>              self._parseXML(node)
> @@ -85,8 +84,6 @@ class CPUValuesArch(object):
>          while child:
>              if child.name == "vendor":
>                  self.vendors.append(child.prop("name"))
> -            if child.name == "feature":
> -                self.features.append(child.prop("name"))
>              if child.name == "model":
>                  newcpu = CPUValuesModel(child)
>                  if newcpu.parent:
> @@ -98,7 +95,6 @@ class CPUValuesArch(object):
>              child = child.next
>  
>          self.vendors.sort()
> -        self.features.sort()
>  
>      def get_cpu(self, model):
>          for c in self.cpus:
> 

ACK

- Cole




More information about the virt-tools-list mailing list