libvirt: update to min required version to 0.10.2

As declared during Liberty, the new min required libvirt
version is now 0.10.2.

NB, NEXT_MIN_LIBVIRT_VERSION now matches the current
MIN_LIBVIRT_VERSION. This constant is left in the
code since it is expected we'll repeatedly use it
in future to warn about subsequent version bumps.

The proposed min version for Nxxx is 1.2.1 which
allows Debian Wheezey Backports as the oldest
supported distro.

Change-Id: If7dcfdae296fab44ae44d670eea4234ad9381d6d
This commit is contained in:
Daniel P. Berrange 2015-10-07 11:03:52 +01:00 committed by Matt Riedemann
parent bff71e602b
commit 5a359a3d24
4 changed files with 51 additions and 40 deletions

View File

@ -150,7 +150,7 @@ VIR_SECRET_USAGE_TYPE_CEPH = 2
VIR_SECRET_USAGE_TYPE_ISCSI = 3 VIR_SECRET_USAGE_TYPE_ISCSI = 3
# Libvirt version # Libvirt version
FAKE_LIBVIRT_VERSION = 9011 FAKE_LIBVIRT_VERSION = 10002
class HostInfo(object): class HostInfo(object):
@ -790,7 +790,7 @@ class DomainSnapshot(object):
class Connection(object): class Connection(object):
def __init__(self, uri=None, readonly=False, version=9011, def __init__(self, uri=None, readonly=False, version=FAKE_LIBVIRT_VERSION,
hv_version=1001000, host_info=None): hv_version=1001000, host_info=None):
if not uri or uri == '': if not uri or uri == '':
if allow_default_uri_connection: if allow_default_uri_connection:

View File

@ -742,12 +742,21 @@ class LibvirtConnTestCase(test.NoDBTestCase):
@mock.patch.object(libvirt_driver.LOG, 'warning') @mock.patch.object(libvirt_driver.LOG, 'warning')
def test_next_min_version_deprecation_warning(self, mock_warning, def test_next_min_version_deprecation_warning(self, mock_warning,
mock_get_libversion): mock_get_libversion):
# Skip test if there's no currently planned new min version
if (versionutils.convert_version_to_int(
libvirt_driver.NEXT_MIN_LIBVIRT_VERSION) ==
versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_VERSION)):
self.skipTest("NEXT_MIN_LIBVIRT_VERSION == MIN_LIBVIRT_VERSION")
# Test that a warning is logged if the libvirt version is less than # Test that a warning is logged if the libvirt version is less than
# the next required minimum version. # the next required minimum version.
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True) drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
drvr.init_host("dummyhost") drvr.init_host("dummyhost")
# assert that the next min version is in a warning message # assert that the next min version is in a warning message
expected_arg = {'version': '0.10.2'} expected_arg = {'version': versionutils.convert_version_to_str(
versionutils.convert_version_to_int(
libvirt_driver.NEXT_MIN_LIBVIRT_VERSION))}
version_arg_found = False version_arg_found = False
for call in mock_warning.call_args_list: for call in mock_warning.call_args_list:
if call[0][1] == expected_arg: if call[0][1] == expected_arg:
@ -760,12 +769,22 @@ class LibvirtConnTestCase(test.NoDBTestCase):
libvirt_driver.NEXT_MIN_LIBVIRT_VERSION)) libvirt_driver.NEXT_MIN_LIBVIRT_VERSION))
@mock.patch.object(libvirt_driver.LOG, 'warning') @mock.patch.object(libvirt_driver.LOG, 'warning')
def test_next_min_version_ok(self, mock_warning, mock_get_libversion): def test_next_min_version_ok(self, mock_warning, mock_get_libversion):
# Skip test if there's no currently planned new min version
if (versionutils.convert_version_to_int(
libvirt_driver.NEXT_MIN_LIBVIRT_VERSION) ==
versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_VERSION)):
self.skipTest("NEXT_MIN_LIBVIRT_VERSION == MIN_LIBVIRT_VERSION")
# Test that a warning is not logged if the libvirt version is greater # Test that a warning is not logged if the libvirt version is greater
# than or equal to NEXT_MIN_LIBVIRT_VERSION. # than or equal to NEXT_MIN_LIBVIRT_VERSION.
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True) drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
drvr.init_host("dummyhost") drvr.init_host("dummyhost")
# assert that the next min version is in a warning message # assert that the next min version is in a warning message
expected_arg = {'version': '0.10.2'} expected_arg = {'version': versionutils.convert_version_to_str(
versionutils.convert_version_to_int(
libvirt_driver.NEXT_MIN_LIBVIRT_VERSION))}
version_arg_found = False version_arg_found = False
for call in mock_warning.call_args_list: for call in mock_warning.call_args_list:
if call[0][1] == expected_arg: if call[0][1] == expected_arg:
@ -5134,24 +5153,6 @@ class LibvirtConnTestCase(test.NoDBTestCase):
instance, instance,
"/dev/sda") "/dev/sda")
@mock.patch.object(fakelibvirt.virConnect, "getLibVersion")
def test_attach_blockio_invalid_version(self, mock_version):
mock_version.return_value = (0 * 1000 * 1000) + (9 * 1000) + 8
self.flags(virt_type='qemu', group='libvirt')
self.create_fake_libvirt_mock()
libvirt_driver.LibvirtDriver._conn.lookupByName = self.fake_lookup
instance = objects.Instance(**self.test_instance)
self.mox.ReplayAll()
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
self.assertRaises(exception.Invalid,
drvr.attach_volume, None,
{"driver_volume_type": "fake",
"data": {"logical_block_size": "4096",
"physical_block_size": "4096"}
},
instance,
"/dev/sda")
@mock.patch('nova.utils.get_image_from_system_metadata') @mock.patch('nova.utils.get_image_from_system_metadata')
@mock.patch('nova.virt.libvirt.blockinfo.get_info_from_bdm') @mock.patch('nova.virt.libvirt.blockinfo.get_info_from_bdm')
@mock.patch('nova.virt.libvirt.host.Host.get_domain') @mock.patch('nova.virt.libvirt.host.Host.get_domain')
@ -8011,7 +8012,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
return return
def fake_getLibVersion(): def fake_getLibVersion():
return 9011 return fakelibvirt.FAKE_LIBVIRT_VERSION
def fake_getCapabilities(): def fake_getCapabilities():
return """ return """
@ -11764,7 +11765,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
self.resultXML = None self.resultXML = None
def fake_getLibVersion(): def fake_getLibVersion():
return 9011 return fakelibvirt.FAKE_LIBVIRT_VERSION
def fake_getCapabilities(): def fake_getCapabilities():
return """ return """

View File

@ -354,20 +354,33 @@ def patch_tpool_proxy():
patch_tpool_proxy() patch_tpool_proxy()
# This is effectively the min version for i686/x86_64 + KVM/QEMU # For information about when MIN_LIBVIRT_VERSION and
# NEXT_MIN_LIBVIRT_VERSION can be changed, consult
#
# https://wiki.openstack.org/wiki/LibvirtDistroSupportMatrix
#
# Currently this is effectively the min version for i686/x86_64
# + KVM/QEMU, as other architectures/hypervisors require newer
# versions. Over time, this will become a common min version
# for all architectures/hypervisors, as this value rises to
# meet them.
#
# TODO(berrange) find out what min version ppc64 needs as it # TODO(berrange) find out what min version ppc64 needs as it
# almost certainly wants something newer than this.... # almost certainly wants something newer than this....
MIN_LIBVIRT_VERSION = (0, 9, 11) MIN_LIBVIRT_VERSION = (0, 10, 2)
# 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 = (1, 2, 1)
# When the above version matches/exceeds this version # When the above version matches/exceeds this version
# delete it & corresponding code using it # delete it & corresponding code using it
MIN_LIBVIRT_DEVICE_CALLBACK_VERSION = (1, 1, 1) MIN_LIBVIRT_DEVICE_CALLBACK_VERSION = (1, 1, 1)
# TODO(mriedem): Change MIN_LIB_VERSION to this in the 13.0.0 'M' release.
NEXT_MIN_LIBVIRT_VERSION = (0, 10, 2)
# Live snapshot requirements # Live snapshot requirements
MIN_LIBVIRT_LIVESNAPSHOT_VERSION = (1, 0, 0) MIN_LIBVIRT_LIVESNAPSHOT_VERSION = (1, 0, 0)
MIN_QEMU_LIVESNAPSHOT_VERSION = (1, 3, 0) MIN_QEMU_LIVESNAPSHOT_VERSION = (1, 3, 0)
# block size tuning requirements
MIN_LIBVIRT_BLOCKIO_VERSION = (0, 10, 2)
# BlockJobInfo management requirement # BlockJobInfo management requirement
MIN_LIBVIRT_BLOCKJOBINFO_VERSION = (1, 1, 1) MIN_LIBVIRT_BLOCKJOBINFO_VERSION = (1, 1, 1)
# Relative block commit & rebase (feature is detected, # Relative block commit & rebase (feature is detected,
@ -592,14 +605,13 @@ class LibvirtDriver(driver.ComputeDriver):
'libvirt version %s') % 'libvirt version %s') %
self._version_to_string(MIN_LIBVIRT_PARALLELS_VERSION)) self._version_to_string(MIN_LIBVIRT_PARALLELS_VERSION))
# TODO(mriedem): We plan to move to a minimum required version of # Give the cloud admin a heads up if we are intending to
# libvirt 0.10.2 in the 13.0.0 'M' release so if we're running with # change the MIN_LIBVIRT_VERSION in the next release.
# less than that now, log a warning.
if not self._host.has_min_version(NEXT_MIN_LIBVIRT_VERSION): if not self._host.has_min_version(NEXT_MIN_LIBVIRT_VERSION):
LOG.warning(_LW('Running Nova with a libvirt version less than ' LOG.warning(_LW('Running Nova with a libvirt version less than '
'%(version)s is deprecated. The required minimum ' '%(version)s is deprecated. The required minimum '
'version of libvirt will be raised to %(version)s ' 'version of libvirt will be raised to %(version)s '
'in the 13.0.0 release.'), 'in the next release.'),
{'version': self._version_to_string( {'version': self._version_to_string(
NEXT_MIN_LIBVIRT_VERSION)}) NEXT_MIN_LIBVIRT_VERSION)})
@ -1109,12 +1121,6 @@ class LibvirtDriver(driver.ComputeDriver):
"block size") % CONF.libvirt.virt_type "block size") % CONF.libvirt.virt_type
raise exception.InvalidHypervisorType(msg) raise exception.InvalidHypervisorType(msg)
if not self._host.has_min_version(MIN_LIBVIRT_BLOCKIO_VERSION):
ver = ".".join([str(x) for x in MIN_LIBVIRT_BLOCKIO_VERSION])
msg = _("Volume sets block size, but libvirt '%s' or later is "
"required.") % ver
raise exception.Invalid(msg)
disk_info = blockinfo.get_info_from_bdm( disk_info = blockinfo.get_info_from_bdm(
instance, CONF.libvirt.virt_type, image_meta, bdm) instance, CONF.libvirt.virt_type, image_meta, bdm)
self._connect_volume(connection_info, disk_info) self._connect_volume(connection_info, disk_info)

View File

@ -0,0 +1,4 @@
---
upgrade:
- The minimum required libvirt is now version 0.10.2. The minimum
libvirt for the N release has been set to 1.2.1.