From: Akihiro MOTOKI Date: Fri, 18 Jan 2013 17:53:25 +0000 (+0900) Subject: Enable NEC OpenFlow plugin to use per-tenant quota X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=983051b713ddf958d7f62efb12c3b328d9b25696;p=openstack-build%2Fneutron-build.git Enable NEC OpenFlow plugin to use per-tenant quota Fixes bug 1099889 Change-Id: I0b778371d0775e594c3217ceb329a7f4e58609f6 --- 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 index 000000000..3a45a00f0 --- /dev/null +++ b/quantum/db/migration/alembic_migrations/versions/1b693c095aa3_quota_ext_db_grizzly.py @@ -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 ### diff --git a/quantum/plugins/nec/nec_plugin.py b/quantum/plugins/nec/nec_plugin.py index c291d62de..a4f2f4058 100644 --- a/quantum/plugins/nec/nec_plugin.py +++ b/quantum/plugins/nec/nec_plugin.py @@ -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()