Add node fields for raid configuration

This commit introduces two new fields -
node.raid_config and node.target_raid_config
which will be used to store information regarding
raid configuration.

Change-Id: I42d1011f8d9923bbeeb986410eb1cc40db212feb
Implements: blueprint ironic-generic-raid-interface
This commit is contained in:
Ramakrishnan G 2015-06-26 11:03:03 +00:00
parent fc4a2d8ad9
commit 9701cd4307
5 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,38 @@
# 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.
"""Add node.raid_config and node.target_raid_config
Revision ID: 789acc877671
Revises: 2fb93ffd2af1
Create Date: 2015-06-26 01:21:46.062311
"""
# revision identifiers, used by Alembic.
revision = '789acc877671'
down_revision = '2fb93ffd2af1'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('nodes', sa.Column('raid_config', sa.Text(),
nullable=True))
op.add_column('nodes', sa.Column('target_raid_config', sa.Text(),
nullable=True))
def downgrade():
op.drop_column('nodes', 'raid_config')
op.drop_column('nodes', 'target_raid_config')

View File

@ -169,6 +169,9 @@ class Node(Base):
driver_internal_info = Column(JSONEncodedDict)
clean_step = Column(JSONEncodedDict)
raid_config = Column(JSONEncodedDict)
target_raid_config = Column(JSONEncodedDict)
# NOTE(deva): this is the host name of the conductor which has
# acquired a TaskManager lock on the node.
# We should use an INT FK (conductors.id) in the future.

View File

@ -36,7 +36,8 @@ class Node(base.IronicObject):
# Version 1.9: Add driver_internal_info
# Version 1.10: Add name and get_by_name()
# Version 1.11: Add clean_step
VERSION = '1.11'
# Version 1.12: Add raid_config and target_raid_config
VERSION = '1.12'
dbapi = db_api.get_instance()
@ -57,6 +58,9 @@ class Node(base.IronicObject):
# or has not yet started.
'clean_step': obj_utils.dict_or_none,
'raid_config': obj_utils.dict_or_none,
'target_raid_config': obj_utils.dict_or_none,
'instance_info': obj_utils.dict_or_none,
'properties': obj_utils.dict_or_none,
'reservation': obj_utils.str_or_none,

View File

@ -364,6 +364,16 @@ class MigrationCheckersMixin(object):
self.assertIsInstance(nodes.c.clean_step.type,
sqlalchemy.types.String)
def _check_789acc877671(self, engine, data):
nodes = db_utils.get_table(engine, 'nodes')
col_names = [column.name for column in nodes.c]
self.assertIn('raid_config', col_names)
self.assertIn('target_raid_config', col_names)
self.assertIsInstance(nodes.c.raid_config.type,
sqlalchemy.types.String)
self.assertIsInstance(nodes.c.target_raid_config.type,
sqlalchemy.types.String)
def _check_2fb93ffd2af1(self, engine, data):
nodes = db_utils.get_table(engine, 'nodes')
bigstring = 'a' * 255

View File

@ -222,6 +222,8 @@ def get_test_node(**kw):
'created_at': kw.get('created_at'),
'inspection_finished_at': kw.get('inspection_finished_at'),
'inspection_started_at': kw.get('inspection_started_at'),
'raid_config': kw.get('raid_config'),
'target_raid_config': kw.get('target_raid_config'),
}