Software Development Kit (SDK) and API Discussions
Software Development Kit (SDK) and API Discussions
I have been led to believe that all of the interactions in the ONTAP System Manager UI map to API calls but I cannot seem to find the call that toggles visibility of the .snapshot directory as seen in the 'Configure Snapshot Copy Settings' dialogue after selecting Storage > Volume > VOLUME_NAME.
I have dug through the API documentation (https://library.netapp.com/ecmdocs/ECMLP2856304/html/index.html) and see no reference to the .snapshot dir. I also know that the "Preview the new experience" has an option to show all the API calls but the .snapshot directory visibility toggle is missing in the preview.
I am no web developer but was able to identify the component in the console of my browser (id="gwt-debug-netapp-clSnapshotConfigureDialogEnableScheduleCheckBox") but it ended up not being so helpful to me.
Hi,
I doesn't look like this is available via the REST API to enable\disable access to view the .snapshot directory for a volume.
There is a ZAPI available thought. EG
<?xml version="1.0" encoding="UTF-8"?>
<netapp xmlns="http://www.netapp.com/filer/admin" version="1.170">
<volume-modify-iter>
<attributes>
<volume-attributes>
<volume-id-attributes>
<name>cifs_data_001</name>
<owning-vserver-name>vserver1</owning-vserver-name>
</volume-id-attributes>
<volume-snapshot-attributes>
<snapdir-access-enabled>false</snapdir-access-enabled>
</volume-snapshot-attributes>
</volume-attributes>
</attributes>
<max-records>1</max-records>
<query>
<volume-attributes>
<volume-id-attributes>
<name>cifs_data_001</name>
<owning-vserver-name>vserver1</owning-vserver-name>
</volume-id-attributes>
<volume-snapshot-attributes>
<snapdir-access-enabled>true</snapdir-access-enabled>
</volume-snapshot-attributes>
</volume-attributes>
</query>
</volume-modify-iter>
</netapp>
The above will disable the snapshot dir access for the volume.
cluster1::> vol show -vserver vserver1 -volume cifs_data_001 -fields snapdir-access
vserver volume snapdir-access
-------- ------------- --------------
vserver1 cifs_data_001 false
To enable it again reverse the true\false parameters. EG:
<?xml version="1.0" encoding="UTF-8"?>
<netapp xmlns="http://www.netapp.com/filer/admin" version="1.170">
<volume-modify-iter>
<attributes>
<volume-attributes>
<volume-id-attributes>
<name>cifs_data_001</name>
<owning-vserver-name>vserver1</owning-vserver-name>
</volume-id-attributes>
<volume-snapshot-attributes>
<snapdir-access-enabled>true</snapdir-access-enabled>
</volume-snapshot-attributes>
</volume-attributes>
</attributes>
<max-records>1</max-records>
<query>
<volume-attributes>
<volume-id-attributes>
<name>cifs_data_001</name>
<owning-vserver-name>vserver1</owning-vserver-name>
</volume-id-attributes>
<volume-snapshot-attributes>
<snapdir-access-enabled>false</snapdir-access-enabled>
</volume-snapshot-attributes>
</volume-attributes>
</query>
</volume-modify-iter>
</netapp>
The above enables access to the .snapshot directory. EG
cluster1::> vol show -vserver vserver1 -volume cifs_data_001 -fields snapdir-access
vserver volume snapdir-access
-------- ------------- --------------
vserver1 cifs_data_001 true
What programming language are you using to to invoke API's???
/Matt
Thanks @mbeattie . Promising, as this looks like it toggles what I want. All of the automation I've written so far is in python.
I am not familiar with ZAPI a bit of searching did not turn up much but I did find "... NetApp tools or proprietary ZAPI via the ONTAP SDK". Then I found post from 2008 of someone having trouble running a secure connection using perl scripts.
Is ZAPI some interface that's addressable only via some non-restful interface?
Hi,
Based on the XML here is a Python example using the NMSDK libraries:
import sys
sys.path.append("<path_to_nmsdk_root>/lib/python/NetApp")
from NaServer import *
s = NaServer("<server name or IP address>", 1 , 170)
s.set_server_type("FILER")
s.set_transport_type("HTTPS")
s.set_port(443)
s.set_style("LOGIN")
s.set_admin_user("<user name>", "<password>")
api = NaElement("volume-modify-iter")
xi = NaElement("attributes")
api.child_add(xi)
xi1 = NaElement("volume-attributes")
xi.child_add(xi1)
xi2 = NaElement("volume-id-attributes")
xi1.child_add(xi2)
xi2.child_add_string("name","cifs_data_001")
xi2.child_add_string("owning-vserver-name","vserver1")
xi3 = NaElement("volume-snapshot-attributes")
xi1.child_add(xi3)
xi3.child_add_string("snapdir-access-enabled","false")
api.child_add_string("max-records","1")
xi4 = NaElement("query")
api.child_add(xi4)
xi5 = NaElement("volume-attributes")
xi4.child_add(xi5)
xi6 = NaElement("volume-id-attributes")
xi5.child_add(xi6)
xi6.child_add_string("name","cifs_data_001")
xi6.child_add_string("owning-vserver-name","vserver1")
xi7 = NaElement("volume-snapshot-attributes")
xi5.child_add(xi7)
xi7.child_add_string("snapdir-access-enabled","true")
xo = s.invoke_elem(api)
if (xo.results_status() == "failed") :
print ("Error:\n")
print (xo.sprintf())
sys.exit (1)
print ("Received:\n")
print (xo.sprintf())
Hope that helps
/Matt