From 9af4c6115fcfce9c76a1e7fd5b93bb43cec66a4d Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Thu, 9 Jun 2022 20:56:26 +0200 Subject: [PATCH] Change TooOldComputeService upgrade check code to failure The TooOldComputeService upgrade check currently produces a warning, which may be missed if the upgrade process only checks the exit code of the upgrade check command. Since this can lead to Nova control services failing to start, make the upgrade check a failure instead, so it results in a non-zero exit code. Closes-Bug: #1956983 Change-Id: Ia3ce6a0b0b810667ac0a66502a43038fe43c5aed --- nova/cmd/status.py | 2 +- nova/tests/unit/cmd/test_status.py | 2 +- .../notes/too-old-compute-check-code-7dbcde45cfd23394.yaml | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/too-old-compute-check-code-7dbcde45cfd23394.yaml diff --git a/nova/cmd/status.py b/nova/cmd/status.py index 8a7041b062bc..af62ee840192 100644 --- a/nova/cmd/status.py +++ b/nova/cmd/status.py @@ -319,7 +319,7 @@ class UpgradeCommands(upgradecheck.UpgradeCommands): try: utils.raise_if_old_compute() except exception.TooOldComputeService as e: - return upgradecheck.Result(upgradecheck.Code.WARNING, str(e)) + return upgradecheck.Result(upgradecheck.Code.FAILURE, str(e)) return upgradecheck.Result(upgradecheck.Code.SUCCESS) diff --git a/nova/tests/unit/cmd/test_status.py b/nova/tests/unit/cmd/test_status.py index 093b8ac16b6f..b61da4ae9f1b 100644 --- a/nova/tests/unit/cmd/test_status.py +++ b/nova/tests/unit/cmd/test_status.py @@ -474,7 +474,7 @@ class TestUpgradeCheckOldCompute(test.NoDBTestCase): "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) + self.assertEqual(upgradecheck.Code.FAILURE, result.code) class TestCheckMachineTypeUnset(test.NoDBTestCase): diff --git a/releasenotes/notes/too-old-compute-check-code-7dbcde45cfd23394.yaml b/releasenotes/notes/too-old-compute-check-code-7dbcde45cfd23394.yaml new file mode 100644 index 000000000000..f8e0517401af --- /dev/null +++ b/releasenotes/notes/too-old-compute-check-code-7dbcde45cfd23394.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The upgrade check tooling now returns a non-zero exit code in the presence + of compute node services that are too old. This is to avoid situations in + which Nova control services fail to start after an upgrade.