NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

ONTAP Rest API Discussions

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

kbhonagiri
1,749 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
1,232 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