Add floatingips table for floating IP resources
Partially Implements: blueprint floatingip-reservation Change-Id: Ib00fda1356d477fa8e4e29af79c658fcd8f12472
This commit is contained in:
parent
b5c4acb96b
commit
84578965e3
|
@ -0,0 +1,54 @@
|
||||||
|
# Copyright 2019 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.
|
||||||
|
|
||||||
|
"""add-floatingip
|
||||||
|
|
||||||
|
Revision ID: e069c014356d
|
||||||
|
Revises: 35b314cd39ee
|
||||||
|
Create Date: 2019-01-10 10:15:47.874521
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'e069c014356d'
|
||||||
|
down_revision = '9593f3656974'
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_table('floatingips',
|
||||||
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||||
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||||
|
sa.Column('id', sa.String(length=36), nullable=False),
|
||||||
|
sa.Column('floating_network_id', sa.String(length=255),
|
||||||
|
nullable=False),
|
||||||
|
sa.Column('subnet_id', sa.String(length=255),
|
||||||
|
nullable=False),
|
||||||
|
sa.Column('floating_ip_address', sa.String(length=255),
|
||||||
|
nullable=False),
|
||||||
|
sa.Column('reservable', sa.Boolean(),
|
||||||
|
server_default=sa.text(u'true'), nullable=False),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
sa.UniqueConstraint('subnet_id', 'floating_ip_address'))
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_table('floatingips')
|
||||||
|
# ### end Alembic commands ###
|
|
@ -244,3 +244,20 @@ class ComputeHostExtraCapability(mb.BlazarBase):
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return super(ComputeHostExtraCapability, self).to_dict()
|
return super(ComputeHostExtraCapability, self).to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
# Floating IP
|
||||||
|
|
||||||
|
class FloatingIP(mb.BlazarBase):
|
||||||
|
"""A table for Floating IP resource."""
|
||||||
|
|
||||||
|
__tablename__ = 'floatingips'
|
||||||
|
|
||||||
|
id = _id_column()
|
||||||
|
floating_network_id = sa.Column(sa.String(255), nullable=False)
|
||||||
|
subnet_id = sa.Column(sa.String(255), nullable=False)
|
||||||
|
floating_ip_address = sa.Column(sa.String(255), nullable=False)
|
||||||
|
reservable = sa.Column(sa.Boolean, nullable=False,
|
||||||
|
server_default=sa.true())
|
||||||
|
|
||||||
|
__table_args__ = (sa.UniqueConstraint('subnet_id', 'floating_ip_address'),)
|
||||||
|
|
Loading…
Reference in New Issue