#Ansible quota module creating two quota policy rules, I need only one.

1 messages · Page 1 of 1 (latest)

empty cape
#

I am using below quota module to create quota but at NetApp end, I am seeing two entries of quota instead of one:

 netapp.ontap.na_ontap_quotas:
    hostname: "{{ host_name }}"
    username: "{{ username }}"
    password: "{{ password }}"
    state: present
    vserver: "{{ svm }}"
    volume: "{{ finalvolname }}"
    quota_target: "{{ finalvolumenumber }}-01"
    type: tree
    disk_limit: "{{ quota_size | int }}"
    set_quota_status: True
    validate_certs: "{{ validate_certs | default ('false') }}"
    use_rest: always

netapp quota policy output:
nas01::> quota policy rule show -vserver nlfsprdcn40181 -volume nfs1904

Vserver: nlfsprdcn40181 Policy: default Volume: nfs1904

                                           Soft             Soft
                     User         Disk     Disk   Files    Files

Type Target Qtree Mapping Limit Limit Limit Limit Threshold


tree "" "" - - - - - -
tree 1904-01 "" - 1GB - - - -
2 entries were displayed.

The second entry with target 1904-01 is correct and what I expect to be created with this module but the first entry with target "" I dont want that entry.
When we create quote policy rule manually, once one entry gets created.

orchid perch
empty cape
orchid perch
#

I"ll need to talk with the team in Jan when everyone is back.

What i see in the log is we first do a get (GET)
https://github.com/ansible-collections/netapp.ontap/blob/main/plugins/modules/na_ontap_quotas.py#L817 to get the volume ID

We are then creating the quota (POST)
https://github.com/ansible-collections/netapp.ontap/blob/main/plugins/modules/na_ontap_quotas.py#L833

We then do a patch to enabled quotas (Patch) (but that to the volume it self)
https://github.com/ansible-collections/netapp.ontap/blob/main/plugins/modules/na_ontap_quotas.py#L837

I don't see any where in the log in the REST API logs where the second is getting created.

If it wasn't there when you ran the playbook but afterward there 2. There might be something in the REST api that automatically getting created with out being retunred to us.

In the rest api we do a
'POST' -- storage/quota/rules -- to create (we get one results)
GET -- api/cluster/jobs/<job id> -- on the job id given back to us by the post (wait on this job until it complete)
PATCH -- api/storage/volumes/<volume id> -- with quota-enabled sent to true
GET -- api/cluster/jobs/<job-id> -- on the job id given back by the patch (wait on this job is complete).

My though here is maybe the REST API on the PATCH is creating it own Quota and not using the one created a few steps earlier.

GitHub

Ansible collection to support NetApp ONTAP configuration. - ansible-collections/netapp.ontap

empty cape
#

Yes thanks, if you need any more logs to show the output, please let me know I am more than happy to share with you. But yes, after this quota module runs, I can see two quotas like below: Vserver: nlfsprdcn40181 Policy: default Volume: nfs1904

                                           Soft             Soft
                     User         Disk     Disk   Files    Files

Type Target Qtree Mapping Limit Limit Limit Limit Threshold


tree "" "" - - - - - -
tree 1904-01 "" - 1GB - - - -

#

Here, quota 1904-01 created by module and quota "" created automatically

empty cape
#

Little bit more insight, whenever a volume and qtree is created (NetApp always creates 2 qtrees) and this is ok : nas01::> qtree show nfs1912
Vserver Volume Qtree Style Oplocks Status


nlfsprdcn40183
nfs1912 "" unix enable normal
nlfsprdcn40183
nfs1912 1912-01 unix enable normal
2 entries were displayed.
But after that we want to create quota just for manually created qtree like using below command: quota policy rule create -vserver nlfsprdcn40183 -policy-name default -volume nfs1912 -type tree -target 1912-01 -disk-limit 2g

empty cape
#

any update @orchid perch ?

orchid perch
#

Sorry most of my team is still out we should have an update for you by the end of the week

empty cape
#

thanks @orchid perch for prompt response, I will wait