Update nova.db import paths
This commit is the result of running the following search and replace across the project. s/nova.db/placement.db/g Change-Id: If5ea7cfd361288c89db885c26b7c616ce5b596d4
This commit is contained in:
parent
467c253349
commit
3100eb64ae
@ -8,7 +8,7 @@ Nova Style Commandments
|
||||
Nova Specific Commandments
|
||||
---------------------------
|
||||
|
||||
- ``nova.db`` imports are not allowed in ``nova/virt/*``
|
||||
- ``placement.db`` imports are not allowed in ``nova/virt/*``
|
||||
- [N309] no db session in public API methods (disabled)
|
||||
This enforces a guideline defined in ``oslo.db.sqlalchemy.session``
|
||||
- [N310] timeutils.utcnow() wrapper must be used instead of direct calls to
|
||||
|
@ -401,7 +401,7 @@ self-contained:
|
||||
There are some exceptions to the self-contained rule (which are actively being
|
||||
addressed to prepare for the extraction):
|
||||
|
||||
* Some of the code related to a resource class cache is within the `nova.db`
|
||||
* Some of the code related to a resource class cache is within the `placement.db`
|
||||
package, while other parts are in ``nova/rc_fields.py``.
|
||||
* Database models, migrations and tables are described as part of the nova api
|
||||
database. An optional configuration option,
|
||||
|
@ -9,5 +9,5 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
"""Use nova.db.api instead. In the past this file imported * from there,
|
||||
"""Use placement.db.api instead. In the past this file imported * from there,
|
||||
which led to unwanted imports."""
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
"""Defines interface for DB access.
|
||||
|
||||
Functions in this module are imported into the nova.db namespace. Call these
|
||||
functions from nova.db namespace, not the nova.db.api namespace.
|
||||
Functions in this module are imported into the placement.db namespace. Call these
|
||||
functions from placement.db namespace, not the placement.db.api namespace.
|
||||
|
||||
All functions in this module return objects that implement a dictionary-like
|
||||
interface. Currently, many of these objects are sqlalchemy objects that
|
||||
@ -32,7 +32,7 @@ from oslo_log import log as logging
|
||||
|
||||
from nova.cells import rpcapi as cells_rpcapi
|
||||
import nova.conf
|
||||
from nova.db import constants
|
||||
from placement.db import constants
|
||||
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
@ -41,7 +41,7 @@ CONF = nova.conf.CONF
|
||||
MAX_INT = constants.MAX_INT
|
||||
SQL_SP_FLOAT_MAX = constants.SQL_SP_FLOAT_MAX
|
||||
|
||||
_BACKEND_MAPPING = {'sqlalchemy': 'nova.db.sqlalchemy.api'}
|
||||
_BACKEND_MAPPING = {'sqlalchemy': 'placement.db.sqlalchemy.api'}
|
||||
|
||||
|
||||
IMPL = concurrency.TpoolDbapiWrapper(CONF, backend_mapping=_BACKEND_MAPPING)
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
"""Base class for classes that need database access."""
|
||||
|
||||
import nova.db.api
|
||||
import placement.db.api
|
||||
|
||||
|
||||
class Base(object):
|
||||
@ -24,4 +24,4 @@ class Base(object):
|
||||
|
||||
def __init__(self):
|
||||
super(Base, self).__init__()
|
||||
self.db = nova.db.api
|
||||
self.db = placement.db.api
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
"""Database setup and migration commands."""
|
||||
|
||||
from nova.db.sqlalchemy import migration
|
||||
from placement.db.sqlalchemy import migration
|
||||
|
||||
IMPL = migration
|
||||
|
||||
|
@ -65,7 +65,7 @@ from nova.compute import task_states
|
||||
from nova.compute import vm_states
|
||||
import nova.conf
|
||||
import nova.context
|
||||
from nova.db.sqlalchemy import models
|
||||
from placement.db.sqlalchemy import models
|
||||
from placement import exception
|
||||
from nova.i18n import _
|
||||
from placement import safe_utils
|
||||
|
@ -13,7 +13,7 @@
|
||||
from sqlalchemy import MetaData
|
||||
from sqlalchemy import Table
|
||||
|
||||
from nova.db.sqlalchemy import api_models
|
||||
from placement.db.sqlalchemy import api_models
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
|
@ -13,7 +13,7 @@
|
||||
from sqlalchemy import MetaData
|
||||
from sqlalchemy import Table
|
||||
|
||||
from nova.db.sqlalchemy import api_models
|
||||
from placement.db.sqlalchemy import api_models
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
|
@ -13,7 +13,7 @@
|
||||
from sqlalchemy import MetaData
|
||||
from sqlalchemy import Table
|
||||
|
||||
from nova.db.sqlalchemy import api_models
|
||||
from placement.db.sqlalchemy import api_models
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
|
@ -25,7 +25,7 @@ import sqlalchemy
|
||||
from sqlalchemy.sql import null
|
||||
|
||||
from placement import db_api as placement_db
|
||||
from nova.db.sqlalchemy import api as db_session
|
||||
from placement.db.sqlalchemy import api as db_session
|
||||
from placement import exception
|
||||
from nova.i18n import _
|
||||
|
||||
|
@ -21,7 +21,7 @@ from sqlalchemy import MetaData
|
||||
from sqlalchemy import Table
|
||||
from sqlalchemy.types import NullType
|
||||
|
||||
from nova.db.sqlalchemy import api as db
|
||||
from placement.db.sqlalchemy import api as db
|
||||
from placement import exception
|
||||
from nova.i18n import _
|
||||
|
||||
|
@ -27,7 +27,7 @@ from placement.policies import inventory as policies
|
||||
from placement.schemas import inventory as schema
|
||||
from placement import util
|
||||
from placement import wsgi_wrapper
|
||||
from nova.db import constants as db_const
|
||||
from placement.db import constants as db_const
|
||||
from nova.i18n import _
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ from placement import db_api
|
||||
from placement import exception
|
||||
from placement.objects import project as project_obj
|
||||
from placement.objects import user as user_obj
|
||||
from nova.db.sqlalchemy import api_models as models
|
||||
from placement.db.sqlalchemy import api_models as models
|
||||
|
||||
CONSUMER_TBL = models.Consumer.__table__
|
||||
_ALLOC_TBL = models.Allocation.__table__
|
||||
|
@ -18,7 +18,7 @@ import sqlalchemy as sa
|
||||
|
||||
from placement import db_api
|
||||
from placement import exception
|
||||
from nova.db.sqlalchemy import api_models as models
|
||||
from placement.db.sqlalchemy import api_models as models
|
||||
|
||||
CONF = cfg.CONF
|
||||
PROJECT_TBL = models.Project.__table__
|
||||
|
@ -43,7 +43,7 @@ from placement.objects import consumer as consumer_obj
|
||||
from placement.objects import project as project_obj
|
||||
from placement.objects import user as user_obj
|
||||
from placement import resource_class_cache as rc_cache
|
||||
from nova.db.sqlalchemy import api_models as models
|
||||
from placement.db.sqlalchemy import api_models as models
|
||||
from nova.i18n import _
|
||||
from placement import rc_fields
|
||||
|
||||
|
@ -18,7 +18,7 @@ import sqlalchemy as sa
|
||||
|
||||
from placement import db_api
|
||||
from placement import exception
|
||||
from nova.db.sqlalchemy import api_models as models
|
||||
from placement.db.sqlalchemy import api_models as models
|
||||
|
||||
CONF = cfg.CONF
|
||||
USER_TBL = models.User.__table__
|
||||
|
@ -15,7 +15,7 @@ import sqlalchemy as sa
|
||||
|
||||
from placement import db_api
|
||||
from placement import exception
|
||||
from nova.db.sqlalchemy import api_models as models
|
||||
from placement.db.sqlalchemy import api_models as models
|
||||
from placement import rc_fields as fields
|
||||
|
||||
_RC_TBL = models.ResourceClass.__table__
|
||||
|
@ -14,7 +14,7 @@
|
||||
import copy
|
||||
|
||||
from placement.schemas import common
|
||||
from nova.db import constants as db_const
|
||||
from placement.db import constants as db_const
|
||||
|
||||
|
||||
BASE_INVENTORY_SCHEMA = {
|
||||
|
@ -51,7 +51,7 @@ import testtools
|
||||
|
||||
from placement.objects import resource_provider
|
||||
from placement import context
|
||||
from nova.db import api as db
|
||||
from placement.db import api as db
|
||||
from placement import exception
|
||||
from nova.network import manager as network_manager
|
||||
from nova.network.security_group import openstack_driver
|
||||
|
@ -45,8 +45,8 @@ from import wsgi_app
|
||||
from nova.api import wsgi
|
||||
from nova.compute import rpcapi as compute_rpcapi
|
||||
from placement import context
|
||||
from nova.db import migration
|
||||
from nova.db.sqlalchemy import api as session
|
||||
from placement.db import migration
|
||||
from placement.db.sqlalchemy import api as session
|
||||
from placement import exception
|
||||
from nova.network import model as network_model
|
||||
from placement import objects
|
||||
@ -254,7 +254,7 @@ class DatabasePoisonFixture(fixtures.Fixture):
|
||||
# - mock at the object layer rather than the db layer, for example:
|
||||
# nova.objects.instance.Instance.get
|
||||
# vs.
|
||||
# nova.db.instance_get
|
||||
# placement.db.instance_get
|
||||
#
|
||||
# - mock at the api layer rather than the object layer, for example:
|
||||
# common.get_instance
|
||||
@ -532,7 +532,7 @@ class CellDatabases(fixtures.Fixture):
|
||||
# a new database created with the schema we need and the
|
||||
# context manager for it stashed.
|
||||
with fixtures.MonkeyPatch(
|
||||
'nova.db.sqlalchemy.api.get_context_manager',
|
||||
'placement.db.sqlalchemy.api.get_context_manager',
|
||||
get_context_manager):
|
||||
self._cache_schema(connection_str)
|
||||
engine = ctxt_mgr.get_legacy_facade().get_engine()
|
||||
@ -549,10 +549,10 @@ class CellDatabases(fixtures.Fixture):
|
||||
# duration of the test (unlike the temporary ones above) and
|
||||
# provide the actual "runtime" switching of connections for us.
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'nova.db.sqlalchemy.api.create_context_manager',
|
||||
'placement.db.sqlalchemy.api.create_context_manager',
|
||||
self._wrap_create_context_manager))
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'nova.db.sqlalchemy.api.get_context_manager',
|
||||
'placement.db.sqlalchemy.api.get_context_manager',
|
||||
self._wrap_get_context_manager))
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'nova.context.target_cell',
|
||||
|
@ -21,7 +21,7 @@ import nova
|
||||
from placement import exception
|
||||
from placement.objects import consumer as consumer_obj
|
||||
from placement.objects import resource_provider as rp_obj
|
||||
from nova.db.sqlalchemy import api_models as models
|
||||
from placement.db.sqlalchemy import api_models as models
|
||||
from placement import rc_fields as fields
|
||||
from nova.tests.functional.db import test_base as tb
|
||||
from nova.tests import uuidsentinel
|
||||
|
Loading…
x
Reference in New Issue
Block a user