Software Development Kit (SDK) and API Discussions

Changing the export policy on clone volume creation

moriad01
1,628 Views

Hi all,

 

I have a python script to create a clone of a volume but I noticed that the clone inherits the export poilcy from the parent volume but I would like to change that within the script to an exports policy that is built specifically for this new clone.

I played with volume-modify-iter but nothing I input into that portion of the script seems to take.

Any ideas on how to change that export policy while creating the volume clone?

This is the portion of my script that creates the clone:

 

name = "/vol/"+sys.argv[3]
parent = sys.argv[4]
snap = sys.argv[5]
output = s.invoke("volume-clone-create", "volume", vol, "parent-volume", parent, "parent-snapshot", snap, "junction-path", name)

 

1 REPLY 1

francoisbnc
1,574 Views

You cannot change export during vol-clone-create operation, but you can use this to change export policy after cloning, qtree will be "" if you export at volume level.

 

s = NaServer("<server name or IP address>", 1 , 31)
s.set_server_type("FILER")
s.set_transport_type("HTTPS")
s.set_port(443)
s.set_style("LOGIN")
s.set_admin_user("<user name>", "<password>")


api = NaElement("qtree-modify")
api.child_add_string("export-policy","<export-policy>")
api.child_add_string("qtree","<qtree>")
api.child_add_string("volume","<volume>")

xo = s.invoke_elem(api)

 

Public