Merge "Add two fields to container object"

This commit is contained in:
Jenkins 2017-05-16 04:32:50 +00:00 committed by Gerrit Code Review
commit 763e6a300d
5 changed files with 49 additions and 4 deletions

View File

@ -0,0 +1,37 @@
# 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 websocket_url and websocket_token
Revision ID: 5359d23b2322
Revises: 17ab8b533cc8
Create Date: 2017-05-03 15:54:26.194603
"""
# revision identifiers, used by Alembic.
revision = '5359d23b2322'
down_revision = '17ab8b533cc8'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('container',
sa.Column('websocket_url', sa.String(length=255),
nullable=True))
op.add_column('container',
sa.Column('websocket_token', sa.String(length=255),
nullable=True))

View File

@ -152,6 +152,8 @@ class Container(Base):
status_detail = Column(String(50))
interactive = Column(Boolean, default=False)
image_driver = Column(String(255))
websocket_url = Column(String(255))
websocket_token = Column(String(255))
class Image(Base):

View File

@ -35,7 +35,8 @@ class Container(base.ZunPersistentObject, base.ZunObject):
# Version 1.13: Add more task states for container
# Version 1.14: Add method 'list_by_host'
# Version 1.15: Combine tty and stdin_open
VERSION = '1.15'
# Version 1.16: Add websocket_url and token
VERSION = '1.16'
fields = {
'id': fields.IntegerField(),
@ -63,7 +64,9 @@ class Container(base.ZunPersistentObject, base.ZunObject):
'restart_policy': fields.DictOfStringsField(nullable=True),
'status_detail': fields.StringField(nullable=True),
'interactive': fields.BooleanField(nullable=True),
'image_driver': fields.StringField(nullable=True)
'image_driver': fields.StringField(nullable=True),
'websocket_url': fields.StringField(nullable=True),
'websocket_token': fields.StringField(nullable=True)
}
@staticmethod

View File

@ -61,7 +61,10 @@ def get_test_container(**kw):
{'Name': 'no', 'MaximumRetryCount': '0'}),
'status_detail': kw.get('status_detail', 'up from 5 hours'),
'interactive': kw.get('interactive', True),
'image_driver': 'glance'
'image_driver': 'glance',
'websocket_url': 'ws://127.0.0.1:6784/4c03164962fa/attach/'
'ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1',
'websocket_token': '7878038e-957c-4d52-ae19-1e9561784e7b',
}

View File

@ -354,7 +354,7 @@ class TestObject(test_base.TestCase, _TestObject):
# For more information on object version testing, read
# http://docs.openstack.org/developer/zun/objects.html
object_data = {
'Container': '1.15-b2f1403b9bfcd97b52f46d2c53f003a5',
'Container': '1.16-ed5876b31900577fc7f236098b16d2b4',
'Image': '1.0-0b976be24f4f6ee0d526e5c981ce0633',
'MyObj': '1.0-34c4b1aadefd177b13f9a2f894cc23cd',
'NUMANode': '1.0-cba878b70b2f8b52f1e031b41ac13b4e',