Merge "Add status attribute to bay"

This commit is contained in:
Jenkins 2015-02-12 07:43:32 +00:00 committed by Gerrit Code Review
commit f9db2b547b
4 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,34 @@
# 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 bay status
Revision ID: 5793cd26898d
Revises: 3bea56f25597
Create Date: 2015-02-09 12:54:09.449948
"""
# revision identifiers, used by Alembic.
revision = '5793cd26898d'
down_revision = '3bea56f25597'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('bay', sa.Column('status', sa.String(length=20),
nullable=True))
def downgrade():
op.drop_column('bay', 'status')

View File

@ -129,6 +129,7 @@ class Bay(Base):
master_address = Column(String(255))
minions_address = Column(JSONEncodedList)
node_count = Column(Integer())
status = Column(String(20), nullable=True)
class BayModel(Base):

View File

@ -20,6 +20,18 @@ from magnum.objects import base
from magnum.objects import utils as obj_utils
class Status(object):
CREATE_IN_PROGRESS = 'CREATE_IN_PROGRESS'
CREATE_FAILED = 'CREATE_FAILED'
CREATED = 'CREATED'
UPDATE_IN_PROGRESS = 'UPDATE_IN_PROGRESS'
UPDATE_FAILED = 'UPDATE_FAILED'
UPDATED = 'UPDATED'
DELETE_IN_PROGRESS = 'DELETE_IN_PROGRESS'
DELETE_FAILED = 'DELETE_FAILED'
DELETED = 'DELETED'
class Bay(base.MagnumObject):
# Version 1.0: Initial version
VERSION = '1.0'
@ -34,6 +46,10 @@ class Bay(base.MagnumObject):
'user_id': obj_utils.str_or_none,
'baymodel_id': obj_utils.str_or_none,
'stack_id': obj_utils.str_or_none,
# One of CREATE_IN_PROGRESS|CREATE_FAILED|CREATED
# UPDATE_IN_PROGRESS|UPDATE_FAILED|UPDATED
# DELETE_IN_PROGRESS|DELETE_FAILED|DELETED
'status': obj_utils.str_or_none,
'master_address': obj_utils.str_or_none,
'minions_address': obj_utils.list_or_none,
'node_count': obj_utils.int_or_none

View File

@ -47,6 +47,7 @@ def get_test_bay(**kw):
'baymodel_id': kw.get('baymodel_id',
'e74c40e0-d825-11e2-a28f-0800200c9a66'),
'stack_id': kw.get('stack_id', '047c6319-7abd-4bd9-a033-8c6af0173cd0'),
'status': kw.get('status', 'CREATE_IN_PROGRESS'),
'master_address': kw.get('master_address', '172.17.2.3'),
'minions_address': kw.get('minions_address', ['172.17.2.4']),
'node_count': kw.get('node_count', 3),