From e36e3c0ee9764414db982112876e8975466b777f Mon Sep 17 00:00:00 2001 From: Alan Bishop Date: Fri, 17 Dec 2021 12:46:34 -0800 Subject: [PATCH] [train,ussuri] Set cinder's __DEFAULT__ vol type description Update the description of cinder's internal __DEFAULT__ volume type so that users don't confuse it with the actual default volume type established by the CinderDefaultVolumeType parameter. This patch is a variant of Idf27c14b31dc077ef9a0e567bd502ed6842bd52b, which in later releases deletes cinder's __DEFAULT__ volume type if there are no volumes associated with it. However, the __DEFAULT__ volume type cannot be removed prior to the victoria release because it's required for a DB migration. Lastly, CinderDefaultVolumeType is now constrained to prevent it being set to an empty string. That should never happen, so this is just a safety net. Change-Id: Ifc35eb09ab3af4d8f3ea232dd20558047c6834b9 Related-Bug: #1782217 (cherry picked from commit d30105a28c755d826c85bccf4d02cdca2712c53b) --- deployment/cinder/cinder-api-container-puppet.yaml | 14 +++++++++++++- ...e-volume-type-description-5f81e2ff5ea8184a.yaml | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/cinder-update-volume-type-description-5f81e2ff5ea8184a.yaml diff --git a/deployment/cinder/cinder-api-container-puppet.yaml b/deployment/cinder/cinder-api-container-puppet.yaml index a1a4a6a88f..67846a7c76 100644 --- a/deployment/cinder/cinder-api-container-puppet.yaml +++ b/deployment/cinder/cinder-api-container-puppet.yaml @@ -58,6 +58,11 @@ parameters: default: tripleo description: The name of Cinder's default volume type. type: string + constraints: + - allowed_pattern: "[a-zA-Z0-9]+" + description: > + The default volume type must be at least 1 character and contain only + letters and numbers. CinderEnableDBPurge: default: true description: | @@ -497,7 +502,7 @@ outputs: state: absent when: - step|int == 4 - - name: Manage Cinder Volume Type + - name: Manage Cinder's default volume type become: true vars: default_volume_type: {get_param: CinderDefaultVolumeType} @@ -510,6 +515,13 @@ outputs: if ! openstack volume type show "{{ default_volume_type }}"; then openstack volume type create --public "{{ default_volume_type }}" fi + eval $(openstack volume type show __DEFAULT__ -f shell -c id -c description) + if [ -n "$id" ]; then + tripleo_descr="For internal use, '{{ default_volume_type }}' is the default volume type" + if [ "$description" != "$tripleo_descr" ]; then + openstack volume type set $id --description "$tripleo_descr" + fi + fi args: executable: /bin/bash changed_when: false diff --git a/releasenotes/notes/cinder-update-volume-type-description-5f81e2ff5ea8184a.yaml b/releasenotes/notes/cinder-update-volume-type-description-5f81e2ff5ea8184a.yaml new file mode 100644 index 0000000000..b60d880f33 --- /dev/null +++ b/releasenotes/notes/cinder-update-volume-type-description-5f81e2ff5ea8184a.yaml @@ -0,0 +1,6 @@ +--- +other: + - | + The description of cinder's own __DEFAULT__ volume type is updated to + indicate the actual default volume type is the one established by the + CinderDefaultVolumeType parameter.