Add possibility to have private cinder volume types

When declaring cinder_backends in user_variables.yml, it
will create public volume types.

We should be able to add an option to set the volume type
as private. This commit add this possibility.

Change-Id: I583ad08feb2293b14da8d6ccd42f8809f1f45b8d
Related-Bug: 1804438
This commit is contained in:
Domingues Luis Filipe 2018-11-21 15:36:22 +01:00
parent 6090bf7de4
commit a04b6cb15e
3 changed files with 21 additions and 2 deletions

View File

@ -628,6 +628,20 @@ the desired qos spec dictionary.
consumer: front-end
write_iops_sec: 100
Configure cinder to create a private volume type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
By default, a define cinder-backend will create a public volume type.
In order to create a private volume type, add the variable ``public``
and set it to ``false``. If it is set to ``true`` or not set at all
the volume type created will be public.
.. code-block:: yaml
cinder_backends:
private_type:
public: false
Shared storage and synchronized UID/GID
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -0,0 +1,5 @@
---
features:
- Deployers can now define a cinder-backend volume type
explicitly private or public with option ``public``
set to true or false.

View File

@ -41,7 +41,7 @@
. {{ ansible_env.HOME }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (cinder_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
if ! {{ cinder_bin }}/openstack ${CLI_OPTIONS} volume type show "{{ item.key }}"; then
{{ cinder_bin }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" "{{ item.key }}"
{{ cinder_bin }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" {% if not item.value.public|default(True) %} --private {% endif %} "{{ item.key }}"
fi
args:
executable: /bin/bash
@ -54,7 +54,7 @@
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (cinder_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
{% for evtype in item.value.extra_volume_types %}
if ! {{ cinder_bin }}/openstack ${CLI_OPTIONS} volume type show "{{ evtype }}"; then
{{ cinder_bin }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" "{{ evtype }}"
{{ cinder_bin }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" {% if not item.value.public|default(True) %} --private {% endif %} "{{ evtype }}"
fi
{% endfor %}
args: