diff --git a/nova/tests/functional/libvirt/test_reshape.py b/nova/tests/functional/libvirt/test_reshape.py index c6b029444f6d..388161489b46 100644 --- a/nova/tests/functional/libvirt/test_reshape.py +++ b/nova/tests/functional/libvirt/test_reshape.py @@ -29,8 +29,6 @@ LOG = logging.getLogger(__name__) class VGPUReshapeTests(base.ServersTestBase): - # the minimum libvirt version needed for vgpu - MIN_LIBVIRT_MDEV_SUPPORT = 3004000 @mock.patch('nova.virt.libvirt.LibvirtDriver._get_local_gb_info', return_value={'total': 128, @@ -64,7 +62,6 @@ class VGPUReshapeTests(base.ServersTestBase): fake_connection = self._get_connection( # We need more RAM or the 3rd server won't be created host_info=fakelibvirt.HostInfo(kB_mem=8192), - libvirt_version=self.MIN_LIBVIRT_MDEV_SUPPORT, mdev_info=fakelibvirt.HostMdevDevicesInfo()) self.mock_conn.return_value = fake_connection diff --git a/nova/tests/unit/virt/libvirt/fakelibvirt.py b/nova/tests/unit/virt/libvirt/fakelibvirt.py index d73e90c4751a..0848fc656599 100644 --- a/nova/tests/unit/virt/libvirt/fakelibvirt.py +++ b/nova/tests/unit/virt/libvirt/fakelibvirt.py @@ -169,9 +169,9 @@ VIR_SECRET_USAGE_TYPE_CEPH = 2 VIR_SECRET_USAGE_TYPE_ISCSI = 3 # Libvirt version to match MIN_LIBVIRT_VERSION in driver.py -FAKE_LIBVIRT_VERSION = 3000000 +FAKE_LIBVIRT_VERSION = 4000000 # Libvirt version to match MIN_QEMU_VERSION in driver.py -FAKE_QEMU_VERSION = 2008000 +FAKE_QEMU_VERSION = 2011000 PCI_VEND_ID = '8086' PCI_VEND_NAME = 'Intel Corporation' diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index d3b94d38e02b..fbd56bf53908 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -6066,7 +6066,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, # finally if the min version is not met assert that # the video model is not supported. min_version_mock.return_value = False - self.assertFalse(drvr._video_model_supported("gop")) + self.assertFalse(drvr._video_model_supported("none")) @mock.patch.object(libvirt_driver.LibvirtDriver, '_video_model_supported') def test__add_video_driver_gop(self, _supports_gop_video): @@ -22734,11 +22734,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin): @mock.patch.object(host.Host, 'device_lookup_by_name') @mock.patch.object(host.Host, 'list_mdev_capable_devices') - @mock.patch.object(fakelibvirt.Connection, 'getLibVersion', - return_value=versionutils.convert_version_to_int( - libvirt_driver.MIN_LIBVIRT_MDEV_SUPPORT)) - def test_get_mdev_capable_devices(self, _get_libvirt_version, - list_mdev_capable_devs, + def test_get_mdev_capable_devices(self, list_mdev_capable_devs, device_lookup_by_name): list_mdev_capable_devs.return_value = ['pci_0000_06_00_0'] @@ -22759,11 +22755,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin): @mock.patch.object(host.Host, 'device_lookup_by_name') @mock.patch.object(host.Host, 'list_mdev_capable_devices') - @mock.patch.object(fakelibvirt.Connection, 'getLibVersion', - return_value=versionutils.convert_version_to_int( - libvirt_driver.MIN_LIBVIRT_MDEV_SUPPORT)) - def test_get_mdev_capable_devices_filtering(self, _get_libvirt_version, - list_mdev_capable_devs, + def test_get_mdev_capable_devices_filtering(self, list_mdev_capable_devs, device_lookup_by_name): list_mdev_capable_devs.return_value = ['pci_0000_06_00_0'] @@ -22780,11 +22772,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin): @mock.patch.object(host.Host, 'device_lookup_by_name') @mock.patch.object(host.Host, 'list_mediated_devices') - @mock.patch.object(fakelibvirt.Connection, 'getLibVersion', - return_value=versionutils.convert_version_to_int( - libvirt_driver.MIN_LIBVIRT_MDEV_SUPPORT)) - def test_get_mediated_devices(self, _get_libvirt_version, - list_mediated_devices, + def test_get_mediated_devices(self, list_mediated_devices, device_lookup_by_name): list_mediated_devices.return_value = [ 'mdev_4b20d080_1b54_4048_85b3_a6a62d165c01'] @@ -22804,11 +22792,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin): @mock.patch.object(host.Host, 'device_lookup_by_name') @mock.patch.object(host.Host, 'list_mediated_devices') - @mock.patch.object(fakelibvirt.Connection, 'getLibVersion', - return_value=versionutils.convert_version_to_int( - libvirt_driver.MIN_LIBVIRT_MDEV_SUPPORT)) - def test_get_mediated_devices_filtering(self, _get_libvirt_version, - list_mediated_devices, + def test_get_mediated_devices_filtering(self, list_mediated_devices, device_lookup_by_name): list_mediated_devices.return_value = [ 'mdev_4b20d080_1b54_4048_85b3_a6a62d165c01'] @@ -23069,13 +23053,9 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin): @mock.patch.object(os.path, 'exists') @mock.patch.object(libvirt_driver.LibvirtDriver, '_get_all_assigned_mediated_devices') - @mock.patch.object(fakelibvirt.Connection, 'getLibVersion', - return_value=versionutils.convert_version_to_int( - libvirt_driver.MIN_LIBVIRT_MDEV_SUPPORT)) def test_recreate_mediated_device_on_init_host( - self, _get_libvirt_version, - get_all_assigned_mdevs, exists, get_mdev_capable_devs, - privsep_create_mdev): + self, get_all_assigned_mdevs, exists, + get_mdev_capable_devs, privsep_create_mdev): self.flags(enabled_vgpu_types=['nvidia-11'], group='devices') get_all_assigned_mdevs.return_value = {uuids.mdev1: uuids.inst1, uuids.mdev2: uuids.inst2} diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index b56c3b2df5ff..ca15d7e534e0 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -227,8 +227,8 @@ patch_tpool_proxy() # versions. Over time, this will become a common min version # for all architectures/hypervisors, as this value rises to # meet them. -MIN_LIBVIRT_VERSION = (3, 0, 0) -MIN_QEMU_VERSION = (2, 8, 0) +MIN_LIBVIRT_VERSION = (4, 0, 0) +MIN_QEMU_VERSION = (2, 11, 0) # TODO(berrange): Re-evaluate this at start of each release cycle # to decide if we want to plan a future min version bump. # MIN_LIBVIRT_VERSION can be updated to match this after @@ -265,8 +265,6 @@ PERF_EVENTS_CPU_FLAG_MAPPING = {'cmt': 'cmt', 'mbmt': 'mbm_total', } -# Mediated devices support -MIN_LIBVIRT_MDEV_SUPPORT = (3, 4, 0) # libvirt>=3.10 is required for volume multiattach unless qemu<2.10. # See https://bugzilla.redhat.com/show_bug.cgi?id=1378242 @@ -291,7 +289,6 @@ VGPU_RESOURCE_SEMAPHORE = "vgpu_resources" # see https://libvirt.org/formatdomain.html#elementsVideo MIN_LIBVIRT_VIDEO_MODEL_VERSIONS = { - fields.VideoModel.GOP: (3, 2, 0), fields.VideoModel.NONE: (4, 6, 0), } @@ -740,8 +737,7 @@ class LibvirtDriver(driver.ComputeDriver): # TODO(sbauza): Remove this code once mediated devices are persisted # across reboots. - if self._host.has_min_version(MIN_LIBVIRT_MDEV_SUPPORT): - self._recreate_assigned_mediated_devices() + self._recreate_assigned_mediated_devices() self._check_cpu_compatibility() @@ -6698,8 +6694,6 @@ class LibvirtDriver(driver.ComputeDriver): :param types: Filter only devices supporting those types. """ - if not self._host.has_min_version(MIN_LIBVIRT_MDEV_SUPPORT): - return [] dev_names = self._host.list_mdev_capable_devices() or [] mdev_capable_devices = [] for name in dev_names: @@ -6735,8 +6729,6 @@ class LibvirtDriver(driver.ComputeDriver): :param types: Filter only devices supporting those types. """ - if not self._host.has_min_version(MIN_LIBVIRT_MDEV_SUPPORT): - return [] dev_names = self._host.list_mediated_devices() or [] mediated_devices = [] for name in dev_names: