Merge "libvirt: Drop MIN_LIBVIRT_PF_WITH_NO_VFS_CAP_VERSION"

This commit is contained in:
Zuul 2018-09-21 12:59:27 +00:00 committed by Gerrit Code Review
commit 5d2d3d8c0d
2 changed files with 66 additions and 109 deletions

View File

@ -15006,11 +15006,6 @@ class LibvirtConnTestCase(test.NoDBTestCase,
_fake_NodeDevXml[name])) _fake_NodeDevXml[name]))
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False) drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
with mock.patch.object(
fakelibvirt.Connection, 'getLibVersion') as mock_lib_version:
mock_lib_version.return_value = (
versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_PF_WITH_NO_VFS_CAP_VERSION) - 1)
actualvf = drvr._get_pcidev_info("pci_0000_04_00_3") actualvf = drvr._get_pcidev_info("pci_0000_04_00_3")
expect_vf = { expect_vf = {
@ -15022,8 +15017,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
"label": 'label_8086_1521', "label": 'label_8086_1521',
"dev_type": fields.PciDeviceType.SRIOV_PF, "dev_type": fields.PciDeviceType.SRIOV_PF,
} }
self.assertEqual(expect_vf, actualvf) self.assertEqual(expect_vf, actualvf)
actualvf = drvr._get_pcidev_info("pci_0000_04_10_7") actualvf = drvr._get_pcidev_info("pci_0000_04_10_7")
expect_vf = { expect_vf = {
"dev_id": "pci_0000_04_10_7", "dev_id": "pci_0000_04_10_7",
@ -15055,22 +15050,6 @@ class LibvirtConnTestCase(test.NoDBTestCase,
} }
self.assertEqual(expect_vf, actualvf) self.assertEqual(expect_vf, actualvf)
with mock.patch.object(
pci_utils, 'is_physical_function', return_value=True):
actualvf = drvr._get_pcidev_info("pci_0000_04_00_1")
expect_vf = {
"dev_id": "pci_0000_04_00_1",
"address": "0000:04:00.1",
"product_id": '1013',
"numa_node": 0,
"vendor_id": '15b3',
"label": 'label_15b3_1013',
"dev_type": fields.PciDeviceType.SRIOV_PF,
}
self.assertEqual(expect_vf, actualvf)
with mock.patch.object(
pci_utils, 'is_physical_function', return_value=False):
actualvf = drvr._get_pcidev_info("pci_0000_04_00_1") actualvf = drvr._get_pcidev_info("pci_0000_04_00_1")
expect_vf = { expect_vf = {
"dev_id": "pci_0000_04_00_1", "dev_id": "pci_0000_04_00_1",
@ -15083,11 +15062,6 @@ class LibvirtConnTestCase(test.NoDBTestCase,
} }
self.assertEqual(expect_vf, actualvf) self.assertEqual(expect_vf, actualvf)
with mock.patch.object(
fakelibvirt.Connection, 'getLibVersion') as mock_lib_version:
mock_lib_version.return_value = (
versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_PF_WITH_NO_VFS_CAP_VERSION))
actualvf = drvr._get_pcidev_info("pci_0000_03_00_0") actualvf = drvr._get_pcidev_info("pci_0000_03_00_0")
expect_vf = { expect_vf = {
"dev_id": "pci_0000_03_00_0", "dev_id": "pci_0000_03_00_0",
@ -15110,7 +15084,6 @@ class LibvirtConnTestCase(test.NoDBTestCase,
"label": 'label_15b3_1013', "label": 'label_15b3_1013',
"dev_type": fields.PciDeviceType.SRIOV_PF, "dev_type": fields.PciDeviceType.SRIOV_PF,
} }
self.assertEqual(expect_vf, actualvf) self.assertEqual(expect_vf, actualvf)
def test_list_devices_not_supported(self): def test_list_devices_not_supported(self):

View File

@ -237,11 +237,6 @@ MIN_VIRTUOZZO_VERSION = (7, 0, 0)
# Ability to set the user guest password with parallels # Ability to set the user guest password with parallels
MIN_LIBVIRT_PARALLELS_SET_ADMIN_PASSWD = (2, 0, 0) MIN_LIBVIRT_PARALLELS_SET_ADMIN_PASSWD = (2, 0, 0)
# libvirt < 1.3 reported virt_functions capability
# only when VFs are enabled.
# libvirt 1.3 fix f391889f4e942e22b9ef8ecca492de05106ce41e
MIN_LIBVIRT_PF_WITH_NO_VFS_CAP_VERSION = (1, 3, 0)
# Use the "logd" backend for handling stdout/stderr from QEMU processes. # Use the "logd" backend for handling stdout/stderr from QEMU processes.
MIN_LIBVIRT_VIRTLOGD = (1, 3, 3) MIN_LIBVIRT_VIRTLOGD = (1, 3, 3)
MIN_QEMU_VIRTLOGD = (2, 7, 0) MIN_QEMU_VIRTLOGD = (2, 7, 0)
@ -5887,17 +5882,6 @@ class LibvirtDriver(driver.ComputeDriver):
'parent_addr': phys_address, 'parent_addr': phys_address,
} }
# Note(moshele): libvirt < 1.3 reported virt_functions capability
# only when VFs are enabled. The check below is a workaround
# to get the correct report regardless of whether or not any
# VFs are enabled for the device.
if not self._host.has_min_version(
MIN_LIBVIRT_PF_WITH_NO_VFS_CAP_VERSION):
is_physical_function = pci_utils.is_physical_function(
*pci_utils.get_pci_address_fields(pci_address))
if is_physical_function:
return {'dev_type': fields.PciDeviceType.SRIOV_PF}
return {'dev_type': fields.PciDeviceType.STANDARD} return {'dev_type': fields.PciDeviceType.STANDARD}
def _get_device_capabilities(device, address): def _get_device_capabilities(device, address):