diff --git a/nova/tests/unit/virt/vmwareapi/fake.py b/nova/tests/unit/virt/vmwareapi/fake.py index 0abbfa734238..688b1febf755 100644 --- a/nova/tests/unit/virt/vmwareapi/fake.py +++ b/nova/tests/unit/virt/vmwareapi/fake.py @@ -1242,7 +1242,7 @@ class FakeVim(object): about_info = DataObject() about_info.name = "VMware vCenter Server" - about_info.version = "5.1.0" + about_info.version = constants.MIN_VC_VERSION about_info.instanceUuid = _FAKE_VCENTER_UUID service_content.about = about_info diff --git a/nova/tests/unit/virt/vmwareapi/test_driver_api.py b/nova/tests/unit/virt/vmwareapi/test_driver_api.py index 8e745ee7ce07..059027a09c48 100644 --- a/nova/tests/unit/virt/vmwareapi/test_driver_api.py +++ b/nova/tests/unit/virt/vmwareapi/test_driver_api.py @@ -2289,18 +2289,17 @@ class VMwareAPIVMTestCase(test.NoDBTestCase): self.conn._create_nodename(test_mor), "VC driver failed to create the proper node name") - @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(oslo_vim_util, 'get_vc_version', return_value='5.0.0') + def test_invalid_min_version(self, mock_version): + self.assertRaises(exception.NovaException, + self.conn._check_min_version) @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): + @mock.patch.object(oslo_vim_util, 'get_vc_version', return_value='5.1.0') + def test_warning_deprecated_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} + # assert that the next min version is in the warning message + expected_arg = {'version': constants.NEXT_MIN_VC_VERSION} version_arg_found = False for call in mock_warning.call_args_list: if call[0][1] == expected_arg: diff --git a/nova/virt/vmwareapi/constants.py b/nova/virt/vmwareapi/constants.py index ca4e9bdff804..ee994078bcfa 100644 --- a/nova/virt/vmwareapi/constants.py +++ b/nova/virt/vmwareapi/constants.py @@ -19,6 +19,7 @@ Shared constants across the VMware driver from nova.network import model as network_model MIN_VC_VERSION = '5.1.0' +NEXT_MIN_VC_VERSION = '5.5.0' # The minimum VC version for Neutron 'ovs' port type support MIN_VC_OVS_VERSION = '5.5.0' diff --git a/nova/virt/vmwareapi/driver.py b/nova/virt/vmwareapi/driver.py index d3916ef8b1cb..5a724745609a 100644 --- a/nova/virt/vmwareapi/driver.py +++ b/nova/virt/vmwareapi/driver.py @@ -127,15 +127,22 @@ class VMwareVCDriver(driver.ComputeDriver): def _check_min_version(self): min_version = v_utils.convert_version_to_int(constants.MIN_VC_VERSION) + next_min_ver = v_utils.convert_version_to_int( + constants.NEXT_MIN_VC_VERSION) vc_version = vim_util.get_vc_version(self._session) LOG.info(_LI("VMware vCenter version: %s"), vc_version) - if min_version > v_utils.convert_version_to_int(vc_version): - # TODO(garyk): enforce this from M + if v_utils.convert_version_to_int(vc_version) < min_version: + raise exception.NovaException( + _('Detected vCenter version %(version)s. Nova requires VMware ' + 'vCenter version %(min_version)s or greater.') % { + 'version': vc_version, + 'min_version': constants.MIN_VC_VERSION}) + elif v_utils.convert_version_to_int(vc_version) < next_min_ver: LOG.warning(_LW('Running Nova with a VMware vCenter version less ' 'than %(version)s is deprecated. The required ' 'minimum version of vCenter will be raised to ' - '%(version)s in the 13.0.0 release.'), - {'version': constants.MIN_VC_VERSION}) + '%(version)s in the 16.0.0 release.'), + {'version': constants.NEXT_MIN_VC_VERSION}) @property def need_legacy_block_device_info(self): diff --git a/releasenotes/notes/minimum_vc_version-0695a79dc1df3caa.yaml b/releasenotes/notes/minimum_vc_version-0695a79dc1df3caa.yaml new file mode 100644 index 000000000000..7b9a71d0e4bc --- /dev/null +++ b/releasenotes/notes/minimum_vc_version-0695a79dc1df3caa.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - As of Ocata, the minimum version of VMware vCenter that nova compute will + interoperate with will be 5.1.0. Deployments using older versions of + vCenter should upgrade. Running with vCenter version less than 5.5.0 is + also now deprecated and 5.5.0 will become the minimum version in the + 16.0.0 Pike release of Nova.