summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Rocha <rocha.porto@gmail.com>2017-07-31 13:08:56 +0000
committerRicardo Rocha <rocha.porto@gmail.com>2017-12-15 16:32:40 +0000
commit84006f63d721e0e0048a09b79745625f08a42aae (patch)
tree5e13a265b8e199af287c25f9a78df83f550beeae
parent28fff8006ae17d9afeee4ad409e12b6608fa26cb (diff)
Allow flavor_id on cluster create
Add flavor_id as an option during cluster create. If not given, the default is taken from the cluster template. Add flavor_id in the Cluster object and use that instead of the one from ClusterTemplate. Update both magnum and magnum cli documentation to reflect the above changes. Partial-Bug: #1699245 Change-Id: Ib60c05cce1cf2639ca4740abdd264403033433f9
Notes
Notes (review): Code-Review+2: Spyros Trigazis (strigazi) <strigazi@gmail.com> Code-Review+1: zhubingbing <zhu.bingbing@99cloud.net> Code-Review+2: yatin <ykarel@redhat.com> Workflow+1: yatin <ykarel@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Sun, 17 Dec 2017 12:15:25 +0000 Reviewed-on: https://review.openstack.org/489512 Project: openstack/magnum Branch: refs/heads/master
-rw-r--r--api-ref/source/clusters.inc1
-rw-r--r--api-ref/source/samples/cluster-create-req.json3
-rw-r--r--doc/source/user/index.rst2
-rw-r--r--magnum/api/attr_validator.py7
-rwxr-xr-xmagnum/api/controllers/v1/bay.py10
-rwxr-xr-xmagnum/api/controllers/v1/cluster.py10
-rw-r--r--magnum/db/sqlalchemy/alembic/versions/041d9a0f1159_add_flavor_id_to_cluster.py30
-rw-r--r--magnum/db/sqlalchemy/models.py1
-rw-r--r--magnum/drivers/heat/k8s_template_def.py2
-rw-r--r--magnum/drivers/heat/swarm_fedora_template_def.py2
-rw-r--r--magnum/drivers/heat/swarm_mode_template_def.py2
-rw-r--r--magnum/drivers/mesos_ubuntu_v1/template_def.py2
-rw-r--r--magnum/objects/cluster.py4
-rw-r--r--magnum/tests/unit/api/controllers/v1/test_cluster.py18
-rw-r--r--magnum/tests/unit/api/test_attr_validator.py9
-rw-r--r--magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py18
-rw-r--r--magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py2
-rw-r--r--magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py2
-rw-r--r--magnum/tests/unit/db/utils.py1
-rw-r--r--magnum/tests/unit/objects/test_objects.py2
20 files changed, 101 insertions, 27 deletions
diff --git a/api-ref/source/clusters.inc b/api-ref/source/clusters.inc
index 54fc6dd..b38364d 100644
--- a/api-ref/source/clusters.inc
+++ b/api-ref/source/clusters.inc
@@ -41,6 +41,7 @@ Request
41 - keypair: keypair_id 41 - keypair: keypair_id
42 - master_flavor_id: master_flavor_id 42 - master_flavor_id: master_flavor_id
43 - labels: labels 43 - labels: labels
44 - flavor_id: flavor_id
44 45
45.. note:: 46.. note::
46 47
diff --git a/api-ref/source/samples/cluster-create-req.json b/api-ref/source/samples/cluster-create-req.json
index e4c77f3..c5f8d49 100644
--- a/api-ref/source/samples/cluster-create-req.json
+++ b/api-ref/source/samples/cluster-create-req.json
@@ -8,5 +8,6 @@
8 "keypair":"my_keypair", 8 "keypair":"my_keypair",
9 "master_flavor_id":null, 9 "master_flavor_id":null,
10 "labels":{ 10 "labels":{
11 } 11 },
12 "flavor_id":null
12} 13}
diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst
index f6c97d9..68e1b2f 100644
--- a/doc/source/user/index.rst
+++ b/doc/source/user/index.rst
@@ -200,7 +200,7 @@ They are loosely grouped as: mandatory, infrastructure, COE specific.
200 200
201--flavor \<flavor\> 201--flavor \<flavor\>
202 The nova flavor id for booting the node servers. The default 202 The nova flavor id for booting the node servers. The default
203 is 'm1.small'. 203 is 'm1.small'. This value can be overridden at cluster creation.
204 204
205--master-flavor \<master-flavor\> 205--master-flavor \<master-flavor\>
206 The nova flavor id for booting the master or manager servers. The 206 The nova flavor id for booting the master or manager servers. The
diff --git a/magnum/api/attr_validator.py b/magnum/api/attr_validator.py
index ade2a19..a056282 100644
--- a/magnum/api/attr_validator.py
+++ b/magnum/api/attr_validator.py
@@ -188,7 +188,12 @@ def validate_os_resources(context, cluster_template, cluster=None):
188 cli = clients.OpenStackClients(context) 188 cli = clients.OpenStackClients(context)
189 189
190 for attr, validate_method in validators.items(): 190 for attr, validate_method in validators.items():
191 if attr in cluster_template and cluster_template[attr] is not None: 191 if cluster and attr in cluster and cluster[attr]:
192 if attr != 'labels':
193 validate_method(cli, cluster[attr])
194 else:
195 validate_method(cluster[attr])
196 elif attr in cluster_template and cluster_template[attr] is not None:
192 if attr != 'labels': 197 if attr != 'labels':
193 validate_method(cli, cluster_template[attr]) 198 validate_method(cli, cluster_template[attr])
194 else: 199 else:
diff --git a/magnum/api/controllers/v1/bay.py b/magnum/api/controllers/v1/bay.py
index 47aba45..5285943 100755
--- a/magnum/api/controllers/v1/bay.py
+++ b/magnum/api/controllers/v1/bay.py
@@ -98,6 +98,9 @@ class Bay(base.APIBase):
98 master_flavor_id = wtypes.StringType(min_length=1, max_length=255) 98 master_flavor_id = wtypes.StringType(min_length=1, max_length=255)
99 """The master flavor of this Bay""" 99 """The master flavor of this Bay"""
100 100
101 flavor_id = wtypes.StringType(min_length=1, max_length=255)
102 """The flavor of this Bay"""
103
101 bay_create_timeout = wsme.wsattr(wtypes.IntegerType(minimum=0), default=60) 104 bay_create_timeout = wsme.wsattr(wtypes.IntegerType(minimum=0), default=60)
102 """Timeout for creating the bay in minutes. Default to 60 if not set""" 105 """Timeout for creating the bay in minutes. Default to 60 if not set"""
103 106
@@ -181,7 +184,7 @@ class Bay(base.APIBase):
181 if not expand: 184 if not expand:
182 bay.unset_fields_except(['uuid', 'name', 'baymodel_id', 185 bay.unset_fields_except(['uuid', 'name', 'baymodel_id',
183 'docker_volume_size', 'labels', 186 'docker_volume_size', 'labels',
184 'master_flavor_id', 187 'master_flavor_id', 'flavor_id',
185 'node_count', 'status', 188 'node_count', 'status',
186 'bay_create_timeout', 'master_count', 189 'bay_create_timeout', 'master_count',
187 'stack_id']) 190 'stack_id'])
@@ -208,6 +211,7 @@ class Bay(base.APIBase):
208 docker_volume_size=1, 211 docker_volume_size=1,
209 labels={}, 212 labels={},
210 master_flavor_id=None, 213 master_flavor_id=None,
214 flavor_id=None,
211 bay_create_timeout=15, 215 bay_create_timeout=15,
212 stack_id='49dc23f5-ffc9-40c3-9d34-7be7f9e34d63', 216 stack_id='49dc23f5-ffc9-40c3-9d34-7be7f9e34d63',
213 status=fields.ClusterStatus.CREATE_COMPLETE, 217 status=fields.ClusterStatus.CREATE_COMPLETE,
@@ -441,6 +445,10 @@ class BaysController(base.Controller):
441 if bay.master_flavor_id == wtypes.Unset or not bay.master_flavor_id: 445 if bay.master_flavor_id == wtypes.Unset or not bay.master_flavor_id:
442 bay.master_flavor_id = baymodel.master_flavor_id 446 bay.master_flavor_id = baymodel.master_flavor_id
443 447
448 # If flavor_id is not present, use baymodel value
449 if bay.flavor_id == wtypes.Unset or not bay.flavor_id:
450 bay.flavor_id = baymodel.flavor_id
451
444 bay_dict = bay.as_dict() 452 bay_dict = bay.as_dict()
445 bay_dict['keypair'] = baymodel.keypair_id 453 bay_dict['keypair'] = baymodel.keypair_id
446 attr_validator.validate_os_resources(context, baymodel.as_dict(), 454 attr_validator.validate_os_resources(context, baymodel.as_dict(),
diff --git a/magnum/api/controllers/v1/cluster.py b/magnum/api/controllers/v1/cluster.py
index f178238..06a7061 100755
--- a/magnum/api/controllers/v1/cluster.py
+++ b/magnum/api/controllers/v1/cluster.py
@@ -116,6 +116,9 @@ class Cluster(base.APIBase):
116 master_flavor_id = wtypes.StringType(min_length=1, max_length=255) 116 master_flavor_id = wtypes.StringType(min_length=1, max_length=255)
117 """The flavor of the master node for this Cluster""" 117 """The flavor of the master node for this Cluster"""
118 118
119 flavor_id = wtypes.StringType(min_length=1, max_length=255)
120 """The flavor of this Cluster"""
121
119 create_timeout = wsme.wsattr(wtypes.IntegerType(minimum=0), default=60) 122 create_timeout = wsme.wsattr(wtypes.IntegerType(minimum=0), default=60)
120 """Timeout for creating the cluster in minutes. Default to 60 if not set""" 123 """Timeout for creating the cluster in minutes. Default to 60 if not set"""
121 124
@@ -169,7 +172,7 @@ class Cluster(base.APIBase):
169 cluster.unset_fields_except(['uuid', 'name', 'cluster_template_id', 172 cluster.unset_fields_except(['uuid', 'name', 'cluster_template_id',
170 'keypair', 'docker_volume_size', 173 'keypair', 'docker_volume_size',
171 'labels', 'node_count', 'status', 174 'labels', 'node_count', 'status',
172 'master_flavor_id', 175 'master_flavor_id', 'flavor_id',
173 'create_timeout', 'master_count', 176 'create_timeout', 'master_count',
174 'stack_id']) 177 'stack_id'])
175 178
@@ -197,6 +200,7 @@ class Cluster(base.APIBase):
197 docker_volume_size=1, 200 docker_volume_size=1,
198 labels={}, 201 labels={},
199 master_flavor_id='m1.small', 202 master_flavor_id='m1.small',
203 flavor_id='m1.small',
200 create_timeout=15, 204 create_timeout=15,
201 stack_id='49dc23f5-ffc9-40c3-9d34-7be7f9e34d63', 205 stack_id='49dc23f5-ffc9-40c3-9d34-7be7f9e34d63',
202 status=fields.ClusterStatus.CREATE_COMPLETE, 206 status=fields.ClusterStatus.CREATE_COMPLETE,
@@ -421,6 +425,10 @@ class ClustersController(base.Controller):
421 not cluster.master_flavor_id): 425 not cluster.master_flavor_id):
422 cluster.master_flavor_id = cluster_template.master_flavor_id 426 cluster.master_flavor_id = cluster_template.master_flavor_id
423 427
428 # If flavor_id is not present, use cluster_template value
429 if cluster.flavor_id == wtypes.Unset or not cluster.flavor_id:
430 cluster.flavor_id = cluster_template.flavor_id
431
424 cluster_dict = cluster.as_dict() 432 cluster_dict = cluster.as_dict()
425 433
426 attr_validator.validate_os_resources(context, 434 attr_validator.validate_os_resources(context,
diff --git a/magnum/db/sqlalchemy/alembic/versions/041d9a0f1159_add_flavor_id_to_cluster.py b/magnum/db/sqlalchemy/alembic/versions/041d9a0f1159_add_flavor_id_to_cluster.py
new file mode 100644
index 0000000..478671c
--- /dev/null
+++ b/magnum/db/sqlalchemy/alembic/versions/041d9a0f1159_add_flavor_id_to_cluster.py
@@ -0,0 +1,30 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12"""add flavor_id to cluster
13
14Revision ID: 041d9a0f1159
15Revises: 04c625aa95ba
16Create Date: 2017-07-31 12:46:00.777841
17
18"""
19
20# revision identifiers, used by Alembic.
21revision = '041d9a0f1159'
22down_revision = '04c625aa95ba'
23
24from alembic import op
25import sqlalchemy as sa
26
27
28def upgrade():
29 op.add_column('cluster', sa.Column('flavor_id',
30 sa.String(length=255), nullable=True))
diff --git a/magnum/db/sqlalchemy/models.py b/magnum/db/sqlalchemy/models.py
index 986b771..1cb017f 100644
--- a/magnum/db/sqlalchemy/models.py
+++ b/magnum/db/sqlalchemy/models.py
@@ -118,6 +118,7 @@ class Cluster(Base):
118 docker_volume_size = Column(Integer()) 118 docker_volume_size = Column(Integer())
119 labels = Column(JSONEncodedDict) 119 labels = Column(JSONEncodedDict)
120 master_flavor_id = Column(String(255)) 120 master_flavor_id = Column(String(255))
121 flavor_id = Column(String(255))
121 stack_id = Column(String(255)) 122 stack_id = Column(String(255))
122 api_address = Column(String(255)) 123 api_address = Column(String(255))
123 node_addresses = Column(JSONEncodedList) 124 node_addresses = Column(JSONEncodedList)
diff --git a/magnum/drivers/heat/k8s_template_def.py b/magnum/drivers/heat/k8s_template_def.py
index 8eaafbf..00912ef 100644
--- a/magnum/drivers/heat/k8s_template_def.py
+++ b/magnum/drivers/heat/k8s_template_def.py
@@ -54,7 +54,7 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
54 self.add_parameter('master_flavor', 54 self.add_parameter('master_flavor',
55 cluster_attr='master_flavor_id') 55 cluster_attr='master_flavor_id')
56 self.add_parameter('minion_flavor', 56 self.add_parameter('minion_flavor',
57 cluster_template_attr='flavor_id') 57 cluster_attr='flavor_id')
58 self.add_parameter('number_of_minions', 58 self.add_parameter('number_of_minions',
59 cluster_attr='node_count') 59 cluster_attr='node_count')
60 self.add_parameter('external_network', 60 self.add_parameter('external_network',
diff --git a/magnum/drivers/heat/swarm_fedora_template_def.py b/magnum/drivers/heat/swarm_fedora_template_def.py
index b5904da..a97af38 100644
--- a/magnum/drivers/heat/swarm_fedora_template_def.py
+++ b/magnum/drivers/heat/swarm_fedora_template_def.py
@@ -50,7 +50,7 @@ class SwarmFedoraTemplateDefinition(template_def.BaseTemplateDefinition):
50 self.add_parameter('master_flavor', 50 self.add_parameter('master_flavor',
51 cluster_attr='master_flavor_id') 51 cluster_attr='master_flavor_id')
52 self.add_parameter('node_flavor', 52 self.add_parameter('node_flavor',
53 cluster_template_attr='flavor_id') 53 cluster_attr='flavor_id')
54 self.add_parameter('docker_volume_size', 54 self.add_parameter('docker_volume_size',
55 cluster_attr='docker_volume_size') 55 cluster_attr='docker_volume_size')
56 self.add_parameter('volume_driver', 56 self.add_parameter('volume_driver',
diff --git a/magnum/drivers/heat/swarm_mode_template_def.py b/magnum/drivers/heat/swarm_mode_template_def.py
index 23d8683..33c6320 100644
--- a/magnum/drivers/heat/swarm_mode_template_def.py
+++ b/magnum/drivers/heat/swarm_mode_template_def.py
@@ -63,7 +63,7 @@ class SwarmModeTemplateDefinition(template_def.BaseTemplateDefinition):
63 self.add_parameter('master_flavor', 63 self.add_parameter('master_flavor',
64 cluster_attr='master_flavor_id') 64 cluster_attr='master_flavor_id')
65 self.add_parameter('node_flavor', 65 self.add_parameter('node_flavor',
66 cluster_template_attr='flavor_id') 66 cluster_attr='flavor_id')
67 self.add_parameter('docker_volume_size', 67 self.add_parameter('docker_volume_size',
68 cluster_attr='docker_volume_size') 68 cluster_attr='docker_volume_size')
69 self.add_parameter('volume_driver', 69 self.add_parameter('volume_driver',
diff --git a/magnum/drivers/mesos_ubuntu_v1/template_def.py b/magnum/drivers/mesos_ubuntu_v1/template_def.py
index 318f259..5c29231 100644
--- a/magnum/drivers/mesos_ubuntu_v1/template_def.py
+++ b/magnum/drivers/mesos_ubuntu_v1/template_def.py
@@ -33,7 +33,7 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
33 self.add_parameter('master_flavor', 33 self.add_parameter('master_flavor',
34 cluster_attr='master_flavor_id') 34 cluster_attr='master_flavor_id')
35 self.add_parameter('slave_flavor', 35 self.add_parameter('slave_flavor',
36 cluster_template_attr='flavor_id') 36 cluster_attr='flavor_id')
37 self.add_parameter('cluster_name', 37 self.add_parameter('cluster_name',
38 cluster_attr='name') 38 cluster_attr='name')
39 self.add_parameter('volume_driver', 39 self.add_parameter('volume_driver',
diff --git a/magnum/objects/cluster.py b/magnum/objects/cluster.py
index 07facc9..01f704d 100644
--- a/magnum/objects/cluster.py
+++ b/magnum/objects/cluster.py
@@ -45,8 +45,9 @@ class Cluster(base.MagnumPersistentObject, base.MagnumObject,
45 # Version 1.14: Added 'docker_volume_size' field 45 # Version 1.14: Added 'docker_volume_size' field
46 # Version 1.15: Added 'labels' field 46 # Version 1.15: Added 'labels' field
47 # Version 1.16: Added 'master_flavor_id' field 47 # Version 1.16: Added 'master_flavor_id' field
48 # Version 1.17: Added 'flavor_id' field
48 49
49 VERSION = '1.16' 50 VERSION = '1.17'
50 51
51 dbapi = dbapi.get_instance() 52 dbapi = dbapi.get_instance()
52 53
@@ -61,6 +62,7 @@ class Cluster(base.MagnumPersistentObject, base.MagnumObject,
61 'docker_volume_size': fields.IntegerField(nullable=True), 62 'docker_volume_size': fields.IntegerField(nullable=True),
62 'labels': fields.DictOfStringsField(nullable=True), 63 'labels': fields.DictOfStringsField(nullable=True),
63 'master_flavor_id': fields.StringField(nullable=True), 64 'master_flavor_id': fields.StringField(nullable=True),
65 'flavor_id': fields.StringField(nullable=True),
64 'stack_id': fields.StringField(nullable=True), 66 'stack_id': fields.StringField(nullable=True),
65 'status': m_fields.ClusterStatusField(nullable=True), 67 'status': m_fields.ClusterStatusField(nullable=True),
66 'status_reason': fields.StringField(nullable=True), 68 'status_reason': fields.StringField(nullable=True),
diff --git a/magnum/tests/unit/api/controllers/v1/test_cluster.py b/magnum/tests/unit/api/controllers/v1/test_cluster.py
index bec0b9e..fb015a6 100644
--- a/magnum/tests/unit/api/controllers/v1/test_cluster.py
+++ b/magnum/tests/unit/api/controllers/v1/test_cluster.py
@@ -856,6 +856,24 @@ class TestPost(api_base.FunctionalTest):
856 # Verify master_flavor_id from ClusterTemplate is used 856 # Verify master_flavor_id from ClusterTemplate is used
857 self.assertEqual('m1.small', cluster[0].master_flavor_id) 857 self.assertEqual('m1.small', cluster[0].master_flavor_id)
858 858
859 def test_create_cluster_with_flavor_id(self):
860 bdict = apiutils.cluster_post_data()
861 bdict['flavor_id'] = 'm2.small'
862 response = self.post_json('/clusters', bdict)
863 self.assertEqual('application/json', response.content_type)
864 self.assertEqual(202, response.status_int)
865 cluster, timeout = self.mock_cluster_create.call_args
866 self.assertEqual('m2.small', cluster[0].flavor_id)
867
868 def test_create_cluster_without_flavor_id(self):
869 bdict = apiutils.cluster_post_data()
870 response = self.post_json('/clusters', bdict)
871 self.assertEqual('application/json', response.content_type)
872 self.assertEqual(202, response.status_int)
873 cluster, timeout = self.mock_cluster_create.call_args
874 # Verify flavor_id from ClusterTemplate is used
875 self.assertEqual('m1.small', cluster[0].flavor_id)
876
859 877
860class TestDelete(api_base.FunctionalTest): 878class TestDelete(api_base.FunctionalTest):
861 def setUp(self): 879 def setUp(self):
diff --git a/magnum/tests/unit/api/test_attr_validator.py b/magnum/tests/unit/api/test_attr_validator.py
index d680268..9b62a6d 100644
--- a/magnum/tests/unit/api/test_attr_validator.py
+++ b/magnum/tests/unit/api/test_attr_validator.py
@@ -315,11 +315,18 @@ class TestAttrValidator(base.BaseTestCase):
315 @mock.patch('magnum.common.clients.OpenStackClients') 315 @mock.patch('magnum.common.clients.OpenStackClients')
316 def test_validate_os_resources_with_cluster(self, mock_os_cli): 316 def test_validate_os_resources_with_cluster(self, mock_os_cli):
317 mock_cluster_template = {} 317 mock_cluster_template = {}
318 mock_cluster = {'keypair': 'test-keypair'} 318 mock_cluster = {
319 'keypair': 'test-keypair', 'labels': {'lab1': 'val1'},
320 'image_id': 'e33f0988-1730-405e-8401-30cbc8535302'
321 }
319 mock_keypair = mock.MagicMock() 322 mock_keypair = mock.MagicMock()
320 mock_keypair.id = 'test-keypair' 323 mock_keypair.id = 'test-keypair'
324 mock_image = {'name': 'fedora-21-atomic-5',
325 'id': 'e33f0988-1730-405e-8401-30cbc8535302',
326 'os_distro': 'fedora-atomic'}
321 mock_nova = mock.MagicMock() 327 mock_nova = mock.MagicMock()
322 mock_nova.keypairs.get.return_value = mock_keypair 328 mock_nova.keypairs.get.return_value = mock_keypair
329 mock_nova.images.get.return_value = mock_image
323 mock_os_cli = mock.MagicMock() 330 mock_os_cli = mock.MagicMock()
324 mock_os_cli.nova.return_value = mock_nova 331 mock_os_cli.nova.return_value = mock_nova
325 mock_context = mock.MagicMock() 332 mock_context = mock.MagicMock()
diff --git a/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py b/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py
index 6cf4947..c18786b 100644
--- a/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py
+++ b/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py
@@ -77,6 +77,7 @@ class TestClusterConductorWithK8s(base.TestCase):
77 'master_count': 1, 77 'master_count': 1,
78 'discovery_url': 'https://discovery.etcd.io/test', 78 'discovery_url': 'https://discovery.etcd.io/test',
79 'docker_volume_size': 20, 79 'docker_volume_size': 20,
80 'flavor_id': 'flavor_id',
80 'master_addresses': ['172.17.2.18'], 81 'master_addresses': ['172.17.2.18'],
81 'ca_cert_ref': 'http://barbican/v1/containers/xx-xx-xx-xx', 82 'ca_cert_ref': 'http://barbican/v1/containers/xx-xx-xx-xx',
82 'magnum_cert_ref': 'http://barbican/v1/containers/xx-xx-xx-xx', 83 'magnum_cert_ref': 'http://barbican/v1/containers/xx-xx-xx-xx',
@@ -96,6 +97,7 @@ class TestClusterConductorWithK8s(base.TestCase):
96 'kube_dashboard_enabled': 'True', 97 'kube_dashboard_enabled': 'True',
97 'docker_volume_type': 'lvmdriver-1'}, 98 'docker_volume_type': 'lvmdriver-1'},
98 'master_flavor_id': 'master_flavor_id', 99 'master_flavor_id': 'master_flavor_id',
100 'flavor_id': 'flavor_id',
99 } 101 }
100 self.context.user_name = 'fake_user' 102 self.context.user_name = 'fake_user'
101 self.context.tenant = 'fake_tenant' 103 self.context.tenant = 'fake_tenant'
@@ -374,6 +376,7 @@ class TestClusterConductorWithK8s(base.TestCase):
374 'discovery_url': 'https://discovery.etcd.io/test', 376 'discovery_url': 'https://discovery.etcd.io/test',
375 'docker_volume_size': 20, 377 'docker_volume_size': 20,
376 'master_flavor': 'master_flavor_id', 378 'master_flavor': 'master_flavor_id',
379 'minion_flavor': 'flavor_id',
377 'external_network': 'external_network_id', 380 'external_network': 'external_network_id',
378 'flannel_backend': 'vxlan', 381 'flannel_backend': 'vxlan',
379 'flannel_network_cidr': '10.101.0.0/16', 382 'flannel_network_cidr': '10.101.0.0/16',
@@ -592,21 +595,6 @@ class TestClusterConductorWithK8s(base.TestCase):
592 @patch('requests.get') 595 @patch('requests.get')
593 @patch('magnum.objects.ClusterTemplate.get_by_uuid') 596 @patch('magnum.objects.ClusterTemplate.get_by_uuid')
594 @patch('magnum.drivers.common.driver.Driver.get_driver') 597 @patch('magnum.drivers.common.driver.Driver.get_driver')
595 def test_extract_template_definition_without_minion_flavor(
596 self,
597 mock_driver,
598 mock_objects_cluster_template_get_by_uuid,
599 mock_get):
600 mock_driver.return_value = k8s_dr.Driver()
601 self._test_extract_template_definition(
602 mock_driver,
603 mock_objects_cluster_template_get_by_uuid,
604 mock_get,
605 missing_attr='flavor_id')
606
607 @patch('requests.get')
608 @patch('magnum.objects.ClusterTemplate.get_by_uuid')
609 @patch('magnum.drivers.common.driver.Driver.get_driver')
610 def test_extract_template_definition_without_docker_storage_driver( 598 def test_extract_template_definition_without_docker_storage_driver(
611 self, 599 self,
612 mock_driver, 600 mock_driver,
diff --git a/magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py b/magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py
index ed6edcb..19d04aa 100644
--- a/magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py
+++ b/magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py
@@ -57,6 +57,7 @@ class TestClusterConductorWithMesos(base.TestCase):
57 'cluster_template_id': 'xx-xx-xx-xx', 57 'cluster_template_id': 'xx-xx-xx-xx',
58 'keypair': 'keypair_id', 58 'keypair': 'keypair_id',
59 'master_flavor_id': 'master_flavor_id', 59 'master_flavor_id': 'master_flavor_id',
60 'flavor_id': 'flavor_id',
60 'name': 'cluster1', 61 'name': 'cluster1',
61 'stack_id': 'xx-xx-xx-xx', 62 'stack_id': 'xx-xx-xx-xx',
62 'api_address': '172.17.2.3', 63 'api_address': '172.17.2.3',
@@ -194,6 +195,7 @@ class TestClusterConductorWithMesos(base.TestCase):
194 'mesos_slave_image_providers': 'docker', 195 'mesos_slave_image_providers': 'docker',
195 'master_flavor': 'master_flavor_id', 196 'master_flavor': 'master_flavor_id',
196 'verify_ca': True, 197 'verify_ca': True,
198 'slave_flavor': 'flavor_id',
197 } 199 }
198 self.assertEqual(expected, definition) 200 self.assertEqual(expected, definition)
199 self.assertEqual( 201 self.assertEqual(
diff --git a/magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py b/magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py
index 315c1bd..847ce4f 100644
--- a/magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py
+++ b/magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py
@@ -62,6 +62,7 @@ class TestClusterConductorWithSwarm(base.TestCase):
62 'uuid': '5d12f6fd-a196-4bf0-ae4c-1f639a523a52', 62 'uuid': '5d12f6fd-a196-4bf0-ae4c-1f639a523a52',
63 'cluster_template_id': 'xx-xx-xx-xx', 63 'cluster_template_id': 'xx-xx-xx-xx',
64 'keypair': 'keypair_id', 64 'keypair': 'keypair_id',
65 'flavor_id': 'flavor_id',
65 'docker_volume_size': 20, 66 'docker_volume_size': 20,
66 'master_flavor_id': 'master_flavor_id', 67 'master_flavor_id': 'master_flavor_id',
67 'name': 'cluster1', 68 'name': 'cluster1',
@@ -309,6 +310,7 @@ class TestClusterConductorWithSwarm(base.TestCase):
309 'docker_volume_size': 20, 310 'docker_volume_size': 20,
310 'master_flavor': 'master_flavor_id', 311 'master_flavor': 'master_flavor_id',
311 'verify_ca': True, 312 'verify_ca': True,
313 'node_flavor': 'flavor_id',
312 } 314 }
313 self.assertEqual(expected, definition) 315 self.assertEqual(expected, definition)
314 self.assertEqual( 316 self.assertEqual(
diff --git a/magnum/tests/unit/db/utils.py b/magnum/tests/unit/db/utils.py
index db1e85d..bac51b1 100644
--- a/magnum/tests/unit/db/utils.py
+++ b/magnum/tests/unit/db/utils.py
@@ -99,6 +99,7 @@ def get_test_cluster(**kw):
99 'docker_volume_size': kw.get('docker_volume_size'), 99 'docker_volume_size': kw.get('docker_volume_size'),
100 'labels': kw.get('labels'), 100 'labels': kw.get('labels'),
101 'master_flavor_id': kw.get('master_flavor_id', None), 101 'master_flavor_id': kw.get('master_flavor_id', None),
102 'flavor_id': kw.get('flavor_id', None),
102 } 103 }
103 104
104 # Only add Keystone trusts related attributes on demand since they may 105 # Only add Keystone trusts related attributes on demand since they may
diff --git a/magnum/tests/unit/objects/test_objects.py b/magnum/tests/unit/objects/test_objects.py
index 16d1f5c..a27a3ac 100644
--- a/magnum/tests/unit/objects/test_objects.py
+++ b/magnum/tests/unit/objects/test_objects.py
@@ -355,7 +355,7 @@ class TestObject(test_base.TestCase, _TestObject):
355# For more information on object version testing, read 355# For more information on object version testing, read
356# http://docs.openstack.org/developer/magnum/objects.html 356# http://docs.openstack.org/developer/magnum/objects.html
357object_data = { 357object_data = {
358 'Cluster': '1.16-7a544c5059697c464810470980f81ba1', 358 'Cluster': '1.17-c32c07425ab0042c7370bef2902b4d21',
359 'ClusterTemplate': '1.18-7fa94f4fdd027acfb4f022f202afdfb5', 359 'ClusterTemplate': '1.18-7fa94f4fdd027acfb4f022f202afdfb5',
360 'Certificate': '1.1-1924dc077daa844f0f9076332ef96815', 360 'Certificate': '1.1-1924dc077daa844f0f9076332ef96815',
361 'MyObj': '1.0-34c4b1aadefd177b13f9a2f894cc23cd', 361 'MyObj': '1.0-34c4b1aadefd177b13f9a2f894cc23cd',