Add fixed_subnet field to baymodel

Ironic template needs to specify fixed subnet name/ID.
And also user sometimes want to build his cluster on
his network which he built.
This patch adds fixed_subnet field to baymodel to specify
fixed subnet which bay will build on.

Change-Id: Ia21ad6e3e1472a0d078d08369ef62601034fcc17
Partial-Implements: blueprint magnum-baremetal-full-support
This commit is contained in:
OTSUKA, Yuanying 2016-06-29 14:28:25 +09:00
parent eda5500edd
commit 62c75e5883
6 changed files with 39 additions and 2 deletions

View File

@ -82,6 +82,9 @@ class BayModel(base.APIBase):
fixed_network = wtypes.StringType(min_length=1, max_length=255)
"""The fixed network name to attach the Bay"""
fixed_subnet = wtypes.StringType(min_length=1, max_length=255)
"""The fixed subnet name to attach the Bay"""
network_driver = wtypes.StringType(min_length=1, max_length=255)
"""The name of the driver used for instantiating container networks"""
@ -178,6 +181,7 @@ class BayModel(base.APIBase):
keypair_id='keypair1',
external_network_id='ffc44e4a-2319-4062-bce0-9ae1c38b05ba',
fixed_network='private',
fixed_subnet='private-subnet',
network_driver='libnetwork',
volume_driver='cinder',
apiserver_port=8080,

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 fixed_subnet column to baymodel table
Revision ID: e0653b2d5271
Revises: 68ce16dfd341
Create Date: 2016-06-29 14:14:37.862594
"""
# revision identifiers, used by Alembic.
revision = 'e0653b2d5271'
down_revision = '68ce16dfd341'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('baymodel', sa.Column('fixed_subnet',
sa.String(length=255), nullable=True))

View File

@ -155,6 +155,7 @@ class BayModel(Base):
keypair_id = Column(String(255))
external_network_id = Column(String(255))
fixed_network = Column(String(255))
fixed_subnet = Column(String(255))
network_driver = Column(String(255))
volume_driver = Column(String(255))
dns_nameserver = Column(String(255))

View File

@ -37,7 +37,7 @@ 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.13'
VERSION = '1.14'
dbapi = dbapi.get_instance()
@ -54,6 +54,7 @@ class BayModel(base.MagnumPersistentObject, base.MagnumObject,
'dns_nameserver': fields.StringField(nullable=True),
'external_network_id': fields.StringField(nullable=True),
'fixed_network': fields.StringField(nullable=True),
'fixed_subnet': fields.StringField(nullable=True),
'network_driver': fields.StringField(nullable=True),
'volume_driver': fields.StringField(nullable=True),
'apiserver_port': fields.IntegerField(nullable=True),

View File

@ -32,6 +32,7 @@ def get_test_baymodel(**kw):
'external_network_id': kw.get('external_network_id',
'd1f02cfb-d27f-4068-9332-84d907cb0e2e'),
'fixed_network': kw.get('fixed_network', 'private'),
'fixed_subnet': kw.get('fixed_network', 'private-subnet'),
'network_driver': kw.get('network_driver'),
'volume_driver': kw.get('volume_driver'),
'dns_nameserver': kw.get('dns_nameserver', '8.8.1.1'),

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.13-dd8deda88d7ee7e8911fb900e0f75a1e',
'BayModel': '1.14-ae175b4aaba2c60df37cac63ef734853',
'Certificate': '1.0-2aff667971b85c1edf8d15684fd7d5e2',
'Container': '1.3-e2d9d2e8a8844d421148cd9fde6c6bd6',
'MyObj': '1.0-b43567e512438205e32f4e95ca616697',