]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
add quota support for ryu plugin
authorYoshihiro Kaneko <ykaneko0929@gmail.com>
Tue, 7 Jan 2014 06:48:38 +0000 (15:48 +0900)
committerYoshihiro Kaneko <ykaneko0929@gmail.com>
Thu, 6 Feb 2014 11:16:00 +0000 (20:16 +0900)
This patch adds Quota extension support to Ryu plugin and db migration
script.

Closes-Bug: #1266650
Change-Id: I4328ebf7bf307390461807bd8bb3318ac2f64845

neutron/db/migration/alembic_migrations/versions/8f682276ee4_ryu_plugin_quota.py [new file with mode: 0644]
neutron/plugins/ryu/ryu_neutron_plugin.py

diff --git a/neutron/db/migration/alembic_migrations/versions/8f682276ee4_ryu_plugin_quota.py b/neutron/db/migration/alembic_migrations/versions/8f682276ee4_ryu_plugin_quota.py
new file mode 100644 (file)
index 0000000..d6efa81
--- /dev/null
@@ -0,0 +1,61 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+#
+# Copyright 2014 OpenStack Foundation
+#
+#    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.
+#
+
+"""ryu plugin quota
+
+Revision ID: 8f682276ee4
+Revises: 49f5e553f61f
+Create Date: 2014-01-07 15:47:17.349425
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '8f682276ee4'
+down_revision = '49f5e553f61f'
+
+# Change to ['*'] if this migration applies to all plugins
+
+migration_for_plugins = [
+    'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2'
+]
+
+from alembic import op
+import sqlalchemy as sa
+
+
+from neutron.db import migration
+
+
+def upgrade(active_plugins=None, options=None):
+    if not migration.should_run(active_plugins, migration_for_plugins):
+        return
+
+    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')
+    )
+
+
+def downgrade(active_plugins=None, options=None):
+    if not migration.should_run(active_plugins, migration_for_plugins):
+        return
+
+    op.drop_table('quotas')
index 7e2cbdfc46b58d989447b39cdb1cd832716633f6..5fe2845b1f4e93773d081f7dfc29128f507233f6 100644 (file)
@@ -98,7 +98,7 @@ class RyuNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
 
     _supported_extension_aliases = ["external-net", "router", "ext-gw-mode",
                                     "extraroute", "security-group",
-                                    "binding"]
+                                    "binding", "quotas"]
 
     @property
     def supported_extension_aliases(self):