VMware: enforce minimum support VC version
Provide a check that validates the minimum supported VC version for the VMware driver. The minimum version tested is 5.1.0. In L we will log a warning. From M this will be enforced. DocImpact Change-Id: If1a0767d19c26f5e028d1f8f57ede9716e19303f
This commit is contained in:
parent
37991ef9c3
commit
27e78710be
|
@ -2339,3 +2339,22 @@ class VMwareAPIVMTestCase(test.NoDBTestCase):
|
|||
test_mor = "domain-26"
|
||||
nodename = "%s.%s" % (test_mor, vmwareapi_fake._FAKE_VCENTER_UUID)
|
||||
self.assertEqual(nodename, self.conn._normalize_nodename(nodename))
|
||||
|
||||
@mock.patch.object(driver.LOG, 'warning')
|
||||
def test_min_version(self, mock_warning):
|
||||
self.conn._check_min_version()
|
||||
self.assertFalse(mock_warning.called)
|
||||
|
||||
@mock.patch.object(driver.LOG, 'warning')
|
||||
@mock.patch.object(oslo_vim_util, 'get_vc_version',
|
||||
return_value='5.0.0')
|
||||
def test_invalid_min_version(self, mock_version, mock_warning):
|
||||
self.conn._check_min_version()
|
||||
# assert that the min version is in a warning message
|
||||
expected_arg = {'version': constants.MIN_VC_VERSION}
|
||||
version_arg_found = False
|
||||
for call in mock_warning.call_args_list:
|
||||
if call[0][1] == expected_arg:
|
||||
version_arg_found = True
|
||||
break
|
||||
self.assertTrue(version_arg_found)
|
||||
|
|
|
@ -18,6 +18,8 @@ Shared constants across the VMware driver
|
|||
|
||||
from nova.network import model as network_model
|
||||
|
||||
MIN_VC_VERSION = '5.1.0'
|
||||
|
||||
DISK_FORMAT_ISO = 'iso'
|
||||
DISK_FORMAT_VMDK = 'vmdk'
|
||||
DISK_FORMATS_ALL = [DISK_FORMAT_ISO, DISK_FORMAT_VMDK]
|
||||
|
|
|
@ -31,6 +31,7 @@ from oslo_vmware import vim
|
|||
from oslo_vmware import vim_util
|
||||
|
||||
from nova import exception
|
||||
from nova import utils
|
||||
from nova.i18n import _, _LI, _LW
|
||||
from nova.openstack.common import versionutils
|
||||
from nova.virt import driver
|
||||
|
@ -148,6 +149,8 @@ class VMwareVCDriver(driver.ComputeDriver):
|
|||
|
||||
self._session = VMwareAPISession(scheme=scheme)
|
||||
|
||||
self._check_min_version()
|
||||
|
||||
# Update the PBM location if necessary
|
||||
if CONF.vmware.pbm_enabled:
|
||||
self._update_pbm_location()
|
||||
|
@ -197,6 +200,18 @@ class VMwareVCDriver(driver.ComputeDriver):
|
|||
# Register the OpenStack extension
|
||||
self._register_openstack_extension()
|
||||
|
||||
def _check_min_version(self):
|
||||
min_version = utils.convert_version_to_int(constants.MIN_VC_VERSION)
|
||||
vc_version = vim_util.get_vc_version(self._session)
|
||||
LOG.info(_LI("VMware VC version: %s"), vc_version)
|
||||
if min_version > utils.convert_version_to_int(vc_version):
|
||||
# TODO(garyk): enforce this from M
|
||||
LOG.warning(_LW('Running Nova with a VMware VC version less than '
|
||||
'%(version)s is deprecated. The required minimum '
|
||||
'version of VC will be raised to %(version)s '
|
||||
'in the 2016.1 release.'),
|
||||
{'version': constants.MIN_VC_VERSION})
|
||||
|
||||
@property
|
||||
def need_legacy_block_device_info(self):
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue