Change "Missing Root Provider IDs" upgrade check to a failure

We want to drop the REST API compability code for resource
providers with no root_provider_id in Train, so to start
we should make the related upgrade check a failure rather
than a warning.

Change-Id: Ifd3c84ea3348fc9e6653838d6fba4a5eb864f01e
Story: 2005613
Task: 30921
This commit is contained in:
Matt Riedemann 2019-05-09 13:53:19 -04:00
parent e98b5df3d9
commit 4af1df9408
4 changed files with 20 additions and 12 deletions

View File

@ -91,3 +91,9 @@ Upgrade
* Checks were added for incomplete consumers and missing root provider ids
both of which can be remedied by running the
``placement-manage db online_data_migrations`` command.
**2.0.0 (Train)**
* The ``Missing Root Provider IDs`` upgrade check will now result in a
failure if there are still ``resource_providers`` records with a null
``root_provider_id`` value.

View File

@ -41,21 +41,14 @@ class Checks(upgradecheck.UpgradeCommands):
def _check_root_provider_ids(self):
"""Starting in Queens with the 1.28 microversion, resource_providers
table has the root_provider_id column. Older resource_providers with
no root provider id records will be online migrated when accessed
via the REST API or when the
no root provider id records will be online migrated when the
"placement-manage db online_data_migrations" command is run during
an upgrade. This status check emits a warning if there are missing
an upgrade. This status check emits a failure if there are missing
root provider ids to remind operators to perform the data migration.
Note that normally we would not add an upgrade status check to simply
mirror an online data migration since online data migrations should
be part of deploying/upgrading placement automation. However, with
placement being freshly extracted from nova, this check serves as a
friendly reminder.
"""
if self._check_missing_root_ids(self.ctxt):
return upgradecheck.Result(
upgradecheck.Code.WARNING,
upgradecheck.Code.FAILURE,
details='There is at least one resource provider table '
'record which misses its root provider id. '
'Run the "placement-manage db '

View File

@ -68,8 +68,8 @@ class UpgradeCheckIncompleteConsumersTestCase(
# Create a resource provider with no root provider id.
_create_old_rp(self.context)
result = self.checks._check_root_provider_ids()
# Since there is a missing root id, there should be a warning.
self.assertEqual(upgradecheck.Code.WARNING, result.code)
# Since there is a missing root id, there should be a failure.
self.assertEqual(upgradecheck.Code.FAILURE, result.code)
# Check the details for the consumer count.
self.assertIn('There is at least one resource provider table record '
'which misses its root provider id. ', result.details)

View File

@ -0,0 +1,9 @@
---
upgrade:
- |
The ``Missing Root Provider IDs`` upgrade check in the
``placement-status upgrade check`` command will now produce a failure
if it detects any ``resource_providers`` records with a null
``root_provider_id`` value. Run the
``placement-manage db online_data_migrations`` command to heal these
types of records.