Add floating_ip_enabled field to baymodel
This patch adds floating_ip_enabled field to baymodel to specify whether floating ip is used or not. Change-Id: I99677221250480b43a4b95ebf460c43bc77090ad Partially-Implements: blueprint bay-with-no-floating-ips
This commit is contained in:
parent
067272e043
commit
26370a2509
|
@ -145,6 +145,9 @@ class BayModel(base.APIBase):
|
|||
nodes or not.
|
||||
"""
|
||||
|
||||
floating_ip_enabled = wsme.wsattr(types.boolean, default=True)
|
||||
"""Indicates whether created bays should have a floating ip or not."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.fields = []
|
||||
for field in objects.BayModel.fields:
|
||||
|
@ -197,7 +200,9 @@ class BayModel(base.APIBase):
|
|||
created_at=timeutils.utcnow(),
|
||||
updated_at=timeutils.utcnow(),
|
||||
public=False,
|
||||
master_lb_enabled=False)
|
||||
master_lb_enabled=False,
|
||||
floating_ip_enabled=True,
|
||||
)
|
||||
return cls._convert_with_links(sample, 'http://localhost:9511')
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# 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 floating_ip_enabled column to baymodel table
|
||||
|
||||
Revision ID: b1f612248cab
|
||||
Revises: 859fb45df249
|
||||
Create Date: 2016-08-05 15:31:46.203266
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b1f612248cab'
|
||||
down_revision = '859fb45df249'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('baymodel',
|
||||
sa.Column('floating_ip_enabled',
|
||||
sa.Boolean(),
|
||||
default=True))
|
|
@ -177,6 +177,7 @@ class BayModel(Base):
|
|||
server_type = Column(String(255))
|
||||
insecure_registry = Column(String(255))
|
||||
master_lb_enabled = Column(Boolean, default=False)
|
||||
floating_ip_enabled = Column(Boolean, default=True)
|
||||
|
||||
|
||||
class X509KeyPair(Base):
|
||||
|
|
|
@ -37,7 +37,9 @@ class BayModel(base.MagnumPersistentObject, base.MagnumObject,
|
|||
# Version 1.11: Added 'insecure_registry' field
|
||||
# Version 1.12: Added 'docker_storage_driver' field
|
||||
# Version 1.13: Added 'master_lb_enabled' field
|
||||
VERSION = '1.14'
|
||||
# Version 1.14: Added 'fixed_subnet' field
|
||||
# Version 1.15: Added 'floating_ip_enabled' field
|
||||
VERSION = '1.15'
|
||||
|
||||
dbapi = dbapi.get_instance()
|
||||
|
||||
|
@ -73,6 +75,7 @@ class BayModel(base.MagnumPersistentObject, base.MagnumObject,
|
|||
'server_type': fields.StringField(nullable=True),
|
||||
'insecure_registry': fields.StringField(nullable=True),
|
||||
'master_lb_enabled': fields.BooleanField(default=False),
|
||||
'floating_ip_enabled': fields.BooleanField(default=True),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -54,6 +54,7 @@ def get_test_baymodel(**kw):
|
|||
'server_type': kw.get('server_type', 'vm'),
|
||||
'insecure_registry': kw.get('insecure_registry', '10.0.0.1:5000'),
|
||||
'master_lb_enabled': kw.get('master_lb_enabled', True),
|
||||
'floating_ip_enabled': kw.get('floating_ip_enabled', True),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ class TestObject(test_base.TestCase, _TestObject):
|
|||
# http://docs.openstack.org/developer/magnum/objects.html
|
||||
object_data = {
|
||||
'Bay': '1.6-2386f79585a6c24bc7960884a4d0ebce',
|
||||
'BayModel': '1.14-ae175b4aaba2c60df37cac63ef734853',
|
||||
'BayModel': '1.15-9b961246b348aa380783dae14014e423',
|
||||
'Certificate': '1.0-2aff667971b85c1edf8d15684fd7d5e2',
|
||||
'MyObj': '1.0-b43567e512438205e32f4e95ca616697',
|
||||
'MyObj': '1.0-34c4b1aadefd177b13f9a2f894cc23cd',
|
||||
|
|
Loading…
Reference in New Issue