Python Discussions

cancel
Turn on suggestions
Showing results for
Search instead for
Did you mean:

Python Discussions

How to pull the snapshot size using PYTHON

SuneelT
‎2021年02月15日 03:17 AM
4,143 Views

Team,

I need to pull the size of the snapshot of a specific volume.

============ code ==========================================

##S1 and V1 are Snapshot and Volume objects which are already initialized before the below code.

S11=Snapshot.from_dict({'uuid':S1.uuid,'volume.uuid': V1.uuid})
S11.get()
print ("final snap==================")
print (S11)
print ("final snap==================")

==========================================================

Returns the below:

**********************************************************************************************************

final snap==================
Snapshot({'volume': {'uuid': '0207959e-b04b-11ea-b611-d039ea073d7a', '_links': {'self': {'href': '/api/storage/volumes/0207959e-b04b-11ea-b611-d039ea073d7a'}}, 'name': 'XXXXXX'}, 'name': 'weekly.2021年02月07日_0015', 'create_time': '2021-02-07T00:15:01+00:00', '_links': {'self': {'href': '/api/storage/volumes/0207959e-b04b-11ea-b611-d039ea073d7a/snapshots/15891d63-214a-4e7b-86da-942612280b39'}}, 'svm': {'uuid': '01a0b7f6-b04b-11ea-b611-d039ea073d7a', '_links': {'self': {'href': '/api/svm/svms/01a0b7f6-b04b-11ea-b611-d039ea073d7a'}}, 'name': 'XXXXX'}, 'uuid': '15891d63-214a-4e7b-86da-942612280b39'})
final snap==================

I am not able to get the size of the snapshot but getting all other details [ like name, creation_time etc].

Appreciate your help.

Thanks

Suneel

Appreciate if you

1 ACCEPTED SOLUTION

RobertBlackhart
‎2021年02月16日 03:23 AM
4,082 Views

The size property is not present in the 9.8 or prior versions of the API. It may come in a later release.

One thing you can do as a workaround is to use the CLI passthrough to get the information. Here's an example:

from netapp_ontap.resources import CLI
response = CLI().execute("snapshot show", snapshot=S1.name, volume=V1.name)
snapshot_size = response.http_response.json()["records"][0]["size"]
0 Kudos
3 REPLIES 3

RobertBlackhart
‎2021年02月16日 03:23 AM
4,083 Views

The size property is not present in the 9.8 or prior versions of the API. It may come in a later release.

One thing you can do as a workaround is to use the CLI passthrough to get the information. Here's an example:

from netapp_ontap.resources import CLI
response = CLI().execute("snapshot show", snapshot=S1.name, volume=V1.name)
snapshot_size = response.http_response.json()["records"][0]["size"]
0 Kudos

SuneelT
‎2021年02月16日 03:43 AM
4,078 Views

Thank you for the workaround, I will test it.

Atleast I now know that this is not available in current python modules, I have been trying different options 🙂

0 Kudos

ABisht
‎2024年10月20日 11:43 PM
1,531 Views

hey is this feature available now? I am lookng to get snapshot size via API. Please advice

0 Kudos
All Community Forums
Public

AltStyle によって変換されたページ (->オリジナル) /