#REST API - Possible BUG for quota rule creation

1 messages · Page 1 of 1 (latest)

muted siren
#

Hello Team,

We've got a customer that believes there is a possible BUG within SDK in regards to quota rule creation. Whenever you request it to create one quota rule with a defined target, that single operation also creates a top-level volume quota rule that we didn't ask for.

In the output below, only the second rule was requested:

`Cluster::> volume quota policy rule show -volume vol_quota_test_sv2

Vserver: vserver1 Policy: default Volume: vol_quota_test_sv2

                                           Soft             Soft
                     User         Disk     Disk   Files    Files

Type Target Qtree Mapping Limit Limit Limit Limit Threshold


tree "" "" - - - - - -
tree q7g "" - - - - - -
2 entries were displayed.`

The issue appears to be SDK/API specific because it doesn't happen in CLI - in CLI, it creates just the rule you ask for, and nothing else.

Here's the minimal code to reproduce the issue:

`from netapp_ontap import config, HostConnection
from netapp_ontap.resources import QuotaRule, Qtree, Volume, Svm

hostname = "vserver1.financegroup.com"
username = ""
password = ""

config.CONNECTION = HostConnection(hostname, username, password)

volume_name = "vol_quota_test_sv2"
qtree_name = "q7g"

volume = Volume.find(name=volume_name)
svm = Svm.find(name=volume.svm.name)
qtree = Qtree.find(name=qtree_name, volume=volume.name)

quota_rule = QuotaRule.from_dict({
"svm": svm.to_dict(),
"volume": volume.to_dict(),
"type": "tree",
"qtree": qtree.to_dict(),
"disk_limit": 7516192768,
})
quota_rule.post()`

SDK versions that we've tried - 9.13.1.0 and 9.17.1.0 (the latest) - are both affected.

#

NetApp PS personnel have also been able to reproduce this in Lab On Demand and can be brought into this conversation.

muted siren
#

From PS personnel: They aren't seeing the issue in SDK, but is in rest API itself:

Subject: RE: NetApp SDK bug when creating a quota rule

The ontap-rest-python community is off the hook. I get the same result using the REST API call. We should make a support case since this is firmly within ONTAP. You can make me the contact if you want since I can do everything needed for the TSE within LOD, but pick a Citadel cluster for the case serial number.

==== REST API – creates an unnecessary rule highlighted in BOLD below

#

::*> quota policy rule show -volume fv2
This table is currently empty.

Linux# curl -k -X POST https://cluster1.demo.netapp.com/api/storage/quota/rules?return_timeout=0&return_records=false
-H "accept: application/json"
-H "authorization: Basic YWRtaW46TmV0YXBwMSE="
-H "Content-Type: application/json"
-d '{ "qtree": { "name": "t1" }, "svm": { "name": "svm1" }, "type": "tree", "volume": { "name": "fv2" }}'

::*> quota policy rule show -volume fv2

Vserver: svm1 Policy: default Volume: fv2

                                           Soft             Soft
                     User         Disk     Disk   Files    Files

Type Target Qtree Mapping Limit Limit Limit Limit Threshold


tree "" "" - - - - - -
tree t1 "" - - - - - -
2 entries were displayed.

==== CLI – just one tree rule – expected behavior

::*> quota policy rule create -policy-name default -volume fv2 -type tree -target t1

::*> quota policy rule show

Vserver: svm1 Policy: default Volume: fv2

                                           Soft             Soft
                     User         Disk     Disk   Files    Files

Type Target Qtree Mapping Limit Limit Limit Limit Threshold


tree t1 "" - - - - - -

opal crest
#

My customer is running into a similar issue. Here is an example of what they are getting when creating rule using RestAPI -

Created volume and quota, no rule created

us01cmqa::> vol show QUOTA_TEST_10
Vserver Volume Aggregate State Type Size Available Used%


us01cmqavs1 QUOTA_TEST_10 us01cmqat1f03_nvme_aggr1 online RW 100GB 95.00GB 0%

us01cmqa::> quota policy rule show -volume QUOTA_TEST_10 -vserver us01cmqavs1
There are no entries matching your query.

Executed the API for creating the rule

aneeshpa@us01nasadmin3:~ $ curl -X POST -u "user:********" -k -H "accept: application/json" -H "Content-Type: application/json" -d '{"qtree":{"nme":"quota_test_10"},"space":{"hard_limit":"2147483648"},"svm":{"name":"us01cmqavs1"},"type":"user","volume":{"name":"QUOTA_TEST_10"},"users":[{"name":"user1"}]}' https://us01cmqa/api/storage/quota/rules
{
"job": {
"uuid": "d0fb5f95-ab22-11f0-9b12-00a098c54541",
"_links": {
"self": {
"href": "/api/cluster/jobs/d0fb5f95-ab22-11f0-9b12-00a098c54541"
}
}
}
}

With the above API we have created a rule for one user only, but one more extra entry came, wanted to check is there any way to avoid the extra entry

us01cmqa::> quota policy rule show -volume QUOTA_TEST_10 -vserver us01cmqavs1

Vserver: us01cmqavs1 Policy: default Volume: QUOTA_TEST_10

                                          Soft             Soft
                    User         Disk     Disk   Files    Files

Type Target Qtree Mapping Limit Limit Limit Limit Threshold


user "" "" off - - - - -
user aneeshpa quota_test_10 off 2GB - - - -