FAWS: added DB fields for SG migration tool.

Change-Id: I4733ed43c160ab449394918ed61cc6636e595eb8
Closes-Bug: #1623727
JIRA: NCP-2077
This commit is contained in:
Alexander Medvedev 2016-09-14 18:56:45 -05:00
parent 391fd5bb7c
commit 764224c456
3 changed files with 37 additions and 0 deletions

View File

@ -20,6 +20,7 @@ from alembic import config as alembic_config
from alembic import environment
from alembic import script as alembic_script
from alembic import util as alembic_util
from neutron._i18n import _
from oslo_config import cfg
HEAD_FILENAME = 'HEAD'

View File

@ -0,0 +1,32 @@
"""FAWS: Added fields for SG migration
Revision ID: c07cd8303997
Revises: da46a8b30bd8
Create Date: 2016-09-14 15:51:53.112929
"""
# revision identifiers, used by Alembic.
revision = 'c07cd8303997'
down_revision = 'da46a8b30bd8'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('quark_security_groups',
sa.Column('external_service', sa.String(255)))
op.add_column('quark_security_groups',
sa.Column('external_service_id', sa.String(255)))
op.add_column('quark_security_group_rules',
sa.Column('external_service', sa.String(255)))
op.add_column('quark_security_group_rules',
sa.Column('external_service_id', sa.String(255)))
def downgrade():
op.drop_column('quark_security_groups', 'external_service')
op.drop_column('quark_security_groups', 'external_service_id')
op.drop_column('quark_security_group_rules', 'external_service')
op.drop_column('quark_security_group_rules', 'external_service_id')

View File

@ -403,6 +403,8 @@ class SecurityGroupRule(BASEV2, HasId, HasTenant):
remote_group_id = sa.Column(sa.String(36),
sa.ForeignKey("quark_security_groups.id"),
nullable=True)
external_service = sa.Column(sa.String(255), nullable=True)
external_service_id = sa.Column(sa.String(255), nullable=True)
class SecurityGroup(BASEV2, HasId, HasTenant):
@ -414,6 +416,8 @@ class SecurityGroup(BASEV2, HasId, HasTenant):
rules = orm.relationship(SecurityGroupRule, backref='group',
cascade='delete',
primaryjoin=join)
external_service = sa.Column(sa.String(255), nullable=True)
external_service_id = sa.Column(sa.String(255), nullable=True)
class Port(BASEV2, HasTenant, HasId, IsHazTags):