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
This commit is contained in:
Matt Riedemann 2019-01-17 14:22:35 -05:00
parent c198326150
commit 510b48482b
1 changed files with 3 additions and 0 deletions

View File

@ -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,
)