diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 05a2f29f8..5a985495c 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -75,7 +75,6 @@ LOG = logging.getLogger(__name__) main_context_manager = enginefacade.transaction_context() api_context_manager = enginefacade.transaction_context() -placement_context_manager = enginefacade.transaction_context() def _get_db_conf(conf_group, connection=None): @@ -109,10 +108,6 @@ def _context_manager_from_context(context): def configure(conf): main_context_manager.configure(**_get_db_conf(conf.database)) api_context_manager.configure(**_get_db_conf(conf.api_database)) - if conf.placement_database.connection is None: - conf.placement_database = conf.api_database - placement_context_manager.configure( - **_get_db_conf(conf.placement_database)) def create_context_manager(connection=None): @@ -147,10 +142,6 @@ def get_api_engine(): return api_context_manager.get_legacy_facade().get_engine() -def get_placement_engine(): - return placement_context_manager.get_legacy_facade().get_engine() - - _SHADOW_TABLE_PREFIX = 'shadow_' _DEFAULT_QUOTA_NAME = 'default' PER_PROJECT_QUOTAS = ['fixed_ips', 'floating_ips', 'networks'] diff --git a/nova/db/sqlalchemy/api_models.py b/nova/db/sqlalchemy/api_models.py index a6922bcf4..2b149e764 100644 --- a/nova/db/sqlalchemy/api_models.py +++ b/nova/db/sqlalchemy/api_models.py @@ -354,31 +354,6 @@ class ResourceProviderAggregate(API_BASE): aggregate_id = Column(Integer, primary_key=True, nullable=False) -class PlacementAggregate(API_BASE): - """Represents a grouping of resource providers.""" - - # NOTE(rpodolyaka): placement API can optionally use the subset of tables - # of api DB instead of requiring its own DB. aggregates table is the only - # table which schema is a bit different (additional `name` column), but we - # can work around that by providing an additional mapping class to a - # subset of table columns, so that this model works for both separate and - # shared DBs cases. - __table__ = API_BASE.metadata.tables['aggregates'] - __mapper_args__ = { - 'exclude_properties': ['name'] - } - - resource_providers = orm.relationship( - 'ResourceProvider', - secondary='resource_provider_aggregates', - primaryjoin=('PlacementAggregate.id == ' - 'ResourceProviderAggregate.aggregate_id'), - secondaryjoin=('ResourceProviderAggregate.resource_provider_id == ' - 'ResourceProvider.id'), - backref='aggregates' - ) - - class InstanceGroupMember(API_BASE): """Represents the members for an instance group.""" __tablename__ = 'instance_group_member' diff --git a/nova/db/sqlalchemy/migration.py b/nova/db/sqlalchemy/migration.py index f457186ac..a8a544999 100644 --- a/nova/db/sqlalchemy/migration.py +++ b/nova/db/sqlalchemy/migration.py @@ -31,7 +31,6 @@ from nova.i18n import _ INIT_VERSION = {} INIT_VERSION['main'] = 215 INIT_VERSION['api'] = 0 -INIT_VERSION['placement'] = 0 _REPOSITORY = {} LOG = logging.getLogger(__name__) @@ -42,8 +41,6 @@ def get_engine(database='main', context=None): return db_session.get_engine(context=context) if database == 'api': return db_session.get_api_engine() - if database == 'placement': - return db_session.get_placement_engine() def db_sync(version=None, database='main', context=None): @@ -174,8 +171,6 @@ def _find_migrate_repo(database='main'): rel_path = 'migrate_repo' if database == 'api': rel_path = os.path.join('api_migrations', 'migrate_repo') - if database == 'placement': - rel_path = os.path.join('placement_migrations', 'migrate_repo') path = os.path.join(os.path.abspath(os.path.dirname(__file__)), rel_path) assert os.path.exists(path) diff --git a/nova/test.py b/nova/test.py index 080e5b2cc..047e07418 100644 --- a/nova/test.py +++ b/nova/test.py @@ -213,7 +213,6 @@ class TestCase(testtools.TestCase): if self.USES_DB: self.useFixture(nova_fixtures.Database()) self.useFixture(nova_fixtures.Database(database='api')) - self.useFixture(nova_fixtures.Database(database='placement')) self.useFixture(nova_fixtures.DefaultFlavorsFixture()) elif not self.USES_DB_SELF: self.useFixture(nova_fixtures.DatabasePoisonFixture()) diff --git a/nova/tests/fixtures.py b/nova/tests/fixtures.py index 45e0e7202..a6301ecbb 100644 --- a/nova/tests/fixtures.py +++ b/nova/tests/fixtures.py @@ -43,7 +43,7 @@ from nova.tests.functional.api import client _TRUE_VALUES = ('True', 'true', '1', 'yes') CONF = cfg.CONF -DB_SCHEMA = {'main': "", 'api': "", 'placement': ""} +DB_SCHEMA = {'main': "", 'api': ""} SESSION_CONFIGURED = False @@ -221,7 +221,7 @@ class Database(fixtures.Fixture): def __init__(self, database='main', connection=None): """Create a database fixture. - :param database: The type of database, 'main', 'api' or 'placement' + :param database: The type of database, 'main' or 'api' :param connection: The connection string to use """ super(Database, self).__init__() @@ -242,8 +242,6 @@ class Database(fixtures.Fixture): self.get_engine = session.get_engine elif database == 'api': self.get_engine = session.get_api_engine - elif database == 'placement': - self.get_engine = session.get_placement_engine def _cache_schema(self): global DB_SCHEMA @@ -277,7 +275,7 @@ class DatabaseAtVersion(fixtures.Fixture): """Create a database fixture. :param version: Max version to sync to (or None for current) - :param database: The type of database, 'main', 'api', 'placement' + :param database: The type of database, 'main' or 'api' """ super(DatabaseAtVersion, self).__init__() self.database = database @@ -286,8 +284,6 @@ class DatabaseAtVersion(fixtures.Fixture): self.get_engine = session.get_engine elif database == 'api': self.get_engine = session.get_api_engine - elif database == 'placement': - self.get_engine = session.get_placement_engine def cleanup(self): engine = self.get_engine() diff --git a/nova/tests/functional/api/openstack/placement/fixtures.py b/nova/tests/functional/api/openstack/placement/fixtures.py index 8eef396c1..0970eea37 100644 --- a/nova/tests/functional/api/openstack/placement/fixtures.py +++ b/nova/tests/functional/api/openstack/placement/fixtures.py @@ -49,13 +49,11 @@ class APIFixture(fixture.GabbiFixture): config.parse_args([], default_config_files=None, configure_db=False, init_rpc=False) - self.placement_db_fixture = fixtures.Database('placement') # NOTE(cdent): api and main database are not used but we still need # to manage them to make the fixtures work correctly and not cause # conflicts with other tests in the same process. self.api_db_fixture = fixtures.Database('api') self.main_db_fixture = fixtures.Database('main') - self.placement_db_fixture.reset() self.api_db_fixture.reset() self.main_db_fixture.reset() @@ -63,7 +61,6 @@ class APIFixture(fixture.GabbiFixture): os.environ['RP_NAME'] = uuidutils.generate_uuid() def stop_fixture(self): - self.placement_db_fixture.cleanup() self.api_db_fixture.cleanup() self.main_db_fixture.cleanup() if self.conf: