]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
VMware NSXv: Added router-type to database model
authorRoey Chen <roeyc@vmware.com>
Wed, 25 Feb 2015 16:00:31 +0000 (08:00 -0800)
committerRoey Chen <roeyc@vmware.com>
Wed, 25 Feb 2015 16:28:43 +0000 (16:28 +0000)
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>
neutron/db/migration/alembic_migrations/versions/4dbe243cd84d_nsxv.py
neutron/plugins/vmware/dbexts/nsxv_models.py

index 6c17bfae635a764c23f76524ea5cb70e55d0e936..c12ad4800ba250e5c26cb74bed84fedfe7fd5f3a 100644 (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)
index bac20d8d0b316b65ed0e3ea787c58ea1db534980..f531ad2ddcbbb641881d520f5dceac5e807be8d2 100644 (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