VMware NSXv: Added router-type to database model

NSXv supports 'exclusive' and 'shared' router types, this patch adds
support for different router types to the plugin database model.
This doesn't add an additional migration script,
but overrides the existing one, adding a migration script isn't needed
since the plugin is still under development.

Change-Id: I05a595e5e12c8384612e0cc6eb0abc8e72ce3dc0
Signed-off-by: Roey Chen <roeyc@vmware.com>
This commit is contained in:
Roey Chen 2015-02-25 08:00:31 -08:00
parent 55c6bf9cc5
commit 436efc3098
2 changed files with 9 additions and 2 deletions

View File

@ -38,6 +38,8 @@ internal_edge_purpose_enum = sa.Enum('inter_edge_net',
name='nsxv_internal_edges_purpose')
tz_binding_type_enum = sa.Enum('flat', 'vlan', 'portgroup',
name='nsxv_tz_network_bindings_binding_type')
router_types_enum = sa.Enum('shared', 'exclusive',
name='nsxv_router_type')
def upgrade():
@ -138,7 +140,8 @@ def upgrade():
'nsxv_router_ext_attributes',
sa.Column('router_id', sa.String(length=36), nullable=False),
sa.Column('distributed', sa.Boolean(), nullable=False),
sa.Column('exclusive', sa.Boolean(), nullable=False),
sa.Column('router_type', router_types_enum,
default='exclusive', nullable=False),
sa.Column('service_router', sa.Boolean(), nullable=False),
sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
ondelete='CASCADE'),
@ -164,3 +167,4 @@ def downgrade():
internal_network_purpose_enum.drop(op.get_bind(), checkfirst=False)
internal_edge_purpose_enum.drop(op.get_bind(), checkfirst=False)
tz_binding_type_enum.drop(op.get_bind(), checkfirst=False)
router_types_enum.drop(op.get_bind(), checkfirst=False)

View File

@ -150,7 +150,10 @@ class NsxvRouterExtAttributes(model_base.BASEV2):
sa.ForeignKey('routers.id', ondelete="CASCADE"),
primary_key=True)
distributed = sa.Column(sa.Boolean, default=False, nullable=False)
exclusive = sa.Column(sa.Boolean, default=False, nullable=False)
router_type = sa.Column(
sa.Enum('shared', 'exclusive',
name='nsxv_router_type'),
default='exclusive', nullable=False)
service_router = sa.Column(sa.Boolean, default=False, nullable=False)
# Add a relationship to the Router model in order to instruct
# SQLAlchemy to eagerly load this association