Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added vserver to lun_info field to ensure unique LUN dict keys #58260

Open
wants to merge 4 commits into
base: devel
from

Conversation

Projects
None yet
4 participants
@jasonl4
Copy link

commented Jun 23, 2019

SUMMARY

na_ontap_gather_facts lun_info does not return all LUNs when they have same volume name and LUN name, in different SVMs, due to lun_info field using LUN path as key.

Added 'vserver' to LUN path for lun_info field (much the same as field for volume_info). Results in all LUNs having same LUN path being returned properly as dict key is unique.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

na_ontap_gather_facts

ADDITIONAL INFORMATION
ANSIBLE VERSION
ansible 2.9.0.dev0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/jasonl4/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /bin/ansible
  python version = 3.6.8 (default, Apr 25 2019, 21:02:35) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
CONFIGURATION

OS / ENVIRONMENT
CentOS Linux release 7.5.1804 (Core)
NetApp Release 9.4P1: Fri Jul 20 23:17:19 UTC 2018 (ONTAP Select)
STEPS TO REPRODUCE

Create two LUNs in separate SVMs with same volume name and same LUN name.

cluster1::> lun show
Vserver   Path                            State   Mapped   Type        Size
--------- ------------------------------- ------- -------- -------- --------
svm1      /vol/vol1/lun1                  online  mapped   linux         1GB
svm2      /vol/vol1/lun1                  online  mapped   linux         1GB
2 entries were displayed.

cluster1::>

Execute following playbook to retrieve lun_info.

---
- hosts: localhost
  gather_facts: false
  vars_files:
    - globals.yml
  tasks:
  - na_ontap_gather_facts:
      state: info
      gather_subset:
        - "lun_info"
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      ontapi: 32
      https: true
      validate_certs: false
  - debug: var=ontap_facts['lun_info']
EXPECTED RESULTS

Expect all LUNs to be returned by na_ontap_gather_facts.

ACTUAL RESULTS

Only last LUN is returned due to lun_info dict key being the same for both LUNs. First LUN is overwritten by second LUN.

PLAY [localhost] ************************************************************************************************************

TASK [na_ontap_gather_facts] ************************************************************************************************
ok: [localhost]

TASK [debug] ****************************************************************************************************************
ok: [localhost] => {
    "ontap_facts['lun_info']": {
        "/vol/vol1/lun1": {
            "alignment": "indeterminate",
            "block_size": "512",
            "class": "regular",
            "comment": null,
            "creation_timestamp": "1561163704",
            "is_clone": "false",
            "is_clone_autodelete_enabled": "false",
            "is_inconsistent_import": "false",
            "is_restore_inaccessible": "false",
            "is_space_alloc_enabled": "false",
            "is_space_reservation_enabled": "false",
            "mapped": "true",
            "multiprotocol_type": "linux",
            "node": "node1",
            "online": "true",
            "path": "/vol/vol1/lun1",
            "prefix_size": "0",
            "qtree": null,
            "read_only": "false",
            "serial_7_mode": null,
            "serial_number": "ZPevK+N7MJ8X",
            "share_state": "none",
            "size": "1073741824",
            "size_used": "0",
            "staging": "false",
            "state": "online",
            "suffix_size": "0",
            "uuid": "49c61b1f-a47d-4650-b724-03f5e7d040b2",
            "volume": "vol1",
            "vserver": "svm2"
        }
    }
}

PLAY RECAP ******************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
PROPOSED FIX

Added vserver to LUN path for lun_info field (much the same as field for volume_info). Results in both LUNs being returned properly as dict key is unique. volume_info uses similar method for key uniqueness.

PLAY [localhost] ************************************************************************************************************

TASK [na_ontap_gather_facts] ************************************************************************************************
ok: [localhost]

TASK [debug] ****************************************************************************************************************
ok: [localhost] => {
    "ontap_facts['lun_info']": {
        "/vol/vol1/lun1:svm1": {
            "alignment": "indeterminate",
            "block_size": "512",
            "class": "regular",
            "comment": null,
            "creation_timestamp": "1561163199",
            "is_clone": "false",
            "is_clone_autodelete_enabled": "false",
            "is_inconsistent_import": "false",
            "is_restore_inaccessible": "false",
            "is_space_alloc_enabled": "false",
            "is_space_reservation_enabled": "false",
            "mapped": "true",
            "multiprotocol_type": "linux",
            "node": "node1",
            "online": "true",
            "path": "/vol/vol1/lun1",
            "prefix_size": "0",
            "qtree": null,
            "read_only": "false",
            "serial_7_mode": null,
            "serial_number": "ZPevK+N7MJ8W",
            "share_state": "none",
            "size": "1073741824",
            "size_used": "0",
            "staging": "false",
            "state": "online",
            "suffix_size": "0",
            "uuid": "2f8f3c7e-72ad-496a-bd68-9509929f9366",
            "volume": "vol1",
            "vserver": "svm1"
        },
        "/vol/vol1/lun1:svm2": {
            "alignment": "indeterminate",
            "block_size": "512",
            "class": "regular",
            "comment": null,
            "creation_timestamp": "1561163704",
            "is_clone": "false",
            "is_clone_autodelete_enabled": "false",
            "is_inconsistent_import": "false",
            "is_restore_inaccessible": "false",
            "is_space_alloc_enabled": "false",
            "is_space_reservation_enabled": "false",
            "mapped": "true",
            "multiprotocol_type": "linux",
            "node": "node1",
            "online": "true",
            "path": "/vol/vol1/lun1",
            "prefix_size": "0",
            "qtree": null,
            "read_only": "false",
            "serial_7_mode": null,
            "serial_number": "ZPevK+N7MJ8X",
            "share_state": "none",
            "size": "1073741824",
            "size_used": "0",
            "staging": "false",
            "state": "online",
            "suffix_size": "0",
            "uuid": "49c61b1f-a47d-4650-b724-03f5e7d040b2",
            "volume": "vol1",
            "vserver": "svm2"
        }
    }
}

PLAY RECAP ******************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
@ansibot

This comment has been minimized.

@jasonl4

This comment has been minimized.

Copy link
Author

commented Jun 24, 2019

I just noticed that na_ontap_gather_facts igroup_info uses vserver in the field as well, though it's listed first.

'field': ('vserver', 'initiator-group-name'),

Whereas volume_info has owning-vserver-name as second part of key (which I based the lun_info field change above on).

'field': ('name', 'owning-vserver-name'),

I actually would prefer that vserver is listed first. Makes more sense from a hierarchy POV. Thoughts?

(I imagine with volume_info, that ship has already sailed as far as swapping it around with vserver first...)

@carchi8py

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2019

I know people are making a roles/playbook based off the output of gather facts. I rather not change the order and break people stuff.

@ansibot ansibot removed the needs_triage label Jun 24, 2019

@lonico

lonico approved these changes Jun 25, 2019

Copy link
Contributor

left a comment

shipit

@carchi8py
Copy link
Contributor

left a comment

Shipit

@ansibot ansibot added the stale_ci label Jul 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.