<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic DFM proxy create volume python in Software Development Kit (SDK) and API Discussions</title>
    <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/DFM-proxy-create-volume-python/m-p/131772#M2378</link>
    <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently trying to write a script to create volume via DFM as proxy.&lt;/P&gt;&lt;P&gt;I tried the API via direct filer, it works. Only via DFM proxy it doesn't work.&lt;/P&gt;&lt;P&gt;I keep getting the following errors if using dfm-proxy:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[root@vmwebtest Python]# python test aa zzz 10
11.7
Error: Missing required argument &amp;amp;apos;volume&amp;amp;apos;&lt;/PRE&gt;&lt;P&gt;Code snipet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import sys
sys.path.append("/var/lib/NetApp/Python/")
from NaServer import *

def print_usage():
   print ("Usage: nfs-bis.py &amp;lt;volname&amp;gt; &amp;lt;aggrname&amp;gt; &amp;lt;volsize&amp;gt; \n")
   print ("&amp;lt;volname&amp;gt; -- Volume name to be created\n")
   print ("&amp;lt;aggrname&amp;gt; -- Aggregate name\n")
   print ("&amp;lt;volsize&amp;gt; -- Request ordered size\n")
   sys.exit (1)


args = len(sys.argv) - 1
if(args &amp;lt; 3):
    print_usage()

volname = sys.argv[1]
aggrname = sys.argv[2]
volsize = int(sys.argv[3]) * 1.17

s = NaServer("192.168.59.12", 1 , 0)
s.set_server_type("DFM")
s.set_transport_type("HTTPS")
s.set_port(8488)
#s.set_style("LOGIN")
s.set_admin_user("root", "start123")

# Connects to DFM-Proxy
proxyElem = NaElement("api-proxy")
proxyElem.child_add_string("target", "192.168.59.20")
proxyElem.child_add(requestElem)

# ONTAPI API arg set here
requestElem = NaElement("request")
requestElem.child_add_string("name", "volume-create")
requestElem.child_add_string("containing-aggr-name","aggr1")
requestElem.child_add_string("language-code","en_US")
requestElem.child_add_string("size","50m")
requestElem.child_add_string("space-reserve","none")
requestElem.child_add_string("volume","testPython1")
out = s.invoke_elem(proxyElem)

if (out.results_status() == 'failed'):
    print(out.results_reason())
    print ("Error : " + out.results_reason() + "\n")
    sys.exit (1)

dfmResponse = out.child_get('response')

if (dfmResponse.child_get_string('status') == 'failed'):
    print ("Error: " + dfmResponse.child_get_string("reason") + "\n")
    sys.exit (1)

ontapiResponse = dfmResponse.child_get('results')

if (ontapiResponse.results_status() == 'failed'):
    print (ontapiResponse.results_reason() + "\n")
    sys.exit (1)

print(ontapiResponse.sprintf())&lt;/PRE&gt;</description>
    <pubDate>Wed, 04 Jun 2025 14:58:16 GMT</pubDate>
    <dc:creator>squall1988</dc:creator>
    <dc:date>2025-06-04T14:58:16Z</dc:date>
    <item>
      <title>DFM proxy create volume python</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/DFM-proxy-create-volume-python/m-p/131772#M2378</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently trying to write a script to create volume via DFM as proxy.&lt;/P&gt;&lt;P&gt;I tried the API via direct filer, it works. Only via DFM proxy it doesn't work.&lt;/P&gt;&lt;P&gt;I keep getting the following errors if using dfm-proxy:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[root@vmwebtest Python]# python test aa zzz 10
11.7
Error: Missing required argument &amp;amp;apos;volume&amp;amp;apos;&lt;/PRE&gt;&lt;P&gt;Code snipet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import sys
sys.path.append("/var/lib/NetApp/Python/")
from NaServer import *

def print_usage():
   print ("Usage: nfs-bis.py &amp;lt;volname&amp;gt; &amp;lt;aggrname&amp;gt; &amp;lt;volsize&amp;gt; \n")
   print ("&amp;lt;volname&amp;gt; -- Volume name to be created\n")
   print ("&amp;lt;aggrname&amp;gt; -- Aggregate name\n")
   print ("&amp;lt;volsize&amp;gt; -- Request ordered size\n")
   sys.exit (1)


args = len(sys.argv) - 1
if(args &amp;lt; 3):
    print_usage()

volname = sys.argv[1]
aggrname = sys.argv[2]
volsize = int(sys.argv[3]) * 1.17

s = NaServer("192.168.59.12", 1 , 0)
s.set_server_type("DFM")
s.set_transport_type("HTTPS")
s.set_port(8488)
#s.set_style("LOGIN")
s.set_admin_user("root", "start123")

# Connects to DFM-Proxy
proxyElem = NaElement("api-proxy")
proxyElem.child_add_string("target", "192.168.59.20")
proxyElem.child_add(requestElem)

# ONTAPI API arg set here
requestElem = NaElement("request")
requestElem.child_add_string("name", "volume-create")
requestElem.child_add_string("containing-aggr-name","aggr1")
requestElem.child_add_string("language-code","en_US")
requestElem.child_add_string("size","50m")
requestElem.child_add_string("space-reserve","none")
requestElem.child_add_string("volume","testPython1")
out = s.invoke_elem(proxyElem)

if (out.results_status() == 'failed'):
    print(out.results_reason())
    print ("Error : " + out.results_reason() + "\n")
    sys.exit (1)

dfmResponse = out.child_get('response')

if (dfmResponse.child_get_string('status') == 'failed'):
    print ("Error: " + dfmResponse.child_get_string("reason") + "\n")
    sys.exit (1)

ontapiResponse = dfmResponse.child_get('results')

if (ontapiResponse.results_status() == 'failed'):
    print (ontapiResponse.results_reason() + "\n")
    sys.exit (1)

print(ontapiResponse.sprintf())&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jun 2025 14:58:16 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/DFM-proxy-create-volume-python/m-p/131772#M2378</guid>
      <dc:creator>squall1988</dc:creator>
      <dc:date>2025-06-04T14:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: DFM proxy create volume python</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/DFM-proxy-create-volume-python/m-p/132075#M2395</link>
      <description>&lt;P&gt;Hi Daniel &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to make your code doing what you wish, you need to create a new element called "args" where you add the arguments of volume-create zapi call.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In case you face a problem with SSL certificate&amp;nbsp;verification, add 2 additional lines (3-4).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, the working code should look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import sys
# disable certificate verification in case of SSL certificate verification problem, comment out otherwise
import ssl
ssl._create_default_https_context = ssl._create_unverified_context

sys.path.append("/var/lib/NetApp/Python/")
from NaServer import *

def print_usage():
   print ("Usage: nfs-bis.py &amp;lt;volname&amp;gt; &amp;lt;aggrname&amp;gt; &amp;lt;volsize&amp;gt; \n")
   print ("&amp;lt;volname&amp;gt; -- Volume name to be created\n")
   print ("&amp;lt;aggrname&amp;gt; -- Aggregate name\n")
   print ("&amp;lt;volsize&amp;gt; -- Request ordered size\n")
   sys.exit (1)


args = len(sys.argv) - 1
if(args &amp;lt; 3):
    print_usage()

volname = sys.argv[1]
aggrname = sys.argv[2]
volsize = int(sys.argv[3]) * 1.17

s = NaServer("192.168.59.12", 1 , 0)
s.set_server_type("DFM")
s.set_transport_type("HTTPS")
s.set_port(8488)
#s.set_style("LOGIN")
s.set_admin_user("root", "start123")

# Connects to DFM-Proxy
proxyElem = NaElement("api-proxy")
proxyElem.child_add_string("target", "192.168.59.20")
proxyElem.child_add(requestElem)

# create element with volume-create arguments
volcreateArgs = NaElement("args")
volcreateArgs.child_add_string("volume","testPython1")
volcreateArgs.child_add_string("containing-aggr-name","aggr1")
volcreateArgs.child_add_string("language-code","en_US")
volcreateArgs.child_add_string("size","50m")
volcreateArgs.child_add_string("space-reserve","none")

# ONTAPI API arg set here
requestElem = NaElement("request")
requestElem.child_add_string("name", "volume-create")

# add arguments to volume-create zapi call
requestElem.child_add(volcreateArgs)
out = s.invoke_elem(proxyElem)

if (out.results_status() == 'failed'):
    print(out.results_reason())
    print ("Error : " + out.results_reason() + "\n")
    sys.exit (1)

dfmResponse = out.child_get('response')

if (dfmResponse.child_get_string('status') == 'failed'):
    print ("Error: " + dfmResponse.child_get_string("reason") + "\n")
    sys.exit (1)

ontapiResponse = dfmResponse.child_get('results')

if (ontapiResponse.results_status() == 'failed'):
    print (ontapiResponse.results_reason() + "\n")
    sys.exit (1)

print(ontapiResponse.sprintf())&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the result...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;## C4XXYYZZAA&amp;gt; vol status testPython1
##          Volume State           Status                Options
##     testPython1 online          raid_dp, flex         create_ucode=on, convert_ucode=on,
##                                 64-bit                guarantee=none, fractional_reserve=0
##                          Volume UUID: 4eccc808-9b0c-4cea-8d40-d7b5865a9e81
## 		Containing aggregate: 'aggr1'&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps ;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pavol&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 16:43:00 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/DFM-proxy-create-volume-python/m-p/132075#M2395</guid>
      <dc:creator>Palkoc</dc:creator>
      <dc:date>2017-06-20T16:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: DFM proxy create volume python</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/DFM-proxy-create-volume-python/m-p/132078#M2396</link>
      <description>&lt;P&gt;awesome. thanks alot. I figure out it was something missing becoz the filer logs shown that no argument was pass on. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 17:37:02 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/DFM-proxy-create-volume-python/m-p/132078#M2396</guid>
      <dc:creator>squall1988</dc:creator>
      <dc:date>2017-06-20T17:37:02Z</dc:date>
    </item>
  </channel>
</rss>

