Browse Source

OSC: Add --flavor to coe cluster create

Add a flavor override parameter on osc cluster create to override
the value present on the cluster template.

Partial-Bug: #1699245
Depends-On: Ib60c05cce1cf2639ca4740abdd264403033433f9
Change-Id: Ib00514b66ee2d0a2ee4ddafb5b8c2ff8fa82de77
tags/2.8.0
Ricardo Rocha 1 year ago
parent
commit
dd0958860d

+ 7
- 0
magnumclient/osc/v1/clusters.py View File

@@ -44,6 +44,7 @@ CLUSTER_ATTRIBUTES = [
44 44
     'container_version',
45 45
     'name',
46 46
     'master_flavor_id',
47
+    'flavor_id',
47 48
 ]
48 49
 
49 50
 
@@ -108,6 +109,11 @@ class CreateCluster(command.Command):
108 109
             metavar='<master-flavor>',
109 110
             help=_('The nova flavor name or UUID to use when launching the '
110 111
                    'master node of the Cluster.'))
112
+        parser.add_argument(
113
+            '--flavor',
114
+            metavar='<flavor>',
115
+            help=_('The nova flavor name or UUID to use when launching the '
116
+                   'Cluster.'))
111 117
 
112 118
         return parser
113 119
 
@@ -125,6 +131,7 @@ class CreateCluster(command.Command):
125 131
             'name': parsed_args.name,
126 132
             'node_count': parsed_args.node_count,
127 133
             'master_flavor_id': parsed_args.master_flavor,
134
+            'flavor_id': parsed_args.flavor,
128 135
         }
129 136
 
130 137
         if parsed_args.labels is not None:

+ 1
- 0
magnumclient/tests/osc/unit/v1/fakes.py View File

@@ -203,6 +203,7 @@ class FakeCluster(object):
203 203
             'container_version': None,
204 204
             'name': 'fake-cluster',
205 205
             'master_flavor_id': None,
206
+            'flavor_id': 'm1.medium',
206 207
         }
207 208
 
208 209
         # Overwrite default attributes.

+ 1
- 0
magnumclient/tests/osc/unit/v1/test_clusters.py View File

@@ -44,6 +44,7 @@ class TestClusterCreate(TestCluster):
44 44
             'discovery_url': None,
45 45
             'docker_volume_size': None,
46 46
             'labels': {},
47
+            'flavor_id': None,
47 48
             'keypair': None,
48 49
             'master_count': 1,
49 50
             'name': 'fake-cluster-1',

+ 1
- 0
magnumclient/v1/clusters.py View File

@@ -22,6 +22,7 @@ CREATION_ATTRIBUTES.append('keypair')
22 22
 CREATION_ATTRIBUTES.append('docker_volume_size')
23 23
 CREATION_ATTRIBUTES.append('labels')
24 24
 CREATION_ATTRIBUTES.append('master_flavor_id')
25
+CREATION_ATTRIBUTES.append('flavor_id')
25 26
 
26 27
 
27 28
 class Cluster(baseunit.BaseTemplate):

Loading…
Cancel
Save