Merge "libvirt: Remove MIN_LIBVIRT_MULTIATTACH"

This commit is contained in:
Zuul 2020-05-20 04:58:35 +00:00 committed by Gerrit Code Review
commit d54c549885
3 changed files with 2 additions and 74 deletions

View File

@ -593,6 +593,7 @@ class ProviderUsageBaseTestCase(test.TestCase, InstanceHelperMixin):
os_traits.COMPUTE_NET_ATTACH_INTERFACE_WITH_TAG, os_traits.COMPUTE_NET_ATTACH_INTERFACE_WITH_TAG,
os_traits.COMPUTE_VOLUME_ATTACH_WITH_TAG, os_traits.COMPUTE_VOLUME_ATTACH_WITH_TAG,
os_traits.COMPUTE_VOLUME_EXTEND, os_traits.COMPUTE_VOLUME_EXTEND,
os_traits.COMPUTE_VOLUME_MULTI_ATTACH,
os_traits.COMPUTE_TRUSTED_CERTS, os_traits.COMPUTE_TRUSTED_CERTS,
os_traits.COMPUTE_IMAGE_TYPE_AKI, os_traits.COMPUTE_IMAGE_TYPE_AKI,
os_traits.COMPUTE_IMAGE_TYPE_AMI, os_traits.COMPUTE_IMAGE_TYPE_AMI,

View File

@ -26329,54 +26329,6 @@ class LVMSnapshotTests(_BaseSnapshotTests):
self._test_lvm_snapshot('qcow2') self._test_lvm_snapshot('qcow2')
class TestLibvirtMultiattach(test.NoDBTestCase):
"""Libvirt driver tests for volume multiattach support."""
def setUp(self):
super(TestLibvirtMultiattach, self).setUp()
self.useFixture(fakelibvirt.FakeLibvirtFixture())
@mock.patch('nova.virt.libvirt.host.Host.has_min_version',
return_value=True)
def test_init_host_supports_multiattach_new_enough_libvirt(self, min_ver):
"""Tests that the driver supports multiattach because libvirt>=3.10.
"""
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
drvr._set_multiattach_support()
self.assertTrue(drvr.capabilities['supports_multiattach'])
min_ver.assert_called_once_with(
lv_ver=libvirt_driver.MIN_LIBVIRT_MULTIATTACH)
@mock.patch('nova.virt.libvirt.host.Host.has_min_version',
side_effect=[False, False])
def test_init_host_supports_multiattach_old_enough_qemu(self, min_ver):
"""Tests that the driver supports multiattach because qemu<2.10.
"""
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
drvr._set_multiattach_support()
self.assertTrue(drvr.capabilities['supports_multiattach'])
calls = [mock.call(lv_ver=libvirt_driver.MIN_LIBVIRT_MULTIATTACH),
mock.call(hv_ver=(2, 10, 0))]
min_ver.assert_has_calls(calls)
# FIXME(mriedem): This test intermittently fails when run at the same time
# as LibvirtConnTestCase, presumably because of shared global state on the
# version check.
# @mock.patch('nova.virt.libvirt.host.Host.has_min_version',
# side_effect=[False, True])
# def test_init_host_supports_multiattach_no_support(self,
# has_min_version):
# """Tests that the driver does not support multiattach because
# qemu>=2.10 and libvirt<3.10.
# """
# drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
# drvr._set_multiattach_support()
# self.assertFalse(drvr.capabilities['supports_multiattach'])
# calls = [mock.call(lv_ver=libvirt_driver.MIN_LIBVIRT_MULTIATTACH),
# mock.call(hv_ver=(2, 10, 0))]
# has_min_version.assert_has_calls(calls)
vc = fakelibvirt.virConnect vc = fakelibvirt.virConnect

View File

@ -254,13 +254,6 @@ PERF_EVENTS_CPU_FLAG_MAPPING = {'cmt': 'cmt',
'mbmt': 'mbm_total', 'mbmt': 'mbm_total',
} }
# libvirt>=3.10 is required for volume multiattach unless qemu<2.10.
# See https://bugzilla.redhat.com/show_bug.cgi?id=1378242
# for details.
MIN_LIBVIRT_MULTIATTACH = (3, 10, 0)
MIN_LIBVIRT_FILE_BACKED_DISCARD_VERSION = (4, 4, 0) MIN_LIBVIRT_FILE_BACKED_DISCARD_VERSION = (4, 4, 0)
MIN_LIBVIRT_NATIVE_TLS_VERSION = (4, 4, 0) MIN_LIBVIRT_NATIVE_TLS_VERSION = (4, 4, 0)
@ -311,9 +304,7 @@ class LibvirtDriver(driver.ComputeDriver):
"supports_tagged_attach_interface": True, "supports_tagged_attach_interface": True,
"supports_tagged_attach_volume": True, "supports_tagged_attach_volume": True,
"supports_extend_volume": True, "supports_extend_volume": True,
# Multiattach support is conditional on qemu and libvirt versions "supports_multiattach": True,
# determined in init_host.
"supports_multiattach": False,
"supports_trusted_certs": True, "supports_trusted_certs": True,
# Supported image types # Supported image types
"supports_image_type_aki": True, "supports_image_type_aki": True,
@ -653,8 +644,6 @@ class LibvirtDriver(driver.ComputeDriver):
self._supported_perf_events = self._get_supported_perf_events() self._supported_perf_events = self._get_supported_perf_events()
self._set_multiattach_support()
self._check_file_backed_memory_support() self._check_file_backed_memory_support()
self._check_my_ip() self._check_my_ip()
@ -829,20 +818,6 @@ class LibvirtDriver(driver.ComputeDriver):
raise exception.InvalidLibvirtGPUConfig(reason=msg) raise exception.InvalidLibvirtGPUConfig(reason=msg)
self._create_new_mediated_device(parent, uuid=mdev_uuid) self._create_new_mediated_device(parent, uuid=mdev_uuid)
def _set_multiattach_support(self):
# Check to see if multiattach is supported. Based on bugzilla
# https://bugzilla.redhat.com/show_bug.cgi?id=1378242 and related
# clones, the shareable flag on a disk device will only work with
# qemu<2.10 or libvirt>=3.10. So check those versions here and set
# the capability appropriately.
if (self._host.has_min_version(lv_ver=MIN_LIBVIRT_MULTIATTACH) or
not self._host.has_min_version(hv_ver=(2, 10, 0))):
self.capabilities['supports_multiattach'] = True
else:
LOG.debug('Volume multiattach is not supported based on current '
'versions of QEMU and libvirt. QEMU must be less than '
'2.10 or libvirt must be greater than or equal to 3.10.')
def _check_file_backed_memory_support(self): def _check_file_backed_memory_support(self):
if CONF.libvirt.file_backed_memory: if CONF.libvirt.file_backed_memory:
# file_backed_memory is only compatible with qemu/kvm virts # file_backed_memory is only compatible with qemu/kvm virts