Merge "Add image-id and image-name options to cloud-images" into feature/zuulv3
This commit is contained in:
commit
f8e36df373
|
@ -467,12 +467,27 @@ Example configuration::
|
|||
|
||||
``name``
|
||||
Identifier to refer this cloud-image from :ref:`labels` section.
|
||||
Since this name appears elsewhere in the nodepool configuration
|
||||
file, you may want to use your own descriptive name here and use
|
||||
one of ``image-id`` or ``image-name`` to specify the cloud image
|
||||
so that if the image name or id changes on the cloud, the impact
|
||||
to your Nodepool configuration will be minimal. However, if
|
||||
neither of those attributes are provided, this is also assumed to
|
||||
be the image name or ID in the cloud.
|
||||
|
||||
**optional**
|
||||
|
||||
``config-drive`` (boolean)
|
||||
Whether config drive should be used for the cloud image. Default ``True``
|
||||
|
||||
``image-id`` (str)
|
||||
If this is provided, it is used to select the image from the cloud
|
||||
provider by ID, rather than name. Mutually exclusive with ``image-name``.
|
||||
|
||||
``image-name`` (str)
|
||||
If this is provided, it is used to select the image from the cloud
|
||||
provider by this name or ID. Mutually exclusive with ``image-id``.
|
||||
|
||||
|
||||
.. _pool_labels:
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ class ConfigValidator:
|
|||
provider_cloud_images = {
|
||||
'name': str,
|
||||
'config-drive': bool,
|
||||
v.Exclusive('image-id', 'cloud-image-name-or-id'): str,
|
||||
v.Exclusive('image-name', 'cloud-image-name-or-id'): str,
|
||||
}
|
||||
|
||||
provider = {
|
||||
|
|
|
@ -250,6 +250,8 @@ def loadConfig(config_path):
|
|||
i = ProviderCloudImage()
|
||||
i.name = image['name']
|
||||
i.config_drive = image.get('config-drive', None)
|
||||
i.image_id = image.get('image-id', None)
|
||||
i.image_name = image.get('image-name', None)
|
||||
p.cloud_images[i.name] = i
|
||||
p.pools = {}
|
||||
for pool in provider.get('pools', []):
|
||||
|
|
|
@ -294,7 +294,12 @@ class NodeLauncher(threading.Thread, StatsReporter):
|
|||
# image_external is what we use for OpenStack.
|
||||
# image_id is what we record in the node for zk.
|
||||
# image_name is what we log, so matches the config.
|
||||
image_external = self._cloud_image.name
|
||||
if self._cloud_image.image_id:
|
||||
image_external = dict(id=self._cloud_image.image_id)
|
||||
elif self._cloud_image.image_name:
|
||||
image_external = self._cloud_image.image_name
|
||||
else:
|
||||
image_external = self._cloud_image.name
|
||||
image_id = self._cloud_image.name
|
||||
image_name = self._cloud_image.name
|
||||
|
||||
|
|
Loading…
Reference in New Issue