From 4af1df9408adb79497be30496078b246c39601ae Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 9 May 2019 13:53:19 -0400 Subject: [PATCH] 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 --- doc/source/cli/placement-status.rst | 6 ++++++ placement/cmd/status.py | 13 +++---------- placement/tests/functional/cmd/test_status.py | 4 ++-- ...-require-root-provider-ids-60bc374ac354f41e.yaml | 9 +++++++++ 4 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 releasenotes/notes/train-require-root-provider-ids-60bc374ac354f41e.yaml diff --git a/doc/source/cli/placement-status.rst b/doc/source/cli/placement-status.rst index 4dd75b602..48380080a 100644 --- a/doc/source/cli/placement-status.rst +++ b/doc/source/cli/placement-status.rst @@ -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. diff --git a/placement/cmd/status.py b/placement/cmd/status.py index f8d8bee17..e6d0d3f68 100644 --- a/placement/cmd/status.py +++ b/placement/cmd/status.py @@ -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 ' diff --git a/placement/tests/functional/cmd/test_status.py b/placement/tests/functional/cmd/test_status.py index 52b06b28f..13eb45daa 100644 --- a/placement/tests/functional/cmd/test_status.py +++ b/placement/tests/functional/cmd/test_status.py @@ -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) diff --git a/releasenotes/notes/train-require-root-provider-ids-60bc374ac354f41e.yaml b/releasenotes/notes/train-require-root-provider-ids-60bc374ac354f41e.yaml new file mode 100644 index 000000000..e7619b2df --- /dev/null +++ b/releasenotes/notes/train-require-root-provider-ids-60bc374ac354f41e.yaml @@ -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.