From 22c1916b49a774fceebeffa7fc5da1a40573d26c Mon Sep 17 00:00:00 2001 From: Kashyap Chamarthy Date: Tue, 19 Nov 2019 18:34:27 +0100 Subject: [PATCH] libvirt: Bump MIN_{LIBVIRT,QEMU}_VERSION for "Ussuri" We didn't bump the MIN_{LIBVIRT_QEMU} For the "Train" release, although we advertized it[1]. Let's actually bump it for "Ussuri", while we're early on in the development cycle to give it enough "soaking time". As part of this bump, fix the small fallout: - Remove the MIN_LIBVIRT_MDEV_SUPPORT version constant; fix tests. - Remove the "GOP" (Graphic Output Protocol) video model version constant from MIN_LIBVIRT_VIDEO_MODEL_VERSIONS; fix tests. - Fix the fucntional test: VGPUReshapeTests.test_create_servers_with_vgpu The following version constants and related tests, which are now no longer required, will be removed in separate patches: MIN_LIBVIRT_KVM_AARCH64_VERSION MIN_LIBVIRT_MULTIATTACH MIN_LIBVIRT_FILE_BACKED_VERSION MIN_QEMU_FILE_BACKED_VERSION MIN_QEMU_FILE_BACKED_DISCARD_VERSION And here[2] is the discussion for picking future libvirt/QEMU versions for "V" release on the list. [1] https://opendev.org/openstack/nova/commit/489b5f762e -- Pick next minimum libvirt / QEMU versions for "T" release, 2018-09-25) [2] http://lists.openstack.org/pipermail/openstack-discuss/2019-November/010907.html -- On next minimum libvirt / QEMU versions for "V" release Change-Id: Ia18e9be4d07b732afd9db0007c541253f3cdaf82 Signed-off-by: Kashyap Chamarthy --- nova/tests/functional/libvirt/test_reshape.py | 3 -- nova/tests/unit/virt/libvirt/fakelibvirt.py | 4 +-- nova/tests/unit/virt/libvirt/test_driver.py | 34 ++++--------------- nova/virt/libvirt/driver.py | 14 ++------ 4 files changed, 12 insertions(+), 43 deletions(-) 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 b4368ea048b8..57c1da9668ba 100644 --- a/nova/tests/unit/virt/libvirt/fakelibvirt.py +++ b/nova/tests/unit/virt/libvirt/fakelibvirt.py @@ -168,9 +168,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 7d78885183ca..b5796cc813ea 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -6089,7 +6089,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): @@ -22731,11 +22731,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'] @@ -22756,11 +22752,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'] @@ -22777,11 +22769,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'] @@ -22801,11 +22789,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'] @@ -23066,13 +23050,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 a036f3c18156..9a9c46b96be2 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() @@ -6701,8 +6697,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: @@ -6738,8 +6732,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: