Drop the (unused) domain table
The Mitaka release removed all code that referenced the domain table (with domains being stored instead as projects). However, the physical domain table was not removed. This patch removes the table. Such an action triggers our detection of banned operations to ensure rolling upgrades are possible. In this case, since all the code that referenced this table was already removed in the previous release, this is still a safe operation - so this migation is added to the exception list in the test for banned operations. Change-Id: I11bb23809e28b7fb0499cf79d261aa54f094b367
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# 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.
|
||||
|
||||
import sqlalchemy as sql
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta = sql.MetaData()
|
||||
meta.bind = migrate_engine
|
||||
|
||||
domain_table = sql.Table('domain', meta, autoload=True)
|
||||
domain_table.drop()
|
||||
@@ -219,16 +219,6 @@ class Resource(base.ResourceDriverV9):
|
||||
query.delete(synchronize_session=False)
|
||||
|
||||
|
||||
class Domain(sql.ModelBase, sql.DictBase):
|
||||
__tablename__ = 'domain'
|
||||
attributes = ['id', 'name', 'enabled']
|
||||
id = sql.Column(sql.String(64), primary_key=True)
|
||||
name = sql.Column(sql.String(64), nullable=False)
|
||||
enabled = sql.Column(sql.Boolean, default=True, nullable=False)
|
||||
extra = sql.Column(sql.JsonBlob())
|
||||
__table_args__ = (sql.UniqueConstraint('name'),)
|
||||
|
||||
|
||||
class Project(sql.ModelBase, sql.DictBase):
|
||||
# NOTE(henry-nash): From the manager and above perspective, the domain_id
|
||||
# is nullable. However, to ensure uniqueness in multi-process
|
||||
|
||||
@@ -165,13 +165,6 @@ class SqlModels(SqlTests):
|
||||
('extra', sql.JsonBlob, None))
|
||||
self.assertExpectedSchema('group', cols)
|
||||
|
||||
def test_domain_model(self):
|
||||
cols = (('id', sql.String, 64),
|
||||
('name', sql.String, 64),
|
||||
('enabled', sql.Boolean, True),
|
||||
('extra', sql.JsonBlob, None))
|
||||
self.assertExpectedSchema('domain', cols)
|
||||
|
||||
def test_project_model(self):
|
||||
cols = (('id', sql.String, 64),
|
||||
('name', sql.String, 64),
|
||||
|
||||
@@ -126,7 +126,15 @@ class KeystoneMigrationsCheckers(test_migrations.WalkVersionsMixin):
|
||||
# http://docs.openstack.org/developer/keystone/developing.html#online-migration
|
||||
|
||||
exceptions = [
|
||||
# NOTE(xek): Reviewers: DO NOT ALLOW THINGS TO BE ADDED HERE
|
||||
# NOTE(xek): Reviewers: DO NOT ALLOW THINGS TO BE ADDED HERE UNLESS
|
||||
# JUSTIFICATION CAN BE PROVIDED AS TO WHY THIS WILL NOT CAUSE
|
||||
# PROBLEMS FOR ROLLING UPGRADES.
|
||||
|
||||
# Migration 102 drops the domain table in the Newton release. All
|
||||
# code that referenced the domain table was removed in the Mitaka
|
||||
# release, hence this migration will not cause problems when
|
||||
# running a mixture of Mitaka and Newton versions of keystone.
|
||||
102
|
||||
]
|
||||
|
||||
# NOTE(xek): We start requiring things be additive in Newton, so
|
||||
|
||||
@@ -1156,6 +1156,12 @@ class SqlUpgradeTests(SqlMigrateBase):
|
||||
self.assertFalse(self.does_constraint_exist('role',
|
||||
'ixu_role_name'))
|
||||
|
||||
def test_drop_domain_table(self):
|
||||
self.upgrade(101)
|
||||
self.assertTableExists('domain')
|
||||
self.upgrade(102)
|
||||
self.assertTableDoesNotExist('domain')
|
||||
|
||||
|
||||
class MySQLOpportunisticUpgradeTestCase(SqlUpgradeTests):
|
||||
FIXTURE = test_base.MySQLOpportunisticFixture
|
||||
|
||||
Reference in New Issue
Block a user