summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2019-02-06 13:14:35 +0000
committerMonty Taylor <mordred@inaugust.com>2019-02-06 17:09:36 +0000
commit516e8cd176a2aeb70a17404585a808287602204f (patch)
tree2b8d1ed81ca5a4e69d2a5fdedcfd20b6f604a663
parent6a4a8f80db8b61293ba8b5c5ed405319321a91a3 (diff)
Rename aws flavor-name to instance-type
The AWS term is instance-type, not flavor-name. Rename this while we don't have a huge userbase. While we're in there, rename a variable from image_name to image_id since we use image_id everywhere else. Change-Id: I1f7f16d2873982626d2434cf5ca1f6280adf739c
Notes
Notes (review): Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Code-Review+2: David Shrewsbury <dshrewsb@redhat.com> Workflow+1: David Shrewsbury <dshrewsb@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 11 Feb 2019 18:28:48 +0000 Reviewed-on: https://review.openstack.org/635153 Project: openstack-infra/nodepool Branch: refs/heads/master
-rw-r--r--doc/source/configuration.rst8
-rw-r--r--nodepool/driver/aws/config.py8
-rw-r--r--nodepool/driver/aws/provider.py8
-rw-r--r--nodepool/tests/fixtures/aws.yaml2
-rw-r--r--nodepool/tests/fixtures/config_validate/good.yaml2
5 files changed, 14 insertions, 14 deletions
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 09f7554..e4ab60b 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -1347,11 +1347,11 @@ section of the configuration.
1347 labels: 1347 labels:
1348 - name: debian9 1348 - name: debian9
1349 cloud-image: debian9 1349 cloud-image: debian9
1350 flavor-name: t3.medium 1350 instance-type: t3.medium
1351 key-name: zuul 1351 key-name: zuul
1352 - name: debian9-large 1352 - name: debian9-large
1353 cloud-image: debian9 1353 cloud-image: debian9
1354 flavor-name: t3.large 1354 instance-type: t3.large
1355 key-name: zuul 1355 key-name: zuul
1356 1356
1357 .. attr:: name 1357 .. attr:: name
@@ -1484,7 +1484,7 @@ section of the configuration.
1484 1484
1485 labels: 1485 labels:
1486 - name: bionic 1486 - name: bionic
1487 flavor-name: m5a.large 1487 instance-type: m5a.large
1488 console-log: True 1488 console-log: True
1489 1489
1490 Each entry is a dictionary with the following keys 1490 Each entry is a dictionary with the following keys
@@ -1505,7 +1505,7 @@ section of the configuration.
1505 configured entry from the ``cloud-images`` section of the 1505 configured entry from the ``cloud-images`` section of the
1506 provider. See :attr:`providers.[aws].cloud-images`. 1506 provider. See :attr:`providers.[aws].cloud-images`.
1507 1507
1508 .. attr:: flavor-name 1508 .. attr:: instance-type
1509 :type: str 1509 :type: str
1510 :required: 1510 :required:
1511 1511
diff --git a/nodepool/driver/aws/config.py b/nodepool/driver/aws/config.py
index 17a64e6..f3708fe 100644
--- a/nodepool/driver/aws/config.py
+++ b/nodepool/driver/aws/config.py
@@ -51,7 +51,7 @@ class ProviderLabel(ConfigValue):
51 def __init__(self): 51 def __init__(self):
52 self.name = None 52 self.name = None
53 self.cloud_image = None 53 self.cloud_image = None
54 self.flavor_name = None 54 self.instance_type = None
55 self.key_name = None 55 self.key_name = None
56 self.volume_size = None 56 self.volume_size = None
57 self.volume_type = None 57 self.volume_type = None
@@ -64,7 +64,7 @@ class ProviderLabel(ConfigValue):
64 # since this causes recursive checks with ProviderPool. 64 # since this causes recursive checks with ProviderPool.
65 return (other.name == self.name 65 return (other.name == self.name
66 and other.cloud_image == self.cloud_image 66 and other.cloud_image == self.cloud_image
67 and other.flavor_name == self.flavor_name 67 and other.instance_type == self.instance_type
68 and other.key_name == self.key_name 68 and other.key_name == self.key_name
69 and other.volume_size == self.volume_size 69 and other.volume_size == self.volume_size
70 and other.volume_type == self.volume_type) 70 and other.volume_type == self.volume_type)
@@ -116,7 +116,7 @@ class ProviderPool(ConfigPool):
116 else: 116 else:
117 cloud_image = None 117 cloud_image = None
118 pl.cloud_image = cloud_image 118 pl.cloud_image = cloud_image
119 pl.flavor_name = label['flavor-name'] 119 pl.instance_type = label['instance-type']
120 pl.key_name = label['key-name'] 120 pl.key_name = label['key-name']
121 pl.volume_type = label.get('volume-type') 121 pl.volume_type = label.get('volume-type')
122 pl.volume_size = label.get('volume-size') 122 pl.volume_size = label.get('volume-size')
@@ -204,7 +204,7 @@ class AwsProviderConfig(ProviderConfig):
204 pool_label = { 204 pool_label = {
205 v.Required('name'): str, 205 v.Required('name'): str,
206 v.Exclusive('cloud-image', 'label-image'): str, 206 v.Exclusive('cloud-image', 'label-image'): str,
207 v.Required('flavor-name'): str, 207 v.Required('instance-type'): str,
208 v.Required('key-name'): str, 208 v.Required('key-name'): str,
209 'volume-type': str, 209 'volume-type': str,
210 'volume-size': int 210 'volume-size': int
diff --git a/nodepool/driver/aws/provider.py b/nodepool/driver/aws/provider.py
index 941508c..e252026 100644
--- a/nodepool/driver/aws/provider.py
+++ b/nodepool/driver/aws/provider.py
@@ -107,13 +107,13 @@ class AwsProvider(Provider):
107 return True 107 return True
108 108
109 def createInstance(self, label): 109 def createInstance(self, label):
110 image_name = label.cloud_image.external_name 110 image_id = label.cloud_image.external_name
111 args = dict( 111 args = dict(
112 ImageId=image_name, 112 ImageId=image_id,
113 MinCount=1, 113 MinCount=1,
114 MaxCount=1, 114 MaxCount=1,
115 KeyName=label.key_name, 115 KeyName=label.key_name,
116 InstanceType=label.flavor_name, 116 InstanceType=label.instance_type,
117 NetworkInterfaces=[{ 117 NetworkInterfaces=[{
118 'AssociatePublicIpAddress': True, 118 'AssociatePublicIpAddress': True,
119 'DeviceIndex': 0}]) 119 'DeviceIndex': 0}])
@@ -129,7 +129,7 @@ class AwsProvider(Provider):
129 # We might need to supply our own mapping before lauching the instance. 129 # We might need to supply our own mapping before lauching the instance.
130 # We basically want to make sure DeleteOnTermination is true and be 130 # We basically want to make sure DeleteOnTermination is true and be
131 # able to set the volume type and size. 131 # able to set the volume type and size.
132 image = self.getImage(image_name) 132 image = self.getImage(image_id)
133 # TODO: Flavors can also influence whether or not the VM spawns with a 133 # TODO: Flavors can also influence whether or not the VM spawns with a
134 # volume -- we basically need to ensure DeleteOnTermination is true 134 # volume -- we basically need to ensure DeleteOnTermination is true
135 if hasattr(image, 'block_device_mappings'): 135 if hasattr(image, 'block_device_mappings'):
diff --git a/nodepool/tests/fixtures/aws.yaml b/nodepool/tests/fixtures/aws.yaml
index 7a5fc7a..275056c 100644
--- a/nodepool/tests/fixtures/aws.yaml
+++ b/nodepool/tests/fixtures/aws.yaml
@@ -22,5 +22,5 @@ providers:
22 labels: 22 labels:
23 - name: ubuntu1404 23 - name: ubuntu1404
24 cloud-image: ubuntu1404 24 cloud-image: ubuntu1404
25 flavor-name: t3.medium 25 instance-type: t3.medium
26 key-name: zuul 26 key-name: zuul
diff --git a/nodepool/tests/fixtures/config_validate/good.yaml b/nodepool/tests/fixtures/config_validate/good.yaml
index 2dcbbfd..3d1fb53 100644
--- a/nodepool/tests/fixtures/config_validate/good.yaml
+++ b/nodepool/tests/fixtures/config_validate/good.yaml
@@ -155,7 +155,7 @@ providers:
155 labels: 155 labels:
156 - name: centos-ami 156 - name: centos-ami
157 cloud-image: centos-ami 157 cloud-image: centos-ami
158 flavor-name: t2.micro 158 instance-type: t2.micro
159 key-name: zuul 159 key-name: zuul
160 volume-type: gp2 160 volume-type: gp2
161 volume-size: 80 161 volume-size: 80