Merge "Rename aws flavor-name to instance-type"

This commit is contained in:
Zuul 2019-02-11 18:28:48 +00:00 committed by Gerrit Code Review
commit 9c7843d28a
5 changed files with 14 additions and 14 deletions

View File

@ -1347,11 +1347,11 @@ section of the configuration.
labels: labels:
- name: debian9 - name: debian9
cloud-image: debian9 cloud-image: debian9
flavor-name: t3.medium instance-type: t3.medium
key-name: zuul key-name: zuul
- name: debian9-large - name: debian9-large
cloud-image: debian9 cloud-image: debian9
flavor-name: t3.large instance-type: t3.large
key-name: zuul key-name: zuul
.. attr:: name .. attr:: name
@ -1484,7 +1484,7 @@ section of the configuration.
labels: labels:
- name: bionic - name: bionic
flavor-name: m5a.large instance-type: m5a.large
console-log: True console-log: True
Each entry is a dictionary with the following keys Each entry is a dictionary with the following keys
@ -1505,7 +1505,7 @@ section of the configuration.
configured entry from the ``cloud-images`` section of the configured entry from the ``cloud-images`` section of the
provider. See :attr:`providers.[aws].cloud-images`. provider. See :attr:`providers.[aws].cloud-images`.
.. attr:: flavor-name .. attr:: instance-type
:type: str :type: str
:required: :required:

View File

@ -51,7 +51,7 @@ class ProviderLabel(ConfigValue):
def __init__(self): def __init__(self):
self.name = None self.name = None
self.cloud_image = None self.cloud_image = None
self.flavor_name = None self.instance_type = None
self.key_name = None self.key_name = None
self.volume_size = None self.volume_size = None
self.volume_type = None self.volume_type = None
@ -64,7 +64,7 @@ class ProviderLabel(ConfigValue):
# since this causes recursive checks with ProviderPool. # since this causes recursive checks with ProviderPool.
return (other.name == self.name return (other.name == self.name
and other.cloud_image == self.cloud_image and other.cloud_image == self.cloud_image
and other.flavor_name == self.flavor_name and other.instance_type == self.instance_type
and other.key_name == self.key_name and other.key_name == self.key_name
and other.volume_size == self.volume_size and other.volume_size == self.volume_size
and other.volume_type == self.volume_type) and other.volume_type == self.volume_type)
@ -116,7 +116,7 @@ class ProviderPool(ConfigPool):
else: else:
cloud_image = None cloud_image = None
pl.cloud_image = cloud_image pl.cloud_image = cloud_image
pl.flavor_name = label['flavor-name'] pl.instance_type = label['instance-type']
pl.key_name = label['key-name'] pl.key_name = label['key-name']
pl.volume_type = label.get('volume-type') pl.volume_type = label.get('volume-type')
pl.volume_size = label.get('volume-size') pl.volume_size = label.get('volume-size')
@ -204,7 +204,7 @@ class AwsProviderConfig(ProviderConfig):
pool_label = { pool_label = {
v.Required('name'): str, v.Required('name'): str,
v.Exclusive('cloud-image', 'label-image'): str, v.Exclusive('cloud-image', 'label-image'): str,
v.Required('flavor-name'): str, v.Required('instance-type'): str,
v.Required('key-name'): str, v.Required('key-name'): str,
'volume-type': str, 'volume-type': str,
'volume-size': int 'volume-size': int

View File

@ -107,13 +107,13 @@ class AwsProvider(Provider):
return True return True
def createInstance(self, label): def createInstance(self, label):
image_name = label.cloud_image.external_name image_id = label.cloud_image.external_name
args = dict( args = dict(
ImageId=image_name, ImageId=image_id,
MinCount=1, MinCount=1,
MaxCount=1, MaxCount=1,
KeyName=label.key_name, KeyName=label.key_name,
InstanceType=label.flavor_name, InstanceType=label.instance_type,
NetworkInterfaces=[{ NetworkInterfaces=[{
'AssociatePublicIpAddress': True, 'AssociatePublicIpAddress': True,
'DeviceIndex': 0}]) 'DeviceIndex': 0}])
@ -129,7 +129,7 @@ class AwsProvider(Provider):
# We might need to supply our own mapping before lauching the instance. # We might need to supply our own mapping before lauching the instance.
# We basically want to make sure DeleteOnTermination is true and be # We basically want to make sure DeleteOnTermination is true and be
# able to set the volume type and size. # able to set the volume type and size.
image = self.getImage(image_name) image = self.getImage(image_id)
# TODO: Flavors can also influence whether or not the VM spawns with a # TODO: Flavors can also influence whether or not the VM spawns with a
# volume -- we basically need to ensure DeleteOnTermination is true # volume -- we basically need to ensure DeleteOnTermination is true
if hasattr(image, 'block_device_mappings'): if hasattr(image, 'block_device_mappings'):

View File

@ -22,5 +22,5 @@ providers:
labels: labels:
- name: ubuntu1404 - name: ubuntu1404
cloud-image: ubuntu1404 cloud-image: ubuntu1404
flavor-name: t3.medium instance-type: t3.medium
key-name: zuul key-name: zuul

View File

@ -155,7 +155,7 @@ providers:
labels: labels:
- name: centos-ami - name: centos-ami
cloud-image: centos-ami cloud-image: centos-ami
flavor-name: t2.micro instance-type: t2.micro
key-name: zuul key-name: zuul
volume-type: gp2 volume-type: gp2
volume-size: 80 volume-size: 80