Add disabled column to cell_mappings table.

This column has been added to the cell_mappings table since it is
required to represent if a cell is enabled or disabled as a part of the
cell-disable spec.

Related to blueprint cell-disable

Change-Id: Ibeddcb9a93c180f74727431b0579308c400436db
This commit is contained in:
Surya Seetharaman 2018-03-13 13:29:48 +01:00
parent 9e745f401e
commit f9743f0c2a
3 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# 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 sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy import MetaData
from sqlalchemy import Table
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
cell_mappings = Table('cell_mappings', meta, autoload=True)
if not hasattr(cell_mappings.c, 'disabled'):
cell_mappings.create_column(Column('disabled', Boolean, default=False))

View File

@ -117,6 +117,7 @@ class CellMapping(API_BASE):
name = Column(String(255))
transport_url = Column(Text())
database_connection = Column(Text())
disabled = Column(Boolean, default=False)
host_mapping = orm.relationship('HostMapping',
backref=backref('cell_mapping', uselist=False),
foreign_keys=id,

View File

@ -686,6 +686,9 @@ class NovaAPIMigrationsWalk(test_migrations.WalkVersionsMixin):
db_spec = jsonutils.loads(from_db_request_spec['spec'])
self.assertDictEqual(expected_spec, db_spec)
def _check_058(self, engine, data):
self.assertColumnExists(engine, 'cell_mappings', 'disabled')
class TestNovaAPIMigrationsWalkSQLite(NovaAPIMigrationsWalk,
test_base.DbTestCase,