VcFileManager.uploadFileToDatastore or how to upload vmdk file to URL in vRO/vCO


First question.

Can I use VcFileManager.uploadFileToDatastore() to upload a vmdk file as part of deploying VM? I am trying to write a script in vRealize Orchestrator to deploy a VM.

If yes I am trying to upload and for that I did this.



var vcFileManager = host.sdkConnection.VcFileManager;

vcFileManager.uploadFileToDatastore(datacenter,datastore, vmdk_path, datastore_path);


When I run I get this error. I believe I am passing the right arguments. Any comments on this?

[2016-01-14 09:41:14.770] [I]  vmdk path : /var/lib/vco/app-server/temp/ss-disk1.vmdk

[2016-01-14 09:41:14.770] [I]  Datastore path : /vmfs/volumes/sz-vol2-ds/ss-test1/ss-test1.vmdk

[2016-01-14 09:41:14.770] [I]  Datacenter  : DynamicWrapper (Instance) : [VcDatacenter]-[class com.vmware.vmo.plugin.vi4.model.VimDatacenter] -- VALUE : Datacenter<datacenter-42>'Central_DC'

[2016-01-14 09:41:14.770] [I]  Datastore  : DynamicWrapper (Instance) : [VcDatastore]-[class com.vmware.vmo.plugin.vi4.model.VimDatastore] -- VALUE : Datastore<datastore-75>'sz-vol2-ds'

[2016-01-14 09:41:14.780] [I] TypeError: Cannot call method "uploadFileToDatastore" of undefined (Workflow:test / Scriptable task (item1)#186)

Second question

If uploadFileToDatastore() is not the right way to upload a vmdk file, then does anyone have any link which can guide me in writing a script in vRealize Orchestrator to upload a vmdk file after acquiring NFC lease?

Thanks & Regards


0 Kudos
0 Replies