capabilities: Drop old svm/vmx handling

We don't realisistically support these old libvirt versions anymore
This commit is contained in:
Cole Robinson 2018-06-12 11:17:33 -04:00
parent b6cd46b382
commit e12049b114
4 changed files with 3 additions and 60 deletions

View File

@ -1,26 +0,0 @@
<capabilities>
<host>
<cpu>
<arch>x86_64</arch>
<features>
<svm/>
</features>
</cpu>
<migration_features>
<live/>
<uri_transports>
<uri_transport>xenmigr</uri_transport>
</uri_transports>
</migration_features>
<topology>
<cells num='1'>
<cell id='0'>
<cpus num='2'>
<cpu id='0'/>
<cpu id='1'/>
</cpus>
</cell>
</cells>
</topology>
</host>
</capabilities>

View File

@ -18,22 +18,6 @@ class TestCapabilities(unittest.TestCase):
conn = utils.URIs.open_testdefault_cached()
return Capabilities(conn, open(path).read())
def testCapsCPUFeaturesOldSyntax(self):
filename = "test-old-vmx.xml"
host_feature_list = ["vmx"]
caps = self._buildCaps(filename)
for f in host_feature_list:
self.assertEqual(caps.host.cpu.has_feature(f), True)
def testCapsCPUFeaturesOldSyntaxSVM(self):
filename = "test-old-svm.xml"
host_feature_list = ["svm"]
caps = self._buildCaps(filename)
for f in host_feature_list:
self.assertEqual(caps.host.cpu.has_feature(f), True)
def testCapsCPUFeaturesNewSyntax(self):
filename = "test-qemu-with-kvm.xml"
host_feature_list = ['lahf_lm', 'xtpr', 'cx16', 'tm2', 'est', 'vmx',
@ -41,7 +25,8 @@ class TestCapabilities(unittest.TestCase):
caps = self._buildCaps(filename)
for f in host_feature_list:
self.assertEqual(caps.host.cpu.has_feature(f), True)
self.assertEqual(
f in [feat.name for feat in caps.host.cpu.features], True)
self.assertEqual(caps.host.cpu.model, "core2duo")
self.assertEqual(caps.host.cpu.vendor, "Intel")
@ -52,7 +37,7 @@ class TestCapabilities(unittest.TestCase):
def testCapsUtilFuncs(self):
caps_with_kvm = self._buildCaps("test-qemu-with-kvm.xml")
caps_no_kvm = self._buildCaps("test-qemu-no-kvm.xml")
caps_empty = self._buildCaps("test-old-vmx.xml")
caps_empty = self._buildCaps("test-empty.xml")
def test_utils(caps, has_guests, is_kvm):
if caps.guests:

View File

@ -20,22 +20,6 @@ from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
class _CapsCPU(DomainCpu):
arch = XMLProperty("./arch")
# capabilities used to just expose these properties as bools
_svm_bool = XMLProperty("./features/svm", is_bool=True)
_vmx_bool = XMLProperty("./features/vmx", is_bool=True)
##############
# Public API #
##############
def has_feature(self, name):
if name == "svm" and self._svm_bool:
return True
if name == "vmx" and self._vmx_bool:
return True
return name in [f.name for f in self.features]
###########################
# Caps <topology> parsers #