From 94dd7d90835137e420ca5e6ae6fbf1647fa73b0f Mon Sep 17 00:00:00 2001 From: Andrew Grimberg Date: Mon, 18 Oct 2021 16:51:39 -0700 Subject: [PATCH] Fix: Correct boot source options for OpenStack If a VOLUME_SIZE option is not defined in the base cloud configuration then the default OpenStack boot selection should be 'image' not 'volumeFromImage' otherwise we are unable to properly take advantage of all options provided by an OpenStack cloud. Change-Id: I76ae042d598c9f7fa1868d4ea6a3566f8c6b8115 Signed-off-by: Andrew Grimberg --- jenkins-admin/create_jenkins_clouds_openstack_yaml.py | 10 ++++++++-- .../notes/default_openstack_boot-76a655138ca488b9.yaml | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/default_openstack_boot-76a655138ca488b9.yaml diff --git a/jenkins-admin/create_jenkins_clouds_openstack_yaml.py b/jenkins-admin/create_jenkins_clouds_openstack_yaml.py index a1464a5d..d3424698 100755 --- a/jenkins-admin/create_jenkins_clouds_openstack_yaml.py +++ b/jenkins-admin/create_jenkins_clouds_openstack_yaml.py @@ -93,9 +93,10 @@ jenkins: slaveOptions: availabilityZone: {{ availability_zone }} bootSource: - volumeFromImage: + {{ image_type }}: name: {{ image_name }} - volumeSize: {{ volume_size }} +{%- if image_type == "volumeFromImage" %} + volumeSize: {{ volume_size }}{% endif %} fsRoot: {{ fs_root }} hardwareId: {{ hardware_id }} {%- if is_sandbox is defined %} @@ -201,6 +202,11 @@ for index, _ in enumerate(cloud_config_final): value = lookuptable[value] section_cloud[key] = value + if "volume_size" not in section_cloud: + section_cloud.update(image_type="image") + else: + section_cloud.update(image_type="volumeFromImage") + j2_template = Template(maintemplate) print(j2_template.render(section_cloud)) diff --git a/releasenotes/notes/default_openstack_boot-76a655138ca488b9.yaml b/releasenotes/notes/default_openstack_boot-76a655138ca488b9.yaml new file mode 100644 index 00000000..a8f7a6cc --- /dev/null +++ b/releasenotes/notes/default_openstack_boot-76a655138ca488b9.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + The OpenStack JCasC yaml converter has learned how to properly + differentiate between volumeFromImage and image boot sources. -- 2.16.6