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
This commit is contained in:
Yoshihiro Kaneko 2014-01-07 15:48:38 +09:00
parent c6691a07e1
commit d4ec8e13d7
2 changed files with 62 additions and 1 deletions

View File

@ -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')

View 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):