Browse Source

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
changes/62/845262/2
Pierre Riteau 2 months ago
parent
commit
9af4c6115f
  1. 2
      nova/cmd/status.py
  2. 2
      nova/tests/unit/cmd/test_status.py
  3. 6
      releasenotes/notes/too-old-compute-check-code-7dbcde45cfd23394.yaml

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

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

6
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.
Loading…
Cancel
Save