ansible-collections / netapp.ontap

Ansible collection to support NetApp ONTAP configuration.
https://galaxy.ansible.com/netapp/ontap
GNU General Public License v3.0
55 stars 35 forks source link

force_remove_initiator not working in netapp.ontap.na_ontap_igroup #22

Closed mordechai closed 2 years ago

mordechai commented 3 years ago

Summary

When attempting to use Ansible collection module netapp.ontap.na_ontap_igroup to edit igroup membership by passing force_remove_initiator/allow_delete_while_mapped: yes always fails with

netapp_lib.api.zapi.zapi.NaApiError: NetApp API failed. Reason - 9029:LUN maps for this initiator group exist

2021-09-12 12:31:16,777 p=160048 u=mlehrer n=ansible | The full traceback is: Traceback (most recent call last): File "/tmp/ansible_netapp.ontap.na_ontap_igroup_payload_i2eh3f_x/ansible_netapp.ontap.na_ontap_igroup_payload.zip/ansible_collections/netapp/ontap/plugins/modules/na_ontap_igroup.py", line 483, in modify_initiator File "/usr/local/lib64/python3.6/site-packages/netapp_lib/api/zapi/zapi.py", line 301, in invoke_successfully raise NaApiError(code, msg) netapp_lib.api.zapi.zapi.NaApiError: NetApp API failed. Reason - 9029:LUN maps for this initiator group exist

2021-09-12 12:31:16,778 p=160048 u=mlehrer n=ansible | fatal: [rhev-red-01.rscalelab.com]: FAILED! => { "changed": false, "invocation": { "module_args": { "bind_portset": null, "cert_filepath": null, "feature_flags": {}, "force_remove_initiator": true, "from_name": null, "hostname": "ntap-a300-A-cls.rscalelab.com", "http_port": null, "https": false, "igroups": null, "initiator": [ "21:00:00:24:ff:1e:24:14", "21:00:00:24:ff:1e:24:15", "21:00:00:24:ff:1e:26:ec", "21:00:00:24:ff:1e:26:ed", "21:00:00:24:ff:1e:24:f6", "21:00:00:24:ff:1e:24:f7", "21:00:00:24:ff:1e:27:0c", "21:00:00:24:ff:1e:27:0d", "21:00:00:24:ff:1e:26:e2", "21:00:00:24:ff:1e:26:e3", "21:00:00:24:ff:1e:24:c6", "21:00:00:24:ff:1e:24:c7", "21:00:00:24:ff:1e:24:ee", "21:00:00:24:ff:1e:24:ef", "21:00:00:24:ff:1e:25:2e", "21:00:00:24:ff:1e:25:2f", "21:00:00:24:ff:1e:25:30", "21:00:00:24:ff:1e:25:31" ], "initiator_group_type": "fcp", "initiator_names": [ "21:00:00:24:ff:1e:24:14", "21:00:00:24:ff:1e:24:15", "21:00:00:24:ff:1e:26:ec", "21:00:00:24:ff:1e:26:ed", "21:00:00:24:ff:1e:24:f6", "21:00:00:24:ff:1e:24:f7", "21:00:00:24:ff:1e:27:0c", "21:00:00:24:ff:1e:27:0d", "21:00:00:24:ff:1e:26:e2", "21:00:00:24:ff:1e:26:e3", "21:00:00:24:ff:1e:24:c6", "21:00:00:24:ff:1e:24:c7", "21:00:00:24:ff:1e:24:ee", "21:00:00:24:ff:1e:24:ef", "21:00:00:24:ff:1e:25:2e", "21:00:00:24:ff:1e:25:2f", "21:00:00:24:ff:1e:25:30", "21:00:00:24:ff:1e:25:31" ], "initiator_objects": null, "key_filepath": null, "name": "RED_Scaleout_L0_Group_0", "ontapi": null, "os_type": null, "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "state": "present", "use_rest": "auto", "username": "admin", "validate_certs": true, "vserver": "fc1" } }, "msg": "Error modifying igroup initiator RED_Scaleout_L0_Group_0: NetApp API failed. Reason - 9029:LUN maps for this initiator group exist" }

Component Name

netapp.ontap.na_ontap_igroup

Ansible Version

ansible 2.9.25
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/mlehrer/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  executable location = /bin/ansible
  python version = 3.9.6 (default, Jul 16 2021, 00:00:00) [GCC 10.3.1 20210422 (Red Hat 10.3.1-1)]

ONTAP Collection Version

magnolia :: ansible_collections/netapp/ontap » cat MANIFEST.json                                                                                                                        128 ↵
{
 "collection_info": {
  "namespace": "netapp",
  "name": "ontap",
  "version": "21.11.0",
  "authors": [
   "NetApp Ansible Team <ng-ansibleteam@netapp.com>"
  ],
  "readme": "README.md",
  "tags": [
   "storage",
   "ontap",
   "netapp"
  ],
  "description": "NetApp ONTAP Collection",
  "license": [],
  "license_file": "COPYING",
  "dependencies": {},
  "repository": "https://github.com/ansible-collections/netapp.ontap",
  "documentation": null,
  "homepage": "https://netapp.io/configuration-management-and-automation/",
  "issues": "https://github.com/ansible-collections/netapp.ontap/issues"
 },
 "file_manifest_file": {
  "name": "FILES.json",
  "ftype": "file",
  "chksum_type": "sha256",
  "chksum_sha256": "7d08af598583b9e7c263d9629b0f2483d3feb29f9b7eeb83c018eaa88b5fbba6",
  "format": 1
 },
 "format": 1
}%

ONTAP Version

sridharc-vsim34::> version
NetApp Release 9.4P3: Thu Oct 11 22:23:50 UTC 2018

Playbook

- name: Unmapping wwpn or shortfqdn from the igroup "{{ igroup_iter.value.initiator_group_name }}"
    netapp.ontap.na_ontap_igroup:
      state: present
      initiator_group_type: "{{ igroup_iter.value.initiator_group_type }}"
      name: "{{ igroup_iter.value.initiator_group_name }}"
      initiator: "{{ reconstructed_initiators_lst }}"
      vserver: "{{ relocate_host_to_new_igroup_iter.vservername }}"
      hostname: "{{ netapp_hostname }}"
      username: "{{ netapp_username }}"
      password: "{{ netapp_password }}"
      force_remove_initiator: yes

Steps to Reproduce

  1. Create Igroup with mapped luns and several initators on netapp
  2. Use netapp.ontap.na_ontap_igroup with force_remove_initiator: yes or allow_delete_while_mapped: yes to save the Igroup with 2 members removed.

Expected Results

The igroup to be saved with remaining igroup members mapped to luns, and passed igroup members removed from the igroup.

Actual Results

2021-09-12 12:31:16,777 p=160048 u=mlehrer n=ansible | The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_netapp.ontap.na_ontap_igroup_payload_i2eh3f_x/ansible_netapp.ontap.na_ontap_igroup_payload.zip/ansible_collections/netapp/ontap/plugins/modules/na_ontap_igroup.py", line 483, in modify_initiator
  File "/usr/local/lib64/python3.6/site-packages/netapp_lib/api/zapi/zapi.py", line 301, in invoke_successfully
    raise NaApiError(code, msg)
netapp_lib.api.zapi.zapi.NaApiError: NetApp API failed. Reason - 9029:LUN maps for this initiator group exist

2021-09-12 12:31:16,778 p=160048 u=mlehrer n=ansible | fatal: [rhev-red-01.rscalelab.com]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "bind_portset": null,
            "cert_filepath": null,
            "feature_flags": {},
            "force_remove_initiator": true,
            "from_name": null,
            "hostname": "ntap-a300-A-cls.rscalelab.com",
            "http_port": null,
            "https": false,
            "igroups": null,
            "initiator": [
                "21:00:00:24:ff:1e:24:14",
                "21:00:00:24:ff:1e:24:15",
                "21:00:00:24:ff:1e:26:ec",
                "21:00:00:24:ff:1e:26:ed",
                "21:00:00:24:ff:1e:24:f6",
                "21:00:00:24:ff:1e:24:f7",
                "21:00:00:24:ff:1e:27:0c",
                "21:00:00:24:ff:1e:27:0d",
                "21:00:00:24:ff:1e:26:e2",
                "21:00:00:24:ff:1e:26:e3",
                "21:00:00:24:ff:1e:24:c6",
                "21:00:00:24:ff:1e:24:c7",
                "21:00:00:24:ff:1e:24:ee",
                "21:00:00:24:ff:1e:24:ef",
                "21:00:00:24:ff:1e:25:2e",
                "21:00:00:24:ff:1e:25:2f",
                "21:00:00:24:ff:1e:25:30",
                "21:00:00:24:ff:1e:25:31"
            ],
            "initiator_group_type": "fcp",
            "initiator_names": [
                "21:00:00:24:ff:1e:24:14",
                "21:00:00:24:ff:1e:24:15",
                "21:00:00:24:ff:1e:26:ec",
                "21:00:00:24:ff:1e:26:ed",
                "21:00:00:24:ff:1e:24:f6",
                "21:00:00:24:ff:1e:24:f7",
                "21:00:00:24:ff:1e:27:0c",
                "21:00:00:24:ff:1e:27:0d",
                "21:00:00:24:ff:1e:26:e2",
                "21:00:00:24:ff:1e:26:e3",
                "21:00:00:24:ff:1e:24:c6",
                "21:00:00:24:ff:1e:24:c7",
                "21:00:00:24:ff:1e:24:ee",
                "21:00:00:24:ff:1e:24:ef",
                "21:00:00:24:ff:1e:25:2e",
                "21:00:00:24:ff:1e:25:2f",
                "21:00:00:24:ff:1e:25:30",
                "21:00:00:24:ff:1e:25:31"
            ],
            "initiator_objects": null,
            "key_filepath": null,
            "name": "RED_Scaleout_L0_Group_0",
            "ontapi": null,
            "os_type": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "state": "present",
            "use_rest": "auto",
            "username": "admin",
            "validate_certs": true,
            "vserver": "fc1"
        }
    },
    "msg": "Error modifying igroup initiator RED_Scaleout_L0_Group_0: NetApp API failed. Reason - 9029:LUN maps for this initiator group exist"
}
mordechai commented 3 years ago

A work around for this issue is to drop down to cli commands, pasting here in case it helps anyone.

lonico commented 2 years ago

The module is setting 'force' when deleting everything, but it is not done on a modify when some initiators need to be deleted. This needs to be added both for ZAPI and REST.

carchi8py commented 2 years ago

This was fixed in 21.16.0