From aca9b9243a12ebf7295bdc14fd62c6524193e082 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Mon, 11 Jun 2018 12:17:03 -0400 Subject: [PATCH] Fix nits from change Id609789ef6b4a4c745550cde80dd49cabe03869a Change-Id: Ia321b2e33c11595db83221698b2c98b9b991ba48 --- nova/conf/placement.py | 6 +++--- .../api/openstack/placement/db/test_consumer.py | 11 ++++++----- .../openstack/placement/gabbits/ensure-consumer.yaml | 5 +++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/nova/conf/placement.py b/nova/conf/placement.py index 417a17ec78ac..0bafd79bd96a 100644 --- a/nova/conf/placement.py +++ b/nova/conf/placement.py @@ -51,17 +51,17 @@ is determined. help=""" Early API microversions (<1.8) allowed creating allocations and not specifying a project or user identifier for the consumer. In cleaning up the data -modeling, we no longer allow missing project and user information. if an older +modeling, we no longer allow missing project and user information. If an older client makes an allocation, we'll use this in place of the information it doesn't provide. """), -cfg.StrOpt( + cfg.StrOpt( 'incomplete_consumer_user_id', default=DEFAULT_CONSUMER_MISSING_ID, help=""" Early API microversions (<1.8) allowed creating allocations and not specifying a project or user identifier for the consumer. In cleaning up the data -modeling, we no longer allow missing project and user information. if an older +modeling, we no longer allow missing project and user information. If an older client makes an allocation, we'll use this in place of the information it doesn't provide. """), diff --git a/nova/tests/functional/api/openstack/placement/db/test_consumer.py b/nova/tests/functional/api/openstack/placement/db/test_consumer.py index af8c27fdd102..c7e0eaf75b79 100644 --- a/nova/tests/functional/api/openstack/placement/db/test_consumer.py +++ b/nova/tests/functional/api/openstack/placement/db/test_consumer.py @@ -107,20 +107,21 @@ class CreateIncompleteConsumersTestCase(test.NoDBTestCase): @db_api.placement_context_manager.reader def _check_incomplete_consumers(self, ctx): - incomplete_external_id = CONF.placement.incomplete_consumer_project_id + incomplete_project_id = CONF.placement.incomplete_consumer_project_id # Verify we have a record in projects for the missing sentinel sel = PROJECT_TBL.select( - PROJECT_TBL.c.external_id == incomplete_external_id) + PROJECT_TBL.c.external_id == incomplete_project_id) rec = ctx.session.execute(sel).first() - self.assertEqual(incomplete_external_id, rec['external_id']) + self.assertEqual(incomplete_project_id, rec['external_id']) incomplete_proj_id = rec['id'] # Verify we have a record in users for the missing sentinel + incomplete_user_id = CONF.placement.incomplete_consumer_user_id sel = user_obj.USER_TBL.select( - USER_TBL.c.external_id == incomplete_external_id) + USER_TBL.c.external_id == incomplete_user_id) rec = ctx.session.execute(sel).first() - self.assertEqual(incomplete_external_id, rec['external_id']) + self.assertEqual(incomplete_user_id, rec['external_id']) incomplete_user_id = rec['id'] # Verify there are records in the consumers table for our old diff --git a/nova/tests/functional/api/openstack/placement/gabbits/ensure-consumer.yaml b/nova/tests/functional/api/openstack/placement/gabbits/ensure-consumer.yaml index 2c574df99b65..0a27fe40c2ab 100644 --- a/nova/tests/functional/api/openstack/placement/gabbits/ensure-consumer.yaml +++ b/nova/tests/functional/api/openstack/placement/gabbits/ensure-consumer.yaml @@ -1,5 +1,6 @@ -# Tests of the ensure consumer behaviour for versions of the API from <1.7 to -# 1.8-1.26 and finally 1.27+ +# Tests of the ensure consumer behaviour for versions of the API before 1.8; +# starting with 1.8, project_id and user_id are required by the +# PUT: /allocations/{consumer_uuid} API. fixtures: - AllocationFixture