From 9245b69650c0192d8793a3378271237070339be5 Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Thu, 19 Aug 2021 12:02:44 -0700 Subject: [PATCH] Fix: If no volume set, use "image" type If no volume_size is defined, the default behavior was to set one to 10GB. However, the proper way to handle this is to use an "Image" boot source rather than "Volume From Image". Change-Id: Ib4a33f224ea1044b076d965faa164686da071cc4 Signed-off-by: Eric Ball --- jenkins-admin/create_jenkins_clouds_openstack_yaml.py | 9 ++++++--- releasenotes/notes/openstack-label-fix-f06f9a1424ef13c5.yaml | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/openstack-label-fix-f06f9a1424ef13c5.yaml diff --git a/jenkins-admin/create_jenkins_clouds_openstack_yaml.py b/jenkins-admin/create_jenkins_clouds_openstack_yaml.py index b200b75a..ec11f455 100755 --- a/jenkins-admin/create_jenkins_clouds_openstack_yaml.py +++ b/jenkins-admin/create_jenkins_clouds_openstack_yaml.py @@ -100,9 +100,10 @@ machinetemplate = """\ name: {{ name_prefix }}-{{ labels }} slaveOptions: bootSource: - volumeFromImage: + {{ image_type }}: name: {{ image_name }} - volumeSize: {{ volume_size }} +{%- if image_type == "volumeFromImage" %} + volumeSize: {{ volume_size }}{% endif %} {%- if hardware_id %} hardwareId: {{ hardware_id }}{% endif %} {%- if instance_cap %} @@ -202,7 +203,9 @@ for section in config_parser_merged.sections(): # Default volume size of 10 if "volume_size" not in section_all_machines: - section_all_machines.update(volume_size="10") + section_all_machines.update(image_type="image") + else: + section_all_machines.update(image_type="volumeFromImage") if "labels" not in section_all_machines: # "section" is the name of the cloud agent, which is the default label section_all_machines.update(labels=section) diff --git a/releasenotes/notes/openstack-label-fix-f06f9a1424ef13c5.yaml b/releasenotes/notes/openstack-label-fix-f06f9a1424ef13c5.yaml new file mode 100644 index 00000000..215f4f82 --- /dev/null +++ b/releasenotes/notes/openstack-label-fix-f06f9a1424ef13c5.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + If no volume_size is defined, the default behavior was to set one to + 10GB. However, the proper way to handle this is to use an "Image" + boot source rather than "Volume From Image". -- 2.16.6