From f7d99623edfeacb9fc30de9c1e74650670cd8202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ribaud?= Date: Wed, 26 Feb 2025 21:05:38 +0100 Subject: [PATCH] Bump MIN_{LIBVIRT,QEMU} for "Epoxy" The minimum required version of QEMU is now 6.2.0, and of libvirt is 8.0.0. Minimum cleanup to make the tests happy. Adjust the related unit tests accordingly. Following patch will clean all constants not useful anymore. Change-Id: I381a6c180494ed7b6ae47853132673f153733587 --- .../libvirt-distro-support-matrix.rst | 67 ++++----- .../libvirt/test_pci_sriov_servers.py | 2 +- .../functional/libvirt/test_server_shares.py | 4 +- nova/tests/functional/libvirt/test_vgpu.py | 11 +- .../regressions/test_bug_1951656.py | 49 ------- .../regressions/test_bug_2074219.py | 2 +- nova/tests/unit/virt/libvirt/test_driver.py | 131 ------------------ nova/virt/libvirt/driver.py | 14 +- ...rt-QEMU-version-bump-acfbb1b9228e1136.yaml | 10 ++ 9 files changed, 55 insertions(+), 235 deletions(-) delete mode 100644 nova/tests/functional/regressions/test_bug_1951656.py create mode 100644 releasenotes/notes/epoxy-libvirt-QEMU-version-bump-acfbb1b9228e1136.yaml diff --git a/doc/source/reference/libvirt-distro-support-matrix.rst b/doc/source/reference/libvirt-distro-support-matrix.rst index 396078e8a50d..e895a4b19d84 100644 --- a/doc/source/reference/libvirt-distro-support-matrix.rst +++ b/doc/source/reference/libvirt-distro-support-matrix.rst @@ -211,6 +211,12 @@ support the decided libvirt version. - 8.0.0 - 5.2.0 - 6.2.0 + * - 2025.1 Epoxy + - 31.0.0 + - 8.0.0 + - 10.0.0 + - 6.2.0 + - 8.2.2 OS distribution versions @@ -244,10 +250,10 @@ important OS distros. - 5.2.0-16 - 1.44.0-2 * - 9 - - As of 2021-11-18. - - 7.8.0-1 - - 6.1.0-6 - - 1.46.0-4 + - As of 2025-02-27. + - 10.10.0 + - 9.1.0 + - 1.50.1 * - **Debian** - - @@ -258,41 +264,16 @@ important OS distros. - 7.0.0 - 5.2 - 1.42.0 - * - 12.x (Bookworm) ("testing") - - No GA date as of 2021-11-18 - - 7.6.0 - - 6.1 - - 1.42.0 - * - **Fedora** - - - - - - - - - * - 34 - - 2021-04-27 - - 7.0.0 - - 5.2.0 - - 1.45.4 - * - 35 - - 2021-11-02 - - 7.6.0 - - 6.1.0 - - 1.46.0 - * - **SUSE** - - - - - - - - - * - Leap 15.2 - - 2020-07-02 - - 6.0.0 - - 4.2.0 - - 1.38.0 - * - Leap 15.3 - - 2021-06-02 + * - 12.x (Bookworm) + - 2023-06-10 + - 9.0.0 - 7.2.0 - - 6.0.0 - - 1.44.1 + - 1.48.6 + * - 13.x (Trixie) ("testing") + - No GA date as of 2025-02-27 + - 11.0.0 + - 9.2.1 + - 1.54.0 * - **RHEL** - - @@ -348,6 +329,16 @@ important OS distros. - 7.0.0 - 5.2 - 1.44.1 + * - 22.04 (Jammy Jellyfish) + - 2022-04-21 + - 8.0.0 + - 6.2 + - 1.44.2 + * - 24.04 (Noble Numbat) + - 2024-04-25 + - 10.0.0 + - 8.2.2 + - 1.52.0 .. NB: maintain alphabetical ordering of distros, followed by oldest released versions first diff --git a/nova/tests/functional/libvirt/test_pci_sriov_servers.py b/nova/tests/functional/libvirt/test_pci_sriov_servers.py index 2108151e711a..ab8db11deb94 100644 --- a/nova/tests/functional/libvirt/test_pci_sriov_servers.py +++ b/nova/tests/functional/libvirt/test_pci_sriov_servers.py @@ -3717,7 +3717,7 @@ class RemoteManagedServersTest(_PCIServersWithMigrationTestBase): vf_ratio = NUM_VFS // NUM_PFS # Min Libvirt version that supports working with PCI VPD. - FAKE_LIBVIRT_VERSION = 7_009_000 # 7.9.0 + FAKE_LIBVIRT_VERSION = 8_000_000 # 8.0.0 def setUp(self): super().setUp() diff --git a/nova/tests/functional/libvirt/test_server_shares.py b/nova/tests/functional/libvirt/test_server_shares.py index 8b775348f054..fe6256a56492 100644 --- a/nova/tests/functional/libvirt/test_server_shares.py +++ b/nova/tests/functional/libvirt/test_server_shares.py @@ -36,8 +36,8 @@ class ServerSharesTestBase(base.ServersTestBase): api_major_version = 'v2.1' microversion = 'latest' ADMIN_API = True - FAKE_LIBVIRT_VERSION = 7000000 - FAKE_QEMU_VERSION = 5002000 + FAKE_LIBVIRT_VERSION = 8000000 + FAKE_QEMU_VERSION = 6002000 def setUp(self): super(ServerSharesTestBase, self).setUp() diff --git a/nova/tests/functional/libvirt/test_vgpu.py b/nova/tests/functional/libvirt/test_vgpu.py index c09e8539458b..f9f6f3e863e0 100644 --- a/nova/tests/functional/libvirt/test_vgpu.py +++ b/nova/tests/functional/libvirt/test_vgpu.py @@ -42,8 +42,8 @@ class VGPUTestBase(base.ServersTestBase): microversion = 'latest' ADMIN_API = True - FAKE_LIBVIRT_VERSION = 7000000 - FAKE_QEMU_VERSION = 5002000 + FAKE_LIBVIRT_VERSION = 8000000 + FAKE_QEMU_VERSION = 6002000 # Since we run all computes by a single process, we need to identify which # current compute service we use at the moment. @@ -869,10 +869,3 @@ class DifferentMdevClassesTests(VGPUTestBase): expected_rc='CUSTOM_NOTVGPU') self.assert_mdev_usage(self.compute2, expected_amount=1, expected_rc='CUSTOM_NOTVGPU') - - -class VGPUTestsLibvirt7_3(VGPUTests): - - # Minimum version supporting persistent mdevs is 7.3.0. - # https://libvirt.org/drvnodedev.html#mediated-devices-mdevs - FAKE_LIBVIRT_VERSION = 7003000 diff --git a/nova/tests/functional/regressions/test_bug_1951656.py b/nova/tests/functional/regressions/test_bug_1951656.py deleted file mode 100644 index ef4646180710..000000000000 --- a/nova/tests/functional/regressions/test_bug_1951656.py +++ /dev/null @@ -1,49 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from nova.tests.fixtures import libvirt as fakelibvirt -from nova.tests.functional.libvirt import test_vgpu - - -class VGPUTestsLibvirt7_7(test_vgpu.VGPUTestBase): - - FAKE_LIBVIRT_VERSION = 7007000 - - def setUp(self): - super(VGPUTestsLibvirt7_7, self).setUp() - extra_spec = {"resources:VGPU": "1"} - self.flavor = self._create_flavor(extra_spec=extra_spec) - - # Start compute1 supporting only nvidia-11 - self.flags( - enabled_mdev_types=fakelibvirt.NVIDIA_11_VGPU_TYPE, - group='devices') - - self.compute1 = self.start_compute_with_vgpu('host1') - - def test_create_servers_with_vgpu(self): - - # Create a single instance against a specific compute node. - self._create_server( - image_uuid='155d900f-4e14-4e4c-a73d-069cbf4541e6', - flavor_id=self.flavor, host=self.compute1.host, - networks='auto', expected_state='ACTIVE') - - self.assert_mdev_usage(self.compute1, expected_amount=1) - - self._create_server( - image_uuid='155d900f-4e14-4e4c-a73d-069cbf4541e6', - flavor_id=self.flavor, host=self.compute1.host, - networks='auto', expected_state='ACTIVE') - - self.assert_mdev_usage(self.compute1, expected_amount=2) diff --git a/nova/tests/functional/regressions/test_bug_2074219.py b/nova/tests/functional/regressions/test_bug_2074219.py index 36ccfbbb9e70..bff1cc8c8e53 100644 --- a/nova/tests/functional/regressions/test_bug_2074219.py +++ b/nova/tests/functional/regressions/test_bug_2074219.py @@ -17,7 +17,7 @@ from nova.tests.functional.libvirt import test_vgpu class VGPUTestVolumeOPs(test_vgpu.VGPUTestBase): - FAKE_LIBVIRT_VERSION = 7007000 + FAKE_LIBVIRT_VERSION = 8000000 def setUp(self): super().setUp() diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 9f75a8cadcde..db13fdab3456 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -27941,53 +27941,6 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin): get_unassigned_mdevs.assert_called_once_with('pci_0000_06_00_0', ['nvidia-11']) - @mock.patch.object(nova.privsep.libvirt, 'create_mdev') - @mock.patch.object(libvirt_driver.LibvirtDriver, - '_get_mdev_capable_devices') - @mock.patch.object(libvirt_driver.LibvirtDriver, - '_get_existing_mdevs_not_assigned') - def test_allocate_mdevs_with_no_mdevs_but_capacity(self, - unallocated_mdevs, - get_mdev_capable_devs, - privsep_create_mdev): - self.flags(enabled_mdev_types=['nvidia-11', 'nvidia-12'], - group='devices') - # we need to call the below again to ensure the updated - # 'device_addresses' value is read and the new groups created - nova.conf.devices.register_dynamic_opts(CONF) - self.flags(device_addresses=['0000:06:00.0'], group='mdev_nvidia-11') - self.flags(device_addresses=['0000:07:00.0'], group='mdev_nvidia-12') - allocations = { - uuids.rp1: { - 'resources': { - orc.VGPU: 1, - } - } - } - unallocated_mdevs.return_value = set() - get_mdev_capable_devs.return_value = [ - {"dev_id": "pci_0000_06_00_0", - "vendor_id": 0x10de, - # This pGPU can support both types but the operator only wanted - # to use nvidia-11 for it. - "types": {'nvidia-10': {'availableInstances': 16, - 'name': 'GRID M60-8Q', - 'deviceAPI': 'vfio-pci'}, - 'nvidia-11': {'availableInstances': 16, - 'name': 'GRID M60-0B', - 'deviceAPI': 'vfio-pci'}, - } - }] - privsep_create_mdev.return_value = uuids.mdev1 - drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False) - # Mock the fact update_provider_tree() should have run - drvr.provider_tree = self._get_fake_provider_tree_with_vgpu() - self.assertEqual([uuids.mdev1], - drvr._allocate_mdevs(allocations=allocations)) - privsep_create_mdev.assert_called_once_with("0000:06:00.0", - 'nvidia-11', - uuid=None) - @mock.patch.object(nova.privsep.libvirt, 'create_mdev') @mock.patch.object(libvirt_driver.LibvirtDriver, '_get_mdev_capable_devices') @@ -28127,90 +28080,6 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin): self.assertEqual(set([uuids.mdev1]), drvr._get_existing_mdevs_not_assigned(parent=None)) - @mock.patch.object(libvirt_driver.LibvirtDriver, - '_register_all_undefined_instance_details', - new=mock.Mock()) - @mock.patch('nova.compute.utils.get_machine_ips', - new=mock.Mock(return_value=[])) - @mock.patch.object(nova.privsep.libvirt, 'create_mdev') - @mock.patch.object(libvirt_driver.LibvirtDriver, - '_get_mdev_capable_devices') - @mock.patch('nova.virt.libvirt.driver.LibvirtDriver.' - '_get_mediated_device_information') - @mock.patch.object(os.path, 'exists') - @mock.patch.object(libvirt_driver.LibvirtDriver, - '_get_all_assigned_mediated_devices') - def test_recreate_mediated_device_on_init_host( - self, get_all_assigned_mdevs, exists, mock_get_mdev_info, - get_mdev_capable_devs, privsep_create_mdev): - self.flags(enabled_mdev_types=['nvidia-11', 'nvidia-12'], - group='devices') - # we need to call the below again to ensure the updated - # 'device_addresses' value is read and the new groups created - nova.conf.devices.register_dynamic_opts(CONF) - self.flags(device_addresses=['0000:06:00.0'], group='mdev_nvidia-11') - self.flags(device_addresses=['0000:07:00.0'], group='mdev_nvidia-12') - get_all_assigned_mdevs.return_value = {uuids.mdev1: uuids.inst1, - uuids.mdev2: uuids.inst2} - - # Fake the fact that mdev1 is existing but mdev2 not - def _exists(path): - # Keep the AMD SEV support check happy - if path == '/sys/module/kvm_amd/parameters/sev': - return False - - # Just verify what we ask - self.assertIn('/sys/bus/mdev/devices/', path) - return True if uuids.mdev1 in path else False - - exists.side_effect = _exists - mock_get_mdev_info.side_effect = [ - {"dev_id": "mdev_fake", - "uuid": uuids.mdev2, - "parent": "pci_0000_06_00_0", - "type": "nvidia-11", - "iommu_group": 12 - }] - get_mdev_capable_devs.return_value = [ - {"dev_id": "pci_0000_06_00_0", - "vendor_id": 0x10de, - "types": {'nvidia-11': {'availableInstances': 16, - 'name': 'GRID M60-0B', - 'deviceAPI': 'vfio-pci'}, - } - }] - - drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True) - drvr.init_host(host='foo') - # Only mdev2 will be recreated as mdev1 already exists. - privsep_create_mdev.assert_called_once_with( - "0000:06:00.0", 'nvidia-11', uuid=uuids.mdev2) - - @mock.patch('nova.virt.libvirt.driver.LibvirtDriver.' - '_get_mediated_device_information') - @mock.patch.object(os.path, 'exists') - @mock.patch.object(libvirt_driver.LibvirtDriver, - '_get_all_assigned_mediated_devices') - def test_recreate_mediated_device_on_init_host_with_wrong_config( - self, get_all_assigned_mdevs, exists, mock_get_mdev_info): - self.flags(enabled_mdev_types=['nvidia-11', 'nvidia-12'], - group='devices') - get_all_assigned_mdevs.return_value = {uuids.mdev1: uuids.inst1} - # We pretend this mdev doesn't exist hence it needs recreation - exists.return_value = False - mock_get_mdev_info.side_effect = [ - {"dev_id": "mdev_fake", - "uuid": uuids.mdev1, - "parent": "pci_0000_06_00_0", - "type": "nvidia-99", - "iommu_group": 12 - }] - drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True) - # mdev1 was originally created for nvidia-99 but the operator messed up - # the configuration by removing this type, we want to hardstop. - self.assertRaises(exception.InvalidLibvirtMdevConfig, - drvr.init_host, host='foo') - @mock.patch('oslo_utils.uuidutils.generate_uuid') def test_create_mdev(self, mock_generate_uuid, uuid=None, drvr=None): if drvr is None: diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index c4b06b47be84..cba8599801e3 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -218,10 +218,10 @@ patch_tpool_proxy() # doc/source/reference/libvirt-distro-support-matrix.rst # # DO NOT FORGET to update this document when touching any versions below! -MIN_LIBVIRT_VERSION = (7, 0, 0) -MIN_QEMU_VERSION = (5, 2, 0) -NEXT_MIN_LIBVIRT_VERSION = (8, 0, 0) -NEXT_MIN_QEMU_VERSION = (6, 2, 0) +MIN_LIBVIRT_VERSION = (8, 0, 0) +MIN_QEMU_VERSION = (6, 2, 0) +NEXT_MIN_LIBVIRT_VERSION = (10, 0, 0) +NEXT_MIN_QEMU_VERSION = (8, 2, 2) # vIOMMU model value `virtio` minimal support version MIN_LIBVIRT_VIOMMU_VIRTIO_MODEL = (8, 3, 0) @@ -887,6 +887,7 @@ class LibvirtDriver(driver.ComputeDriver): if not self._host.has_min_version(MIN_LIBVIRT_PERSISTENT_MDEV): # TODO(sbauza): Remove this code once mediated devices are # persisted across reboots. + # TODO(Uggla): Remove in bump cleanup patch self._recreate_assigned_mediated_devices() else: # NOTE(melwitt): We shouldn't need to do this with libvirt 7.8.0 @@ -8938,6 +8939,11 @@ class LibvirtDriver(driver.ComputeDriver): self._host.device_create(conf) # Define it to make it persistent. mdev_dev = self._host.device_define(conf) + # TODO(Uggla): Remove this in the libvirt bump cleanup patch + # As we are not setting autostart anymore, because we are not + # passing in following code. + # It makes test_allocate_mdevs_with_no_mdevs_but_capacity test to fail. + # So removing the tests. if self._host.has_min_version(MIN_LIBVIRT_NODEDEV_AUTOSTART): # Set it to automatically start when the compute host boots or the # parent device becomes available. diff --git a/releasenotes/notes/epoxy-libvirt-QEMU-version-bump-acfbb1b9228e1136.yaml b/releasenotes/notes/epoxy-libvirt-QEMU-version-bump-acfbb1b9228e1136.yaml new file mode 100644 index 000000000000..c133d4e818f0 --- /dev/null +++ b/releasenotes/notes/epoxy-libvirt-QEMU-version-bump-acfbb1b9228e1136.yaml @@ -0,0 +1,10 @@ +--- +upgrade: + - | + The minimum required version of libvirt by the `nova-compute` + service is now 8.0.0, and the minimum required version of QEMU is + 6.2.0. Failing to meet these minimum versions when using the libvirt + compute driver will result in the `nova-compute` service not + starting. + The next minimum required version of libvirt to be used in a future + release is 10.0.0, while the next minimum QEMU is 8.2.2.