Add storage_interface to node DB table

Add storage_interface DB field, database migration,
and object entry for storage_interface for boot from
volume functionality.

Initial versions of this revision added the field to
the node object, but since then Ironic's code has
drifted such that adding an object for an interface
has to take place along with the entire driver interface,
thus the object change is in the next revision.

Co-Authored-By: Stephane Miller <stephane@alum.mit.edu>
Change-Id: Ib5d5de87163570949c12d9e95c73e17c1c12eec1
Partial-Bug: #1559691
This commit is contained in:
Julia Kreger 2016-07-26 11:39:30 -04:00
parent 2a4d3cc5e8
commit fa200aaedd
3 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,32 @@
# 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 storage_interface DB field and object
Revision ID: 1d6951876d68
Revises: 493d8f27f235
Create Date: 2016-07-26 10:33:22.830739
"""
# revision identifiers, used by Alembic.
revision = '1d6951876d68'
down_revision = '493d8f27f235'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('nodes', sa.Column('storage_interface',
sa.String(255),
nullable=True))

View File

@ -151,6 +151,7 @@ class Node(Base):
management_interface = Column(String(255), nullable=True)
network_interface = Column(String(255), nullable=True)
raid_interface = Column(String(255), nullable=True)
storage_interface = Column(String(255), nullable=True)
power_interface = Column(String(255), nullable=True)
vendor_interface = Column(String(255), nullable=True)

View File

@ -623,6 +623,13 @@ class MigrationCheckersMixin(object):
for row in result:
self.assertEqual(CONF.default_portgroup_mode, row['mode'])
def _check_1d6951876d68(self, engine, data):
nodes = db_utils.get_table(engine, 'nodes')
col_names = [column.name for column in nodes.c]
self.assertIn('storage_interface', col_names)
self.assertIsInstance(nodes.c.storage_interface.type,
sqlalchemy.types.String)
def test_upgrade_and_version(self):
with patch_with_engine(self.engine):
self.migration_api.upgrade('head')