libvirt: cleanup baselineCPU return value checking

After MIN libvirt version bump to 1.2.1, baselineCPU won't return -1.
Remove -1 checking.

Change-Id: I3f9ffd7ff16bbdfe9071c4157a4d4b4f0dfe7e3b
This commit is contained in:
Eli Qiao 2016-06-15 09:31:20 +08:00
parent 279f1a9bf6
commit ef92e3f6fa
2 changed files with 1 additions and 12 deletions

View File

@ -684,13 +684,6 @@ class HostTestCase(test.NoDBTestCase):
self.assertRaises(fakelibvirt.libvirtError,
self.host.get_capabilities)
def test_lxc_get_host_capabilities_failed(self):
with mock.patch.object(fakelibvirt.virConnect, 'baselineCPU',
return_value=-1):
caps = self.host.get_capabilities()
self.assertEqual(vconfig.LibvirtConfigCaps, type(caps))
self.assertNotIn('aes', [x.name for x in caps.host.cpu.features])
def test_get_capabilities_no_host_cpu_model(self):
"""Tests that cpu features are not retrieved when the host cpu model
is not in the capabilities.

View File

@ -671,11 +671,7 @@ class Host(object):
features = self.get_connection().baselineCPU(
[self._caps.host.cpu.to_xml()],
libvirt.VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES)
# FIXME(wangpan): the return value of baselineCPU should be
# None or xml string, but libvirt has a bug
# of it from 1.1.2 which is fixed in 1.2.0,
# this -1 checking should be removed later.
if features and features != -1:
if features:
cpu = vconfig.LibvirtConfigCPU()
cpu.parse_str(features)
self._caps.host.cpu.features = cpu.features