Merge "Add upgrade check about old computes" into stable/ussuri
This commit is contained in:
@@ -147,6 +147,8 @@ Upgrade
|
|||||||
|
|
||||||
* Checks for the policy files are not automatically overwritten with
|
* Checks for the policy files are not automatically overwritten with
|
||||||
new defaults.
|
new defaults.
|
||||||
|
* Checks for computes older than the previous major release. This check was
|
||||||
|
backported from 23.0.0 (Wallaby).
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
========
|
========
|
||||||
|
|||||||
@@ -127,3 +127,7 @@ Verify operation of the Compute service.
|
|||||||
| Result: Success |
|
| Result: Success |
|
||||||
| Details: None |
|
| Details: None |
|
||||||
+--------------------------------------------------------------------+
|
+--------------------------------------------------------------------+
|
||||||
|
| Check: Older than N-1 computes |
|
||||||
|
| Result: Success |
|
||||||
|
| Details: None |
|
||||||
|
+--------------------------------------------------------------------+
|
||||||
|
|||||||
@@ -411,6 +411,17 @@ class UpgradeCommands(upgradecheck.UpgradeCommands):
|
|||||||
policy.reset()
|
policy.reset()
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
def _check_old_computes(self):
|
||||||
|
# warn if there are computes in the system older than the previous
|
||||||
|
# major release
|
||||||
|
try:
|
||||||
|
utils.raise_if_old_compute()
|
||||||
|
except exception.TooOldComputeService as e:
|
||||||
|
return upgradecheck.Result(
|
||||||
|
upgradecheck.Code.WARNING, six.text_type(e))
|
||||||
|
|
||||||
|
return upgradecheck.Result(upgradecheck.Code.SUCCESS)
|
||||||
|
|
||||||
# The format of the check functions is to return an upgradecheck.Result
|
# The format of the check functions is to return an upgradecheck.Result
|
||||||
# object with the appropriate upgradecheck.Code and details set. If the
|
# object with the appropriate upgradecheck.Code and details set. If the
|
||||||
# check hits warnings or failures then those should be stored in the
|
# check hits warnings or failures then those should be stored in the
|
||||||
@@ -429,6 +440,8 @@ class UpgradeCommands(upgradecheck.UpgradeCommands):
|
|||||||
(_('Cinder API'), _check_cinder),
|
(_('Cinder API'), _check_cinder),
|
||||||
# Added in Ussuri
|
# Added in Ussuri
|
||||||
(_('Policy Scope-based Defaults'), _check_policy),
|
(_('Policy Scope-based Defaults'), _check_policy),
|
||||||
|
# Backported from Wallaby
|
||||||
|
(_('Older than N-1 computes'), _check_old_computes)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ from nova import exception
|
|||||||
# NOTE(mriedem): We only use objects as a convenience to populate the database
|
# NOTE(mriedem): We only use objects as a convenience to populate the database
|
||||||
# in the tests, we don't use them in the actual CLI.
|
# in the tests, we don't use them in the actual CLI.
|
||||||
from nova import objects
|
from nova import objects
|
||||||
|
from nova.objects import service
|
||||||
from nova import policy
|
from nova import policy
|
||||||
from nova import test
|
from nova import test
|
||||||
from nova.tests import fixtures as nova_fixtures
|
from nova.tests import fixtures as nova_fixtures
|
||||||
@@ -602,3 +603,32 @@ class TestUpgradeCheckPolicyEnableScope(TestUpgradeCheckPolicy):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestUpgradeCheckPolicyEnableScope, self).setUp()
|
super(TestUpgradeCheckPolicyEnableScope, self).setUp()
|
||||||
self.flags(enforce_scope=True, group="oslo_policy")
|
self.flags(enforce_scope=True, group="oslo_policy")
|
||||||
|
|
||||||
|
|
||||||
|
class TestUpgradeCheckOldCompute(test.NoDBTestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestUpgradeCheckOldCompute, self).setUp()
|
||||||
|
self.cmd = status.UpgradeCommands()
|
||||||
|
|
||||||
|
def test_no_compute(self):
|
||||||
|
self.assertEqual(
|
||||||
|
upgradecheck.Code.SUCCESS, self.cmd._check_old_computes().code)
|
||||||
|
|
||||||
|
def test_only_new_compute(self):
|
||||||
|
last_supported_version = service.SERVICE_VERSION_ALIASES[
|
||||||
|
service.OLDEST_SUPPORTED_SERVICE_VERSION]
|
||||||
|
with mock.patch(
|
||||||
|
"nova.objects.service.get_minimum_version_all_cells",
|
||||||
|
return_value=last_supported_version):
|
||||||
|
self.assertEqual(
|
||||||
|
upgradecheck.Code.SUCCESS, self.cmd._check_old_computes().code)
|
||||||
|
|
||||||
|
def test_old_compute(self):
|
||||||
|
too_old = service.SERVICE_VERSION_ALIASES[
|
||||||
|
service.OLDEST_SUPPORTED_SERVICE_VERSION] - 1
|
||||||
|
with mock.patch(
|
||||||
|
"nova.objects.service.get_minimum_version_all_cells",
|
||||||
|
return_value=too_old):
|
||||||
|
result = self.cmd._check_old_computes()
|
||||||
|
self.assertEqual(upgradecheck.Code.WARNING, result.code)
|
||||||
|
|||||||
Reference in New Issue
Block a user