Merge "Add master_lb_enabled field to baymodel"

This commit is contained in:
Jenkins 2016-06-29 05:10:15 +00:00 committed by Gerrit Code Review
commit d310a65970
6 changed files with 43 additions and 3 deletions

View File

@ -138,6 +138,11 @@ class BayModel(base.APIBase):
docker_storage_driver = wtypes.Enum(str, *fields.DockerStorageDriver.ALL)
"""Docker storage driver"""
master_lb_enabled = wsme.wsattr(types.boolean, default=False)
"""Indicates whether created bays should have a load balancer for master
nodes or not.
"""
def __init__(self, **kwargs):
self.fields = []
for field in objects.BayModel.fields:
@ -188,7 +193,8 @@ class BayModel(base.APIBase):
insecure_registry='10.238.100.100:5000',
created_at=timeutils.utcnow(),
updated_at=timeutils.utcnow(),
public=False),
public=False,
master_lb_enabled=False)
return cls._convert_with_links(sample, 'http://localhost:9511')

View File

@ -0,0 +1,30 @@
# 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 master_lb_enabled column to baymodel table
Revision ID: 68ce16dfd341
Revises: 085e601a39f6
Create Date: 2016-06-23 18:44:55.312413
"""
# revision identifiers, used by Alembic.
revision = '68ce16dfd341'
down_revision = '085e601a39f6'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('baymodel',
sa.Column('master_lb_enabled', sa.Boolean(), default=False))

View File

@ -172,6 +172,7 @@ class BayModel(Base):
public = Column(Boolean, default=False)
server_type = Column(String(255))
insecure_registry = Column(String(255))
master_lb_enabled = Column(Boolean, default=False)
class Container(Base):

View File

@ -36,7 +36,8 @@ class BayModel(base.MagnumPersistentObject, base.MagnumObject,
# Version 1.10: Removed 'ssh_authorized_key' field
# Version 1.11: Added 'insecure_registry' field
# Version 1.12: Added 'docker_storage_driver' field
VERSION = '1.12'
# Version 1.13: Added 'master_lb_enabled' field
VERSION = '1.13'
dbapi = dbapi.get_instance()
@ -70,6 +71,7 @@ class BayModel(base.MagnumPersistentObject, base.MagnumObject,
'public': fields.BooleanField(default=False),
'server_type': fields.StringField(nullable=True),
'insecure_registry': fields.StringField(nullable=True),
'master_lb_enabled': fields.BooleanField(default=False),
}
@staticmethod

View File

@ -52,6 +52,7 @@ def get_test_baymodel(**kw):
'public': kw.get('public', False),
'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', False),
}

View File

@ -363,7 +363,7 @@ class TestObject(test_base.TestCase, _TestObject):
# http://docs.openstack.org/developer/magnum/objects.html
object_data = {
'Bay': '1.5-a3b9292ef5d35175b93ca46ba3baec2d',
'BayModel': '1.12-ab6910eba29f1af6e6660020228d31d0',
'BayModel': '1.13-dd8deda88d7ee7e8911fb900e0f75a1e',
'Certificate': '1.0-2aff667971b85c1edf8d15684fd7d5e2',
'Container': '1.3-e2d9d2e8a8844d421148cd9fde6c6bd6',
'MyObj': '1.0-b43567e512438205e32f4e95ca616697',