mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-03-26 21:43:02 +00:00
Add volume_type related plugins/modules
Added 2 new modules to manipulate volume types in OpenStack * volume_type is used to create, delete and modify volume type * volume_type_info is used to show volume_type details, including encryption information ci tests extended with additional role to test basic module behaviour It is currently impossible to update is_public volume type attribute as it is being changed to "os-volume-type-access:is_public" which is not expected by api. Which expects just "is_public" https://docs.openstack.org/api-ref/block-storage/v3/?expanded=update-a-volume-type-detail#update-a-volume-type Which results in "'os-volume-type-access:is_public' was unexpected" reply. I guess the change is required by openstacksdk or on the API side Change-Id: Idc26a5240b5f3314c8384c7326d8a82dcc8c6171
This commit is contained in:
committed by
arddennis
parent
407369da6e
commit
147ad6c452
12
ci/roles/volume_type/defaults/main.yml
Normal file
12
ci/roles/volume_type/defaults/main.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
volume_backend_name: LVM_iSCSI
|
||||
volume_type_name: test_type
|
||||
volume_type_description: Test volume type
|
||||
volume_type_alt_name: changed_type
|
||||
volume_type_alt_description: Changed test volume type
|
||||
|
||||
enc_provider_name: nova.volume.encryptors.luks.LuksEncryptor
|
||||
enc_cipher: aes-xts-plain64
|
||||
enc_control_location: front-end
|
||||
enc_control_alt_location: back-end
|
||||
enc_key_size: 256
|
||||
82
ci/roles/volume_type/tasks/main.yml
Normal file
82
ci/roles/volume_type/tasks/main.yml
Normal file
@@ -0,0 +1,82 @@
|
||||
---
|
||||
- name: Create volume type
|
||||
openstack.cloud.volume_type:
|
||||
name: "{{ volume_type_name }}"
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
extra_specs:
|
||||
volume_backend_name: "{{ volume_backend_name }}"
|
||||
description: "{{ volume_type_description }}"
|
||||
is_public: true
|
||||
register: the_result
|
||||
- name: Check created volume type
|
||||
vars:
|
||||
the_volume: "{{ the_result.volume_type }}"
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'id' in the_result.volume_type"
|
||||
- the_volume.description == volume_type_description
|
||||
- the_volume.is_public == True
|
||||
- the_volume.name == volume_type_name
|
||||
- the_volume.extra_specs['volume_backend_name'] == volume_backend_name
|
||||
success_msg: >-
|
||||
Created volume: {{ the_result.volume_type.id }},
|
||||
Name: {{ the_result.volume_type.name }},
|
||||
Description: {{ the_result.volume_type.description }}
|
||||
|
||||
- name: Test, check idempotency
|
||||
openstack.cloud.volume_type:
|
||||
name: "{{ volume_type_name }}"
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
extra_specs:
|
||||
volume_backend_name: "{{ volume_backend_name }}"
|
||||
description: "{{ volume_type_description }}"
|
||||
is_public: true
|
||||
register: the_result
|
||||
- name: Check result.changed is false
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- the_result.changed == false
|
||||
success_msg: "Request with the same details lead to no changes"
|
||||
|
||||
- name: Add extra spec
|
||||
openstack.cloud.volume_type:
|
||||
cloud: "{{ cloud }}"
|
||||
name: "{{ volume_type_name }}"
|
||||
state: present
|
||||
extra_specs:
|
||||
volume_backend_name: "{{ volume_backend_name }}"
|
||||
some_spec: fake_spec
|
||||
description: "{{ volume_type_alt_description }}"
|
||||
is_public: true
|
||||
register: the_result
|
||||
- name: Check volume type extra spec
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'some_spec' in the_result.volume_type.extra_specs"
|
||||
- the_result.volume_type.extra_specs["some_spec"] == "fake_spec"
|
||||
success_msg: >-
|
||||
New extra specs: {{ the_result.volume_type.extra_specs }}
|
||||
|
||||
# is_public update attempt using openstacksdk result in unexpected attribute
|
||||
# error... TODO: Find solution
|
||||
#
|
||||
# - name: Make volume type private
|
||||
# openstack.cloud.volume_type:
|
||||
# cloud: "{{ cloud }}"
|
||||
# name: "{{ volume_type_alt_name }}"
|
||||
# state: present
|
||||
# extra_specs:
|
||||
# volume_backend_name: "{{ volume_backend_name }}"
|
||||
# # some_other_spec: test
|
||||
# description: Changed 3rd time test volume type
|
||||
# is_public: true
|
||||
# register: the_result
|
||||
|
||||
- name: Delete volume type
|
||||
openstack.cloud.volume_type:
|
||||
cloud: "{{ cloud }}"
|
||||
name: "{{ volume_type_name }}"
|
||||
state: absent
|
||||
register: the_result
|
||||
@@ -53,6 +53,7 @@
|
||||
- { role: subnet, tags: subnet }
|
||||
- { role: subnet_pool, tags: subnet_pool }
|
||||
- { role: volume, tags: volume }
|
||||
- { role: volume_type, tags: volume_type }
|
||||
- { role: volume_backup, tags: volume_backup }
|
||||
- { role: volume_snapshot, tags: volume_snapshot }
|
||||
- { role: volume_type_access, tags: volume_type_access }
|
||||
|
||||
Reference in New Issue
Block a user