Rename bay's minions_address to node_addresses

Minions are a Kubernetes concept that maps directly to Magnum's
concept of nodes. This patch renames the column 'minions_address'
to 'node_addresses', so that it is more clear what is stored there
and to be more agnostic across each Container Orchestration
Environment.

Change-Id: I551b0774a08492cb0d45c17b905a830a173522e0
Partial-Implements: blueprint multiple-bay-templates
This commit is contained in:
Andrew Melton 2015-03-27 08:21:26 -07:00
parent 18fdf357eb
commit 60990a83be
7 changed files with 40 additions and 8 deletions

View File

@ -245,13 +245,13 @@ class HeatPoller(object):
def poll_and_check(self):
# TODO(yuanying): temporary implementation to update api_address,
# minions_address and bay status
# node_addresses and bay status
stack = self.openstack_client.heat().stacks.get(self.bay.stack_id)
self.attempts += 1
if (stack.stack_status in ['CREATE_COMPLETE', 'UPDATE_COMPLETE']):
parsed_outputs = _parse_stack_outputs(stack.outputs)
self.bay.api_address = parsed_outputs["kube_master"]
self.bay.minions_address = parsed_outputs["kube_minions_external"]
self.bay.node_addresses = parsed_outputs["kube_minions_external"]
self.bay.status = stack.stack_status
self.bay.save()
raise loopingcall.LoopingCallDone()

View File

@ -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.
"""rename-bay-minions-address
Revision ID: 2ace4006498
Revises: 29affeaa2bc2
Create Date: 2015-03-27 15:15:36.309601
"""
# revision identifiers, used by Alembic.
revision = '2ace4006498'
down_revision = '29affeaa2bc2'
from alembic import op
from magnum.db.sqlalchemy import models
def upgrade():
op.alter_column('bay', 'minions_address',
new_column_name='node_addresses',
existing_type=models.JSONEncodedList())

View File

@ -128,8 +128,8 @@ class Connection(api.Connection):
query = query.filter_by(stack_id=filters['stack_id'])
if 'api_address' in filters:
query = query.filter_by(api_address=filters['api_address'])
if 'minions_address' in filters:
query = query.filter_by(minions_address=filters['minions_address'])
if 'node_addresses' in filters:
query = query.filter_by(node_addresses=filters['node_addresses'])
if 'project_id' in filters:
query = query.filter_by(project_id=filters['project_id'])
if 'user_id' in filters:

View File

@ -126,7 +126,7 @@ class Bay(Base):
baymodel_id = Column(String(255))
stack_id = Column(String(255))
api_address = Column(String(255))
minions_address = Column(JSONEncodedList)
node_addresses = Column(JSONEncodedList)
node_count = Column(Integer())
status = Column(String(20), nullable=True)

View File

@ -51,7 +51,7 @@ class Bay(base.MagnumObject):
# DELETE_IN_PROGRESS|DELETE_FAILED|DELETED
'status': obj_utils.str_or_none,
'api_address': obj_utils.str_or_none,
'minions_address': obj_utils.list_or_none,
'node_addresses': obj_utils.list_or_none,
'node_count': obj_utils.int_or_none
}

View File

@ -47,7 +47,7 @@ class TestBayK8sHeat(base.TestCase):
'name': 'bay1',
'stack_id': 'xx-xx-xx-xx',
'api_address': '172.17.2.3',
'minions_address': ['172.17.2.4'],
'node_addresses': ['172.17.2.4'],
'node_count': 1,
}

View File

@ -60,7 +60,7 @@ def get_test_bay(**kw):
'stack_id': kw.get('stack_id', '047c6319-7abd-4bd9-a033-8c6af0173cd0'),
'status': kw.get('status', 'CREATE_IN_PROGRESS'),
'api_address': kw.get('api_address', '172.17.2.3'),
'minions_address': kw.get('minions_address', ['172.17.2.4']),
'node_addresses': kw.get('node_addresses', ['172.17.2.4']),
'node_count': kw.get('node_count', 3),
'created_at': kw.get('created_at'),
'updated_at': kw.get('updated_at'),