Hi All,
I tried to acomplish simple task use the Python package, the code as follow.
Intend to put volume offline, and use volume uuid as a query. I run the program, it did not error, but, it does nothing.
The volume still online. Code and output as follow.
volume.patch(
{"state":"offline"},
uuid = 'b2c020e5-f9c7-11e9-ac22-005056b76245'
)
--------------------------------------------------------------------------------------------------
import netapp_ontap
from netapp_ontap import config
from netapp_ontap.host_connection import HostConnection
from netapp_ontap.resources import Volume, Snapshot,Svm
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
config.CONNECTION = HostConnection('cluster2.demo.netapp.com',username="admin",password="Netapp1!",verify=False)
volume = Volume.find(name='volm2_1')
print (volume.to_dict())
volume.patch(
{"state":"offline"},
uuid = 'b2c020e5-f9c7-11e9-ac22-005056b76245'
)
[root@rhel2 ~]# python3.7 volpatch.py
{'tiering': {'policy': 'none'}, 'type': 'rw', 'space': {'used': 851968, 'available': 19070976, 'size': 20971520}, 'clone': {'is_flexclone': False}, 'metric': {'throughput': {'other': 0, 'read': 0, 'total': 0, 'write': 0}, 'duration': 'PT15S', 'iops': {'other': 0, 'read': 0, 'total': 0, 'write': 0}, 'latency': {'other': 0, 'read': 0, 'total': 0, 'write': 0}, 'timestamp': '2019-10-30T01:51:45+00:00', 'status': 'ok'}, 'size': 20971520, 'aggregates': [{'uuid': 'e329b91b-0633-4186-8c8d-aa4c7191da16', 'name': 'aggr1_cluster2_01'}], 'snapshot_policy': {'name': 'default'}, 'uuid': 'b2c020e5-f9c7-11e9-ac22-005056b76245', 'state': 'online', 'comment': '', 'svm': {'uuid': '503ac2b8-acfe-11e9-8271-005056b03109', 'name': 'svm21'}, 'name': 'volm2_1', 'language': 'c.utf_8', 'nas': {'export_policy': {'name': 'default'}}, 'style': 'flexvol', 'create_time': '2019-10-28T21:12:50+00:00'}
[root@rhel2 ~]#