<?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 Cannot print Volume size (netapp ontap REST API ) in ONTAP Discussions</title>
    <link>https://community.netapp.com/t5/ONTAP-Discussions/Cannot-print-Volume-size-netapp-ontap-REST-API/m-p/436315#M40861</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to monitor our Netapp environment with the python client library.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using this command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;setup_connection("hostnamex", "usernamex", "passwordx")

for volume in Volume.get_collection(fields="size"):
    print(volume)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following output:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Volume({'size': 4369924096, 'name': 'namexyz', 'uuid': 'uuidxyz', '_links': {'self': {'href': '/api/storage/volumes/uuidxyz'}}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now if I just want to print the volume name I can do the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for volume in Volume.get_collection(fields="size"):
    print(volume.name)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I try to do the same for the size attribute:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;setup_connection("hostnamex", "usernamex", "passwordx")

for volume in Volume.get_collection(fields="size"):
    print(volume.size)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this error:&lt;/P&gt;&lt;P&gt;File "C:\python\lib\site-packages\netapp_ontap\resource.py", line 274, in __getattribute__&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;raise AttributeError(&lt;BR /&gt;AttributeError: The 'size' field has not been set on the Volume. Try refreshing the object by calling get() or set the field 'size'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is printing the size attribute not possible, or am I doing something wrong? (I'm new to python)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jun 2025 09:59:22 GMT</pubDate>
    <dc:creator>technologieservices</dc:creator>
    <dc:date>2025-06-04T09:59:22Z</dc:date>
    <item>
      <title>Cannot print Volume size (netapp ontap REST API )</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Cannot-print-Volume-size-netapp-ontap-REST-API/m-p/436315#M40861</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to monitor our Netapp environment with the python client library.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using this command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;setup_connection("hostnamex", "usernamex", "passwordx")

for volume in Volume.get_collection(fields="size"):
    print(volume)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following output:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Volume({'size': 4369924096, 'name': 'namexyz', 'uuid': 'uuidxyz', '_links': {'self': {'href': '/api/storage/volumes/uuidxyz'}}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now if I just want to print the volume name I can do the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for volume in Volume.get_collection(fields="size"):
    print(volume.name)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I try to do the same for the size attribute:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;setup_connection("hostnamex", "usernamex", "passwordx")

for volume in Volume.get_collection(fields="size"):
    print(volume.size)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this error:&lt;/P&gt;&lt;P&gt;File "C:\python\lib\site-packages\netapp_ontap\resource.py", line 274, in __getattribute__&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;raise AttributeError(&lt;BR /&gt;AttributeError: The 'size' field has not been set on the Volume. Try refreshing the object by calling get() or set the field 'size'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is printing the size attribute not possible, or am I doing something wrong? (I'm new to python)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 09:59:22 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Cannot-print-Volume-size-netapp-ontap-REST-API/m-p/436315#M40861</guid>
      <dc:creator>technologieservices</dc:creator>
      <dc:date>2025-06-04T09:59:22Z</dc:date>
    </item>
  </channel>
</rss>

