From a954bab009c95b48565d06e2d77afb7d7cb0e080 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Tue, 31 Jan 2017 17:59:53 -0500 Subject: [PATCH] nova-status: relax the resource providers check As of 4660333d0d97d8e00cf290ea1d4ed932f5edc1dc the filter scheduler will fallback to not using the placement service if the minimum nova-compute service version in the deployment is not new enough to ensure the computes are reporting into the placement service. This means we need to relax our check for when there are no resource providers but there are compute nodes, since the filter scheduler will not fail on that in Ocata. We intend on making that a hard failure in Pike, at which time we'll need to adjust nova-status again. Change-Id: I1e4dae17cf9d1336bf0ca72948b135b02434ba15 Closes-Bug: #1660484 --- nova/cmd/status.py | 20 +++++++++++++++++--- nova/tests/unit/cmd/test_status.py | 8 ++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/nova/cmd/status.py b/nova/cmd/status.py index 0a6958980891..e95256491054 100644 --- a/nova/cmd/status.py +++ b/nova/cmd/status.py @@ -268,6 +268,13 @@ class UpgradeCommands(object): This check relies on the placement service running because if it's not then there won't be any resource providers for the filter scheduler to use during instance build and move requests. + + Note that in Ocata, the filter scheduler will only use placement if + the minimum nova-compute service version in the deployment is >= 16 + which signals when nova-compute will fail to start if placement is not + configured on the compute. Otherwise the scheduler will fallback + to pulling compute nodes from the database directly as it has always + done. That fallback will be removed in Pike. """ # Get the total count of resource providers from the API DB that can @@ -290,9 +297,11 @@ class UpgradeCommands(object): if num_rps == 0: if num_computes != 0: - # This is a failure because there are compute nodes in the + # This is a warning because there are compute nodes in the # database but nothing is reporting resource providers to the - # placement service. + # placement service. This will not result in scheduling + # failures in Ocata because of the fallback that is in place + # but we signal it as a warning since there is work to do. msg = (_('There are no compute resource providers in the ' 'Placement service but there are %(num_computes)s ' 'compute nodes in the deployment. This means no ' @@ -301,7 +310,7 @@ class UpgradeCommands(object): '%(placement_docs_link)s for more details.') % {'num_computes': num_computes, 'placement_docs_link': PLACEMENT_DOCS_LINK}) - return UpgradeCheckResult(UpgradeCheckCode.FAILURE, msg) + return UpgradeCheckResult(UpgradeCheckCode.WARNING, msg) # There are no resource providers and no compute nodes so we # assume this is a fresh install and move on. We should return a @@ -317,6 +326,11 @@ class UpgradeCommands(object): elif num_rps < num_computes: # There are fewer resource providers than compute nodes, so return # a warning explaining that the deployment might be underutilized. + # Technically this is not going to result in scheduling failures in + # Ocata because of the fallback that is in place if there are older + # compute nodes still, but it is probably OK to leave the wording + # on this as-is to prepare for when the fallback is removed in + # Pike. msg = (_('There are %(num_resource_providers)s compute resource ' 'providers and %(num_compute_nodes)s compute nodes in ' 'the deployment. Ideally the number of compute resource ' diff --git a/nova/tests/unit/cmd/test_status.py b/nova/tests/unit/cmd/test_status.py index 47afc38461da..c4e5164bcb71 100644 --- a/nova/tests/unit/cmd/test_status.py +++ b/nova/tests/unit/cmd/test_status.py @@ -469,7 +469,7 @@ class TestUpgradeCheckResourceProviders(test.NoDBTestCase): def test_check_resource_providers_no_rps_one_compute(self): """Tests the scenario where we have compute nodes in the cell but no - resource providers yet - VCPU or otherwise. This is a failure because + resource providers yet - VCPU or otherwise. This is a warning because the compute isn't reporting into placement. """ self._setup_cells() @@ -488,7 +488,7 @@ class TestUpgradeCheckResourceProviders(test.NoDBTestCase): cpu_info='{"arch": "x86_64"}') cn.create() result = self.cmd._check_resource_providers() - self.assertEqual(status.UpgradeCheckCode.FAILURE, result.code) + self.assertEqual(status.UpgradeCheckCode.WARNING, result.code) self.assertIn('There are no compute resource providers in the ' 'Placement service but there are 1 compute nodes in the ' 'deployment.', result.details) @@ -511,7 +511,7 @@ class TestUpgradeCheckResourceProviders(test.NoDBTestCase): def test_check_resource_providers_no_compute_rps_one_compute(self): """Tests the scenario where we have compute nodes in the cell but no - compute (VCPU) resource providers yet. This is a failure because the + compute (VCPU) resource providers yet. This is a failure warning the compute isn't reporting into placement. """ self._setup_cells() @@ -536,7 +536,7 @@ class TestUpgradeCheckResourceProviders(test.NoDBTestCase): self._create_resource_provider(FAKE_IP_POOL_INVENTORY) result = self.cmd._check_resource_providers() - self.assertEqual(status.UpgradeCheckCode.FAILURE, result.code) + self.assertEqual(status.UpgradeCheckCode.WARNING, result.code) self.assertIn('There are no compute resource providers in the ' 'Placement service but there are 1 compute nodes in the ' 'deployment.', result.details)