From: Yoshihiro Kaneko Date: Tue, 7 Jan 2014 06:48:38 +0000 (+0900) Subject: add quota support for ryu plugin X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7dd15d0ee4faf2acce48e538335294a05f6613ab;p=openstack-build%2Fneutron-build.git add quota support for ryu plugin This patch adds Quota extension support to Ryu plugin and db migration script. Closes-Bug: #1266650 Change-Id: I4328ebf7bf307390461807bd8bb3318ac2f64845 --- 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 index 000000000..d6efa8138 --- /dev/null +++ b/neutron/db/migration/alembic_migrations/versions/8f682276ee4_ryu_plugin_quota.py @@ -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') diff --git a/neutron/plugins/ryu/ryu_neutron_plugin.py b/neutron/plugins/ryu/ryu_neutron_plugin.py index 7e2cbdfc4..5fe2845b1 100644 --- a/neutron/plugins/ryu/ryu_neutron_plugin.py +++ b/neutron/plugins/ryu/ryu_neutron_plugin.py @@ -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):