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
This commit is contained in:
Pierre Riteau 2022-06-09 20:56:26 +02:00
parent d869163608
commit 9af4c6115f
3 changed files with 8 additions and 2 deletions

View File

@ -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)

View File

@ -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):

View File

@ -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.