Merge "libvirt: Bump MIN_{LIBVIRT,QEMU}_VERSION and NEXT_MIN_{LIBVIRT,QEMU}_VERSION"

This commit is contained in:
Zuul 2020-09-23 22:15:00 +00:00 committed by Gerrit Code Review
commit 2931516b75
4 changed files with 17 additions and 39 deletions

View File

@ -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.

View File

@ -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):

View File

@ -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),
})

View File

@ -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.