ONTAP Rest API Discussions

How to add a tag/annotation to existing volume using Python API

kbhonagiri
612 Views

Hello Community,

 

Do we have a way to patch volume with a tag or annotation. Ideally i'm looking for something like this to work. I"m looking to see  anything other than "comment" field.

>>> with HostConnection(host,username=username,password=password, verify=False):
... volume = Volume(uuid=volume_uuid)
... volume.tags = ["high-priority", "backup"]
... volume.patch()
... volume.get()
... print(volume.to_dict())

$ /usr/bin/pip3 show netapp-ontap
Name: netapp-ontap
Version: 9.12.1.0

 

Kalyan

1 REPLY 1

customernumber10
95 Views

I think Version 13 and up support tags.

from netapp_ontap import HostConnection
from netapp_ontap.resources import Volume

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = Volume(uuid="d0c3359c-5448-4a9b-a077-e3295a7e9057")
resource.tiering.object_tags = ["key1=val1", "key2=val2"]
resource.patch()

 

 

Public