From 95103c3bc9707be2ee97f314df0d52ee5ab6e10a Mon Sep 17 00:00:00 2001 From: Lee Yarwood Date: Wed, 19 Aug 2020 15:12:40 +0100 Subject: [PATCH] libvirt: Bump MIN_{LIBVIRT,QEMU}_VERSION and NEXT_MIN_{LIBVIRT,QEMU}_VERSION Ia18e9be4d07b732afd9db0007c541253f3cdaf82 bumped these versions in Ussuri and while it's late in the Victoria cycle we now need to do the same. Based on the LibvirtDistroSupportMatrix wiki page [1] the following versions have been selected for the next min versions during the Wallaby release: NEXT_MIN_LIBVIRT_VERSION = (6, 0, 0) NEXT_MIN_QEMU_VERSION = (4, 2, 0) MIN_QEMU_VTPM is removed as part of this patch as it also requires changes to functional tests that would otherwise fail. Follow up patches will remove the following constants after this change: - MIN_LIBVIRT_FILE_BACKED_DISCARD_VERSION - MIN_{LIBVIRT,QEMU}_NATIVE_TLS_VERSION - MIN_LIBVIRT_BETTER_SIGKILL_HANDLING - MIN_LIBVIRT_VIDEO_MODEL_VERSIONS - MIN_{LIBVIRT,QEMU}_PMEM_SUPPORT This change depends on the following devstack change that introduces the use of the Train UCA on Bionic nodes, allowing us to bump versions here ahead of a move to Focal. Depends-On: https://review.opendev.org/#/c/747123/ [1] https://wiki.openstack.org/wiki/LibvirtDistroSupportMatrix Change-Id: I8e349849db0b1a540d295c903f1470917b82fd97 --- nova/tests/functional/libvirt/test_vtpm.py | 9 +------- nova/tests/unit/virt/libvirt/test_driver.py | 21 +------------------ nova/virt/libvirt/driver.py | 18 +++++++--------- ...libvirt-version-bump-e1a09b3a72ee56a4.yaml | 8 +++++++ 4 files changed, 17 insertions(+), 39 deletions(-) create mode 100644 releasenotes/notes/victoria-libvirt-version-bump-e1a09b3a72ee56a4.yaml diff --git a/nova/tests/functional/libvirt/test_vtpm.py b/nova/tests/functional/libvirt/test_vtpm.py index 4778863a7b..add88a89a2 100644 --- a/nova/tests/functional/libvirt/test_vtpm.py +++ b/nova/tests/functional/libvirt/test_vtpm.py @@ -33,10 +33,6 @@ from nova.virt.libvirt import driver CONF = nova.conf.CONF LOG = logging.getLogger(__name__) -FAKE_LIBVIRT_VERSION = versionutils.convert_version_to_int( - driver.MIN_LIBVIRT_VTPM) -FAKE_QEMU_VERSION = versionutils.convert_version_to_int(driver.MIN_QEMU_VTPM) - class FakeKeyManager(key_manager.KeyManager): """A fake key manager. @@ -143,11 +139,8 @@ class VTPMServersTest(base.ServersTestBase): def start_compute(self, hostname='compute1'): libvirt_version = versionutils.convert_version_to_int( driver.MIN_LIBVIRT_VTPM) - qemu_version = versionutils.convert_version_to_int( - driver.MIN_QEMU_VTPM) fake_connection = self._get_connection( - libvirt_version=libvirt_version, qemu_version=qemu_version, - hostname=hostname) + libvirt_version=libvirt_version, hostname=hostname) # This is fun. Firstly we need to do a global'ish mock so we can # actually start the service. diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 865489b041..1a7e7b7d59 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -1527,25 +1527,6 @@ class LibvirtConnTestCase(test.NoDBTestCase, self.assertIn("vTPM support requires '[libvirt] virt_type' of 'qemu' " "or 'kvm'; found 'lxc'.", six.text_type(exc)) - @mock.patch.object(host.Host, 'has_min_version') - def test__check_vtpm_support_old_qemu(self, mock_version): - """Test checking for vTPM support when our QEMU or libvirt version is - too old. - """ - self.flags(swtpm_enabled=True, virt_type='kvm', group='libvirt') - - def fake_has_min_version(lv_ver=None, hv_ver=None, hv_type=None): - if lv_ver and hv_ver: - return lv_ver < (5, 6, 0) and hv_ver < (2, 11, 0) - return True - - mock_version.side_effect = fake_has_min_version - - drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True) - exc = self.assertRaises(exception.InvalidConfiguration, - drvr.init_host, 'dummyhost') - self.assertIn("vTPM support requires QEMU version", six.text_type(exc)) - @mock.patch.object(host.Host, 'has_min_version', return_value=True) @mock.patch('shutil.which') def test__check_vtpm_support_missing_exe(self, mock_which, mock_version): @@ -1642,7 +1623,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, mock_which.assert_has_calls( [mock.call('swtpm_setup'), mock.call().__bool__()], ) - mock_version.assert_called_with(lv_ver=(5, 6, 0), hv_ver=(2, 11, 0)) + mock_version.assert_called_with(lv_ver=(5, 6, 0)) @mock.patch.object(libvirt_driver.LOG, 'warning') def test_check_cpu_set_configuration__no_configuration(self, mock_log): diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 1e5f15fabe..4da0b5bff4 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -222,15 +222,15 @@ 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 = (4, 0, 0) -MIN_QEMU_VERSION = (2, 11, 0) +MIN_LIBVIRT_VERSION = (5, 0, 0) +MIN_QEMU_VERSION = (4, 0, 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 # NEXT_MIN_LIBVIRT_VERSION has been at a higher value for # one cycle -NEXT_MIN_LIBVIRT_VERSION = (5, 0, 0) -NEXT_MIN_QEMU_VERSION = (4, 0, 0) +NEXT_MIN_LIBVIRT_VERSION = (6, 0, 0) +NEXT_MIN_QEMU_VERSION = (4, 2, 0) # Virtuozzo driver support MIN_VIRTUOZZO_VERSION = (7, 0, 0) @@ -271,7 +271,6 @@ MIN_LIBVIRT_VIR_ERR_DEVICE_MISSING = (4, 1, 0) # Virtual TPM (vTPM) support MIN_LIBVIRT_VTPM = (5, 6, 0) -MIN_QEMU_VTPM = (2, 11, 0) MIN_LIBVIRT_S390X_CPU_COMPARE = (5, 9, 0) @@ -783,14 +782,11 @@ class LibvirtDriver(driver.ComputeDriver): "'kvm'; found '%s'.") raise exception.InvalidConfiguration(msg % CONF.libvirt.virt_type) - if not self._host.has_min_version( - lv_ver=MIN_LIBVIRT_VTPM, hv_ver=MIN_QEMU_VTPM, - ): + if not self._host.has_min_version(lv_ver=MIN_LIBVIRT_VTPM): msg = _( - 'vTPM support requires QEMU version %(qemu)s or greater and ' - 'Libvirt version %(libvirt)s or greater.') + 'vTPM support requires Libvirt version %(libvirt)s or ' + 'greater.') raise exception.InvalidConfiguration(msg % { - 'qemu': libvirt_utils.version_to_string(MIN_QEMU_VTPM), 'libvirt': libvirt_utils.version_to_string(MIN_LIBVIRT_VTPM), }) diff --git a/releasenotes/notes/victoria-libvirt-version-bump-e1a09b3a72ee56a4.yaml b/releasenotes/notes/victoria-libvirt-version-bump-e1a09b3a72ee56a4.yaml new file mode 100644 index 0000000000..b66746b536 --- /dev/null +++ b/releasenotes/notes/victoria-libvirt-version-bump-e1a09b3a72ee56a4.yaml @@ -0,0 +1,8 @@ +--- +upgrade: + - | + The minimum required version of libvirt used by the `nova-compute` service + is now 5.0.0. The minimum required version of QEMU used by the + `nova-compute` service is now 4.0.0. Failing to meet these minimum versions + when using the libvirt compute driver will result in the `nova-compute` + service not starting.