Configure placement DB context manager for nova-manage/status
The create_incomplete_consumers online data migration was added in
Rocky via change Id609789ef6b4a4c745550cde80dd49cabe03869a. That
relies on hitting some tables in the API (or placement) database.
The DB API code for that migration relies on a placement context
manager which looks like it was regressed with change
I2fff528060ec52a4a2e26a6484bdf18359b95f77 (also in Rocky). This
results in a DB error trying to query the projects table but
because of a generic try/except in _run_migration, the failure
was missed in CI testing.
Similarly, the nova-status upgrade check "_check_resource_providers"
routine also uses the placement DB API context manager to count the
number of compute resource providers in the API (or placement) DB,
which is returning 0 because it's not using the proper DB connection.
This was not caught in the nova-status CLI tests because they use
the DatabaseFixture which *does* configure the global placement DB
API context manager.
This adds the configuration of the global placement DB API context
manager so we can properly query the placement-related tables.
The blanket problematic try/except from _run_migration is left
as-is in this change but will be addressed in a separate patch.
Integration testing of this fix is being performed with devstack:
Reviewed: https:/ /review. openstack. org/600464 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=7f25c3e6072 c2f892de740038e 7d076b24fc09f7
Committed: https:/
Submitter: Zuul
Branch: stable/rocky
commit 7f25c3e6072c2f8 92de740038e7d07 6b24fc09f7
Author: Matt Riedemann <email address hidden>
Date: Tue Sep 4 14:53:25 2018 -0400
Configure placement DB context manager for nova-manage/status
The create_ incomplete_ consumers online data migration was added in c745550cde80dd4 9cabe03869a. That ec52a4a2e26a648 4bdf18359b95f77 (also in Rocky). This
Rocky via change Id609789ef6b4a4
relies on hitting some tables in the API (or placement) database.
The DB API code for that migration relies on a placement context
manager which looks like it was regressed with change
I2fff528060
results in a DB error trying to query the projects table but
because of a generic try/except in _run_migration, the failure
was missed in CI testing.
Similarly, the nova-status upgrade check "_check_ resource_ providers"
routine also uses the placement DB API context manager to count the
number of compute resource providers in the API (or placement) DB,
which is returning 0 because it's not using the proper DB connection.
This was not caught in the nova-status CLI tests because they use
the DatabaseFixture which *does* configure the global placement DB
API context manager.
This adds the configuration of the global placement DB API context
manager so we can properly query the placement-related tables.
The blanket problematic try/except from _run_migration is left
as-is in this change but will be addressed in a separate patch.
Integration testing of this fix is being performed with devstack:
https:/ /review. openstack. org/599847/
Change-Id: I9d97b7a904e2b7 d15c763e2a067cc 5909cc6c9c5 ed68ccfb6bd393f 317111d903)
Closes-Bug: #1790701
Closes-Bug: #1790721
(cherry picked from commit 63c10d2d536c3ff