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

ONTAP FlexCache® Ansible module fails when origin_cluster parameter is specified #232

Open
scottrem opened this issue Nov 5, 2024 · 2 comments

Comments

@scottrem
Copy link

scottrem commented Nov 5, 2024

Summary

ONTAP FlexCache Ansible module fails if origin_cluster is defined.

Component Name

netapp.ontap.na_ontap_flexcache

Ansible Version

$ ansible --version
ansible [core 2.16.3]
  config file = None
  configured module search path = ['/home/scottrem/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.11/site-packages/ansible
  ansible collection location = /home/scottrem/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.10 (main, Sep  9 2024, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] (/usr/bin/python3.11)
  jinja version = 3.1.3
  libyaml = True

ONTAP Collection Version

$ ansible-galaxy collection list

# /home/scottrem/.ansible/collections/ansible_collections
Collection                               Version
---------------------------------------- -------
ansible.netcommon                        2.2.0  
ansible.utils                            2.3.0  
ansible.windows                          1.13.0 
cisco.nxos                               2.4.0  
microsoft.ad                             1.2.0  
netapp.ontap                             22.12.0
netapp.storagegrid                       21.6.0 
netapp_eseries.santricity                1.1.0  

# /usr/local/lib/python3.11/site-packages/ansible_collections
Collection                               Version
---------------------------------------- -------
amazon.aws                               7.2.0  
ansible.netcommon                        5.3.0  
ansible.posix                            1.5.4  
ansible.utils                            2.12.0 
ansible.windows                          2.2.0  
arista.eos                               6.2.2  
awx.awx                                  23.6.0 
azure.azcollection                       1.19.0 
check_point.mgmt                         5.2.2  
chocolatey.chocolatey                    1.5.1  
cisco.aci                                2.8.0  
cisco.asa                                4.0.3  
cisco.dnac                               6.10.2 
cisco.intersight                         2.0.7  
cisco.ios                                5.3.0  
cisco.iosxr                              6.1.1  
cisco.ise                                2.7.0  
cisco.meraki                             2.17.2 
cisco.mso                                2.5.0  
cisco.nxos                               5.3.0  
cisco.ucs                                1.10.0 
cloud.common                             2.1.4  
cloudscale_ch.cloud                      2.3.1  
community.aws                            7.1.0  
community.azure                          2.0.0  
community.ciscosmb                       1.0.7  
community.crypto                         2.17.1 
community.digitalocean                   1.26.0 
community.dns                            2.8.0  
community.docker                         3.7.0  
community.general                        8.3.0  
community.grafana                        1.7.0  
community.hashi_vault                    6.1.0  
community.hrobot                         1.9.0  
community.library_inventory_filtering_v1 1.0.0  
community.libvirt                        1.3.0  
community.mongodb                        1.6.3  
community.mysql                          3.8.0  
community.network                        5.0.2  
community.okd                            2.3.0  
community.postgresql                     3.3.0  
community.proxysql                       1.5.1  
community.rabbitmq                       1.2.3  
community.routeros                       2.12.0 
community.sap                            2.0.0  
community.sap_libs                       1.4.2  
community.sops                           1.6.7  
community.vmware                         4.1.0  
community.windows                        2.1.0  
community.zabbix                         2.3.1  
containers.podman                        1.11.0 
cyberark.conjur                          1.2.2  
cyberark.pas                             1.0.25 
dellemc.enterprise_sonic                 2.4.0  
dellemc.openmanage                       8.7.0  
dellemc.powerflex                        2.1.0  
dellemc.unity                            1.7.1  
f5networks.f5_modules                    1.27.1 
fortinet.fortimanager                    2.3.1  
fortinet.fortios                         2.3.4  
frr.frr                                  2.0.2  
gluster.gluster                          1.0.2  
google.cloud                             1.3.0  
grafana.grafana                          2.2.4  
hetzner.hcloud                           2.4.1  
hpe.nimble                               1.1.4  
ibm.qradar                               2.1.0  
ibm.spectrum_virtualize                  2.0.0  
ibm.storage_virtualize                   2.2.0  
infinidat.infinibox                      1.3.12 
infoblox.nios_modules                    1.6.1  
inspur.ispim                             2.2.0  
inspur.sm                                2.3.0  
junipernetworks.junos                    5.3.1  
kubernetes.core                          2.4.0  
lowlydba.sqlserver                       2.2.2  
microsoft.ad                             1.4.1  
netapp.aws                               21.7.1 
netapp.azure                             21.10.1
netapp.cloudmanager                      21.22.1
netapp.elementsw                         21.7.0 
netapp.ontap                             22.9.0 
netapp.storagegrid                       21.11.1
netapp.um_info                           21.8.1 
netapp_eseries.santricity                1.4.0  
netbox.netbox                            3.16.0 
ngine_io.cloudstack                      2.3.0  
ngine_io.exoscale                        1.1.0  
openstack.cloud                          2.2.0  
openvswitch.openvswitch                  2.1.1  
ovirt.ovirt                              3.2.0  
purestorage.flasharray                   1.26.0 
purestorage.flashblade                   1.15.0 
purestorage.fusion                       1.6.0  
sensu.sensu_go                           1.14.0 
splunk.es                                2.1.2  
t_systems_mms.icinga_director            2.0.1  
telekom_mms.icinga_director              1.35.0 
theforeman.foreman                       3.15.0 
vmware.vmware_rest                       2.3.1  
vultr.cloud                              1.12.1 
vyos.vyos                                4.1.0  
wti.remote                               1.0.5

ONTAP Version

gsdc-aut-ontap914-2::*> version
NetApp Release 9.14.1: Tue Jan 23 21:48:01 UTC 2024

Playbook

---
- name:                            Create and modify FlexCache volume
  hosts:                           localhost
  gather_facts:                    false
  collections:
    -                              netapp.ontap

  vars_files:
    -                              vars.yml

  module_defaults:
    group/netapp.ontap.netapp_ontap:
      hostname:                    "{{ netapp_hostname }}"
      username:                    "{{ netapp_username }}"
      password:                    "{{ netapp_password }}"
      validate_certs:              false
      https:                       true

  tasks:
  - name:                          Create export policy
    na_ontap_export_policy:
      name:                        "{{ volume_name }}"
      state:                       present
      vserver:                     "{{ cache_vserver }}"

  - name:                          Create export policy rule
    na_ontap_export_policy_rule:
      name:                        "{{ volume_name }}"
      state:                       present
      client_match:                "{{ nfsClient }}"
      ro_rule:                     "{{ nfsRO }}"
      rw_rule:                     "{{ nfsRW }}"
      super_user_security:         "{{ nfsSuperuser | default(omit) }}"
      allow_device_creation:       "{{ nfsDev | default('false') }}"
      allow_suid:                  "{{ nfsSuid | default('false') }}"
      anonymous_user_id:           "{{ nfsAnon | default(omit) }}"
      rule_index:                  "{{ nfsRuleIndex | default(omit) }}"
      vserver:                     "{{ cache_vserver }}"

  - name:                          Create FlexCache® volume
    na_ontap_flexcache:
      state:                       present
      aggr_list:                   "{{ fcAggrList | default(omit) }}"
      aggr_list_multiplier:        "{{ fcAggrListMultiplier | default(omit) }}"
      force_offline:               "{{ fcForceOffline | default(omit) }}"
      force_unmount:               "{{ fcForceUnmount | default(omit) }}"
      junction_path:               "/{{ volume_name }}"
      name:                        "{{ volume_name }}"
      origin_cluster:              "{{ source_hostname | default(omit) }}"
      origin_volume:               "{{ source_volume }}"
      origin_vserver:              "{{ source_vserver }}"
      prepopulate:                 "{{ prePop | default(omit) }}"
      size:                        "{{ fcSize }}"
      size_unit:                   "{{ fcSizeUnit | default('gb') }}"
      time_out:                    "{{ fcTimeout | default(omit) }}"
      vserver:                     "{{ cache_vserver }}"

  - name:                          Set FlexCache® volume export policy
    na_ontap_volume:
      name:                        "{{ volume_name }}"
      policy:                      "{{ volume_name }}"
      vserver:                     "{{ cache_vserver }}"

  - name:                          Set additional FlexCache® features
    na_ontap_rest_cli:
      body:                        "{{ restBody }}"
      command:                     "{{ restCommand }}"
      params:                      "{{ restParams }}"
      verb:                        "{{ restVerb }}"

Steps to Reproduce

Here is my vars.yml file that is included by the above playbook. When the origin_cluster parameter is supplied (not null) the playbook fails even if the origin_cluster and cache cluster are identical.

netapp_hostname: gsdc-aut-ontap914-2
netapp_username: admin
netapp_password: NetApp123!

cache_vserver: testDan
volume_name: fcTest1
fcSize: 111

nfsClient: 10.216.51.23
nfsRO: any
nfsRW: sys

source_hostname: gsdc-aut-ontap914-1
source_vserver: win_9141
source_volume: volName

restBody:
is-writeback-enabled: true
restCommand: volume/flexcache/config
restParams:
vserver: "{{ cache_vserver }}"
volume: "{{ volume_name }}"
privilege_level: diagnostic
restVerb: PATCH

Expected Results

I expect the export policy, rule, FlexCache volume to be created. The cache volume to be modified to use the export policy created and writeback to be enabled by the rest_cli task.

Actual Results

Here is the error message I get from the FlexCache task:

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error in flexcache_get: calling: storage/flexcache/flexcaches: got {'message': 'Unexpected argument \"origin_cluster\".', 'code': '262179', 'target': 'origin_cluster'}."}

The playbook can succeed even when origin_cluster parameter is passed but only when I comment out lines 348 and 349 in the module.  Here is that bit:

            #if 'origin_cluster' in self.parameters:
                #query['origin.cluster.name'] = self.parameters['origin_cluster']

While it does work with that commented out, I'm concerned that there might be a scenario where that test protects from some problem but I don't completely understand what that might be.
@scottrem
Copy link
Author

scottrem commented Nov 5, 2024

With help, I've discovered that on line 349 the query field contains 'origin.cluster.name', but the REST API is expecting 'origins.cluster.name'. That's 'origin' with an 's' on the end. I edited my copy of the module and it appears to work correctly.

@csahu9
Copy link

csahu9 commented Nov 7, 2024

We've story 7194 open for this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants