Add queued for delete to instance_mappings table.
This column is being added to have information regarding an instance being active/deleted in the nova-api database as a part of the handling a down cell spec. Related to blueprint handling-down-cell Change-Id: Ic6253acab2ae08025d65add9a5be9ed463457290
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
# 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
|
||||
|
||||
instance_mappings = Table('instance_mappings', meta, autoload=True)
|
||||
|
||||
if not hasattr(instance_mappings.c, 'queued_for_delete'):
|
||||
instance_mappings.create_column(Column('queued_for_delete', Boolean,
|
||||
default=False))
|
||||
@@ -138,6 +138,7 @@ class InstanceMapping(API_BASE):
|
||||
cell_id = Column(Integer, ForeignKey('cell_mappings.id'),
|
||||
nullable=True)
|
||||
project_id = Column(String(255), nullable=False)
|
||||
queued_for_delete = Column(Boolean, default=False)
|
||||
cell_mapping = orm.relationship('CellMapping',
|
||||
backref=backref('instance_mapping', uselist=False),
|
||||
foreign_keys=cell_id,
|
||||
|
||||
@@ -716,6 +716,10 @@ class NovaAPIMigrationsWalk(test_migrations.WalkVersionsMixin):
|
||||
def _check_060(self, engine, data):
|
||||
self.assertColumnExists(engine, 'instance_group_policy', 'rules')
|
||||
|
||||
def _check_061(self, engine, data):
|
||||
self.assertColumnExists(engine, 'instance_mappings',
|
||||
'queued_for_delete')
|
||||
|
||||
|
||||
class TestNovaAPIMigrationsWalkSQLite(NovaAPIMigrationsWalk,
|
||||
test_base.DbTestCase,
|
||||
|
||||
Reference in New Issue
Block a user