Merge "Add support for specifying key-name per label" into feature/zuulv3

This commit is contained in:
Jenkins 2017-04-28 18:30:21 +00:00 committed by Gerrit Code Review
commit 9ab53ff58c
4 changed files with 11 additions and 1 deletions

View File

@ -465,3 +465,9 @@ Example configuration::
Determine the flavor to use (e.g. ``m1.medium``, ``m1.large``,
etc). The smallest flavor that meets the ``min-ram`` requirements
will be chosen.
**optional**
``key-name``
If given, is the name of a keypair that will be used when booting each
server.

View File

@ -34,6 +34,7 @@ class ConfigValidator:
v.Required('diskimage'): str,
'min-ram': int,
'flavor-name': str,
'key-name': str,
}
pool_label = v.All(pool_label_main,

View File

@ -89,7 +89,8 @@ class ProviderLabel(ConfigValue):
def __eq__(self, other):
if (other.diskimage != self.diskimage or
other.min_ram != self.min_ram or
other.flavor_name != self.flavor_name):
other.flavor_name != self.flavor_name or
other.key_name != self.key_name):
return False
return True
@ -250,6 +251,7 @@ def loadConfig(config_path):
pl.diskimage = newconfig.diskimages[label['diskimage']]
pl.min_ram = label.get('min-ram', 0)
pl.flavor_name = label.get('flavor-name', None)
pl.key_name = label.get('key-name')
top_label = newconfig.labels[pl.name]
top_label.pools.append(pp)

View File

@ -280,6 +280,7 @@ class NodeLauncher(threading.Thread, StatsReporter):
image_id=cloud_image.external_id,
min_ram=self._label.min_ram,
flavor_name=self._label.flavor_name,
key_name=self._label.key_name,
az=self._node.az,
config_drive=self._diskimage.config_drive,
nodepool_node_id=self._node.id,