]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Enable NEC OpenFlow plugin to use per-tenant quota
authorAkihiro MOTOKI <motoki@da.jp.nec.com>
Fri, 18 Jan 2013 17:53:25 +0000 (02:53 +0900)
committerAkihiro MOTOKI <motoki@da.jp.nec.com>
Tue, 22 Jan 2013 05:21:24 +0000 (14:21 +0900)
Fixes bug 1099889

Change-Id: I0b778371d0775e594c3217ceb329a7f4e58609f6

quantum/db/migration/alembic_migrations/versions/1b693c095aa3_quota_ext_db_grizzly.py [new file with mode: 0644]
quantum/plugins/nec/nec_plugin.py

diff --git a/quantum/db/migration/alembic_migrations/versions/1b693c095aa3_quota_ext_db_grizzly.py b/quantum/db/migration/alembic_migrations/versions/1b693c095aa3_quota_ext_db_grizzly.py
new file mode 100644 (file)
index 0000000..3a45a00
--- /dev/null
@@ -0,0 +1,64 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+#
+# Copyright 2013 OpenStack LLC
+#
+#    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.
+#
+
+"""Quota ext support added in Grizzly
+
+Revision ID: 1b693c095aa3
+Revises: 1d76643bcec4
+Create Date: 2013-01-19 02:58:17.667524
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '1b693c095aa3'
+down_revision = '1d76643bcec4'
+
+# Change to ['*'] if this migration applies to all plugins
+
+migration_for_plugins = [
+    'quantum.plugins.nec.nec_plugin.NECPluginV2'
+]
+
+from alembic import op
+import sqlalchemy as sa
+
+from quantum.db import migration
+
+
+def upgrade(active_plugin=None, options=None):
+    if not migration.should_run(active_plugin, migration_for_plugins):
+        return
+
+    ### commands auto generated by Alembic - please adjust! ###
+    op.create_table(
+        'quotas',
+        sa.Column('id', sa.String(length=36), nullable=False),
+        sa.Column('tenant_id', sa.String(length=255), nullable=True),
+        sa.Column('resource', sa.String(length=255), nullable=True),
+        sa.Column('limit', sa.Integer(), nullable=True),
+        sa.PrimaryKeyConstraint('id')
+    )
+    ### end Alembic commands ###
+
+
+def downgrade(active_plugin=None, options=None):
+    if not migration.should_run(active_plugin, migration_for_plugins):
+        return
+
+    ### commands auto generated by Alembic - please adjust! ###
+    op.drop_table('quotas')
+    ### end Alembic commands ###
index c291d62deccdf6fb283ec1ca32639e6e40d6440d..a4f2f405815d9a048e6d8fae5c0a1cbe7575c0ff 100644 (file)
@@ -21,6 +21,8 @@ from quantum import context
 from quantum.db import dhcp_rpc_base
 from quantum.db import l3_db
 from quantum.db import l3_rpc_base
+#NOTE(amotoki): quota_db cannot be removed, it is for db model
+from quantum.db import quota_db
 from quantum.openstack.common import log as logging
 from quantum.openstack.common import rpc
 from quantum.plugins.nec.common import config
@@ -58,7 +60,7 @@ class NECPluginV2(nec_plugin_base.NECPluginV2Base, l3_db.L3_NAT_db_mixin):
           at https://github.com/nec-openstack/quantum-openflow-plugin .
     """
 
-    supported_extension_aliases = ["router"]
+    supported_extension_aliases = ["router", "quotas"]
 
     def __init__(self):
         ndb.initialize()