From 510b48482b7b13a6c44fce4ed0f3c443735a57e8 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 17 Jan 2019 14:22:35 -0500 Subject: [PATCH] Copy create_incomplete_consumers online data migration from nova Change Id609789ef6b4a4c745550cde80dd49cabe03869a in nova added online data migration code to create missing consumer records for old allocations. That was added to nova in Rocky. The incomplete consumers are already migrated in the REST API when showing allocations for a given consumer or listing allocations for a given resource provider. This adds the online data migration command line entry point for "placement-manage db online_data_migrations" so that incomplete consumer records can be migrated on-demand in batches by the operator. The nova change had no diret testing of the CLI entry point since it's just a call to the same code that the API uses, which is already tested in CreateIncompleteConsumersTestCase, so no explicit CLI unit test is added here since it would be redundant. This is part of the placement extraction effort; in the case that a deployment migrates to extracted placement before completing the online data migration in nova, this allows them to still complete the migration within extracted placement. Change-Id: If5babb29b13a3e8c26ac04ecee02f4d3d5404263 --- placement/cmd/manage.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/placement/cmd/manage.py b/placement/cmd/manage.py index 90204eec6..8fb7d6080 100644 --- a/placement/cmd/manage.py +++ b/placement/cmd/manage.py @@ -25,6 +25,7 @@ from placement import context from placement.db.sqlalchemy import migration from placement import db_api from placement.i18n import _ +from placement.objects import consumer as consumer_obj from placement.objects import resource_provider as rp_obj version_info = pbr.version.VersionInfo('openstack-placement') @@ -46,6 +47,8 @@ online_migrations = ( # Added in Stein rp_obj.set_root_provider_ids, + # Added in Stein (copied from migration added to Nova in Rocky) + consumer_obj.create_incomplete_consumers, )