63c10d2d53
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: https://review.openstack.org/599847/ Change-Id: I9d97b7a904e2b7d15c763e2a067cc5909cc6c9c5 Closes-Bug: #1790701 Closes-Bug: #1790721
66 lines
2.2 KiB
Python
66 lines
2.2 KiB
Python
# Copyright 2010 United States Government as represented by the
|
|
# Administrator of the National Aeronautics and Space Administration.
|
|
# All Rights Reserved.
|
|
# Copyright 2012 Red Hat, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from oslo_log import log
|
|
from oslo_utils import importutils
|
|
|
|
from nova.api.openstack.placement import db_api as placement_db
|
|
from nova.common import config
|
|
import nova.conf
|
|
from nova.db.sqlalchemy import api as sqlalchemy_api
|
|
from nova import rpc
|
|
from nova import version
|
|
|
|
profiler = importutils.try_import('osprofiler.opts')
|
|
|
|
|
|
CONF = nova.conf.CONF
|
|
|
|
|
|
def parse_args(argv, default_config_files=None, configure_db=True,
|
|
init_rpc=True):
|
|
log.register_options(CONF)
|
|
# We use the oslo.log default log levels which includes suds=INFO
|
|
# and add only the extra levels that Nova needs
|
|
if CONF.glance.debug:
|
|
extra_default_log_levels = ['glanceclient=DEBUG']
|
|
else:
|
|
extra_default_log_levels = ['glanceclient=WARN']
|
|
|
|
# NOTE(danms): DEBUG logging in privsep will result in some large
|
|
# and potentially sensitive things being logged.
|
|
extra_default_log_levels.append('oslo.privsep.daemon=INFO')
|
|
|
|
log.set_defaults(default_log_levels=log.get_default_log_levels() +
|
|
extra_default_log_levels)
|
|
rpc.set_defaults(control_exchange='nova')
|
|
if profiler:
|
|
profiler.set_defaults(CONF)
|
|
config.set_middleware_defaults()
|
|
|
|
CONF(argv[1:],
|
|
project='nova',
|
|
version=version.version_string(),
|
|
default_config_files=default_config_files)
|
|
|
|
if init_rpc:
|
|
rpc.init(CONF)
|
|
|
|
if configure_db:
|
|
sqlalchemy_api.configure(CONF)
|
|
placement_db.configure(CONF)
|