ansible-collections / ibm.storage_virtualize

GNU General Public License v3.0
2 stars 9 forks source link

ibm_svc_manage_volume doesn't react to changes to thin #17

Closed mainline-automation closed 12 months ago

mainline-automation commented 1 year ago
SUMMARY

After running a demonstration for one of our VPs about how csv files/gitops methodology could be used to maintain FlashSystem volumes with Ansible at our customers, he asked about the ibm_svc_manage_volume module and whether it could change volumes from Thick to Thin/Thin to Thick. When I tried, I found that it didn't react at all

ISSUE TYPE
COMPONENT NAME

ibm.storage_virtualize_ibm_svc_manage_volume

ANSIBLE VERSION
ansible [core 2.15.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.16 (main, May 29 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /home/ansible/.ansible/collections/ansible_collections
Collection             Version
---------------------- -------
ibm.storage_virtualize 2.0.0  
CONFIGURATION
CONFIG_FILE() = /etc/ansible/ansible.cfg
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = ansible
GALAXY_SERVER_LIST(/etc/ansible/ansible.cfg) = ['validated', 'rh-certified', 'community', 'published']
OS / ENVIRONMENT

Storwize V7000 (2076-724), 8.2.0.9

STEPS TO REPRODUCE

Create a thin provisioned volume with ibm.ibm_svc_manage.volume Run a new playbook against the same volume that changes the "thin" parameter to false

- name: change volume ansible1 from thin to thick using ibm.storage_virutalize.ibm_svc_manage_volume
    ibm.storage_virtualize.ibm_svc_manage_volume:
      clustername: 10.137.0.30
      username: xxxx
      password: xxxx
      name: "ansible1"
      state: present'
      thin: false
EXPECTED RESULTS

In an ideal world it would trigger a response to do a volume mirror to change from thin to thick (and the opposite if we started with a thick volume). Failing that, it would at least give a message about the thin parameter only being used in the creation of a volume.

ACTUAL RESULTS

It said that the volume already exists. It totally ignored the presence of the thin parameter and the value assigned to it

Task name: change volume ansible1 from thin to thick using ibm.storage_virutalize.ibm_svc_manage_volume
Ok: localhost volume [ansible1] already exists.                                                                                                                                                           
22│      iogrp: null                                                                                                                                                                                      
23│      log_path: null                                                                                                                                                                                   
24│      name: ansible1                                                                                                                                                                                   
25│      novolumegroup: null                                                                                                                                                                              
26│      old_name: null                                                                                                                                                                                   
27│      password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER                                                                                                                                                    
28│      pool: null                                                                                                                                                                                       
29│      size: null                                                                                                                                                                                       
30│      state: present                                                                                                                                                                                   
31│      thin: false                                                                                                                                                                                      
32│      token: null                                                                                                                                                                                      
33│      unit: mb                                                                                                                                                                                        ▒
34│      username: ansible                                                                                                                                                                               ▒
35│      validate_certs: false                                                                                                                                                                           ▒
36│      volumegroup: null                                                                                                                                                                               ▒
37│  msg: volume [ansible1] already exists.                                                                                                                                                              ▒
38│resolved_action: ibm.storage_virtualize.ibm_svc_manage_volume                                                                                                                                         ▒
39│start: '2023-08-31T18:52:32.097197'                                                                                                                                                                   ▒
40│task: change volume ansible1 from thin to thick using ibm.storage_virutalize.ibm_svc_manage_volume                                                                                                    ▒
41│task_action: ibm.storage_virtualize.ibm_svc_manage_volume                                                                                                                                             ▒
42│task_args: ''                                                                                                                                                                                         ▒
43│task_path: /home/ansible/playbooks/flashsystem_setup/flashsystem_thin_to_thick.yml:9     
Shilpi-J commented 12 months ago

Please try the use case on the new version of collection 2.1.0. In case you still face issue, feel free to re-open it. Closing it for now.

mainline-automation commented 11 months ago

Found a bug in this. If you gather info and you have "false" under the "Thin" parameter, it will always be false. This is because it evaluates by comparing capacity vs. real capacity (which would determine thin), but then goes on to compare whether the volume is compressed. In my playbook, I used a CSV to make changes to the volume so that it would become a thick/generic volume. However, even with that transformation it was still compression_copy = 'no'. So, even after the volume had been changed to thick/generic it would give me the same error about not making changes to ['thin'].

I made a change in my pull request (primarily regarding using manage_volume to change from thin to thick and vice versa) to fix this bug. I removed that compression_copy comparison. I also changed the capacity comparison to looking at whether se_copy was set to "yes".

https://github.com/ansible-collections/ibm.storage_virtualize/pull/31