Skip to content

Commit 2931516

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "libvirt: Bump MIN_{LIBVIRT,QEMU}_VERSION and NEXT_MIN_{LIBVIRT,QEMU}_VERSION"
2 parents 167472c + 95103c3 commit 2931516

File tree

4 files changed

+17
-39
lines changed

4 files changed

+17
-39
lines changed

nova/tests/functional/libvirt/test_vtpm.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
CONF = nova.conf.CONF
3434
LOG = logging.getLogger(__name__)
3535

36-
FAKE_LIBVIRT_VERSION = versionutils.convert_version_to_int(
37-
driver.MIN_LIBVIRT_VTPM)
38-
FAKE_QEMU_VERSION = versionutils.convert_version_to_int(driver.MIN_QEMU_VTPM)
39-
4036

4137
class FakeKeyManager(key_manager.KeyManager):
4238
"""A fake key manager.
@@ -143,11 +139,8 @@ def setUp(self):
143139
def start_compute(self, hostname='compute1'):
144140
libvirt_version = versionutils.convert_version_to_int(
145141
driver.MIN_LIBVIRT_VTPM)
146-
qemu_version = versionutils.convert_version_to_int(
147-
driver.MIN_QEMU_VTPM)
148142
fake_connection = self._get_connection(
149-
libvirt_version=libvirt_version, qemu_version=qemu_version,
150-
hostname=hostname)
143+
libvirt_version=libvirt_version, hostname=hostname)
151144

152145
# This is fun. Firstly we need to do a global'ish mock so we can
153146
# actually start the service.

nova/tests/unit/virt/libvirt/test_driver.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,25 +1527,6 @@ def test__check_vtpm_support_non_qemu(self):
15271527
self.assertIn("vTPM support requires '[libvirt] virt_type' of 'qemu' "
15281528
"or 'kvm'; found 'lxc'.", six.text_type(exc))
15291529

1530-
@mock.patch.object(host.Host, 'has_min_version')
1531-
def test__check_vtpm_support_old_qemu(self, mock_version):
1532-
"""Test checking for vTPM support when our QEMU or libvirt version is
1533-
too old.
1534-
"""
1535-
self.flags(swtpm_enabled=True, virt_type='kvm', group='libvirt')
1536-
1537-
def fake_has_min_version(lv_ver=None, hv_ver=None, hv_type=None):
1538-
if lv_ver and hv_ver:
1539-
return lv_ver < (5, 6, 0) and hv_ver < (2, 11, 0)
1540-
return True
1541-
1542-
mock_version.side_effect = fake_has_min_version
1543-
1544-
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
1545-
exc = self.assertRaises(exception.InvalidConfiguration,
1546-
drvr.init_host, 'dummyhost')
1547-
self.assertIn("vTPM support requires QEMU version", six.text_type(exc))
1548-
15491530
@mock.patch.object(host.Host, 'has_min_version', return_value=True)
15501531
@mock.patch('shutil.which')
15511532
def test__check_vtpm_support_missing_exe(self, mock_which, mock_version):
@@ -1642,7 +1623,7 @@ def test__check_vtpm_support(
16421623
mock_which.assert_has_calls(
16431624
[mock.call('swtpm_setup'), mock.call().__bool__()],
16441625
)
1645-
mock_version.assert_called_with(lv_ver=(5, 6, 0), hv_ver=(2, 11, 0))
1626+
mock_version.assert_called_with(lv_ver=(5, 6, 0))
16461627

16471628
@mock.patch.object(libvirt_driver.LOG, 'warning')
16481629
def test_check_cpu_set_configuration__no_configuration(self, mock_log):

nova/virt/libvirt/driver.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,15 @@ def repr_method(self):
222222
# versions. Over time, this will become a common min version
223223
# for all architectures/hypervisors, as this value rises to
224224
# meet them.
225-
MIN_LIBVIRT_VERSION = (4, 0, 0)
226-
MIN_QEMU_VERSION = (2, 11, 0)
225+
MIN_LIBVIRT_VERSION = (5, 0, 0)
226+
MIN_QEMU_VERSION = (4, 0, 0)
227227
# TODO(berrange): Re-evaluate this at start of each release cycle
228228
# to decide if we want to plan a future min version bump.
229229
# MIN_LIBVIRT_VERSION can be updated to match this after
230230
# NEXT_MIN_LIBVIRT_VERSION has been at a higher value for
231231
# one cycle
232-
NEXT_MIN_LIBVIRT_VERSION = (5, 0, 0)
233-
NEXT_MIN_QEMU_VERSION = (4, 0, 0)
232+
NEXT_MIN_LIBVIRT_VERSION = (6, 0, 0)
233+
NEXT_MIN_QEMU_VERSION = (4, 2, 0)
234234

235235
# Virtuozzo driver support
236236
MIN_VIRTUOZZO_VERSION = (7, 0, 0)
@@ -271,7 +271,6 @@ def repr_method(self):
271271

272272
# Virtual TPM (vTPM) support
273273
MIN_LIBVIRT_VTPM = (5, 6, 0)
274-
MIN_QEMU_VTPM = (2, 11, 0)
275274

276275
MIN_LIBVIRT_S390X_CPU_COMPARE = (5, 9, 0)
277276

@@ -783,14 +782,11 @@ def _check_vtpm_support(self) -> None:
783782
"'kvm'; found '%s'.")
784783
raise exception.InvalidConfiguration(msg % CONF.libvirt.virt_type)
785784

786-
if not self._host.has_min_version(
787-
lv_ver=MIN_LIBVIRT_VTPM, hv_ver=MIN_QEMU_VTPM,
788-
):
785+
if not self._host.has_min_version(lv_ver=MIN_LIBVIRT_VTPM):
789786
msg = _(
790-
'vTPM support requires QEMU version %(qemu)s or greater and '
791-
'Libvirt version %(libvirt)s or greater.')
787+
'vTPM support requires Libvirt version %(libvirt)s or '
788+
'greater.')
792789
raise exception.InvalidConfiguration(msg % {
793-
'qemu': libvirt_utils.version_to_string(MIN_QEMU_VTPM),
794790
'libvirt': libvirt_utils.version_to_string(MIN_LIBVIRT_VTPM),
795791
})
796792

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
upgrade:
3+
- |
4+
The minimum required version of libvirt used by the `nova-compute` service
5+
is now 5.0.0. The minimum required version of QEMU used by the
6+
`nova-compute` service is now 4.0.0. Failing to meet these minimum versions
7+
when using the libvirt compute driver will result in the `nova-compute`
8+
service not starting.

0 commit comments

Comments
 (0)