From 436efc3098d91d54699cbec091fec201b943d19e Mon Sep 17 00:00:00 2001 From: Roey Chen Date: Wed, 25 Feb 2015 08:00:31 -0800 Subject: [PATCH] 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 --- .../alembic_migrations/versions/4dbe243cd84d_nsxv.py | 6 +++++- neutron/plugins/vmware/dbexts/nsxv_models.py | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/neutron/db/migration/alembic_migrations/versions/4dbe243cd84d_nsxv.py b/neutron/db/migration/alembic_migrations/versions/4dbe243cd84d_nsxv.py index 6c17bfae6..c12ad4800 100644 --- a/neutron/db/migration/alembic_migrations/versions/4dbe243cd84d_nsxv.py +++ b/neutron/db/migration/alembic_migrations/versions/4dbe243cd84d_nsxv.py @@ -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) diff --git a/neutron/plugins/vmware/dbexts/nsxv_models.py b/neutron/plugins/vmware/dbexts/nsxv_models.py index bac20d8d0..f531ad2dd 100644 --- a/neutron/plugins/vmware/dbexts/nsxv_models.py +++ b/neutron/plugins/vmware/dbexts/nsxv_models.py @@ -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 -- 2.45.2