- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cloning always seems to cause problems for me.
Some questions I would like to pose to the community. I will continue to work on them in an attempt to solve them , but any help would be appreciated since I lack experience in this area.
Scenario:
(ESX 3.5 VI-Java SDK)
(Let's say) I have two datastores. The datastores, when viewed with the Datastore Browser have folders within them. These folders have VMs in them. (example. \[DS1\] folder/ folderWithVms/ vm.vmx)
Now what I want to be able to do is when cloning a VM to be able to specify what folder, on which Datastore it is going to be on.
I seem not to be able to do this.
And so I noticed the VirtualMachineRelocateSpec. Looking at it's params though it does not seem to go any lower then the datastore in terms of location.
The cloneVM_Task itself takes a Folder. Currently I am passing in the vmFolder. Is this where I should be passing in a more specific folder to the location where the VM is to go. If so how do I get a MOR to the folder from a datastore path?
Of course I may be way off in what I am trying to do.
Here is a snippet of code, that is used for cloning by me, currently the destination is the same as the source.
//baseRef previously set mor to machine to clone //vmFolder previously set mor to vmFolder of Datacenter //clone String name of clone VirtualMachineCloneSpec vmcs = new VirtualMachineCloneSpec(); VirtualMachineRelocateSpec vmrs = new VirtualMachineRelocateSpec(); vmcs.setLocation(vmrs); vmcs.setPowerOn(false); vmcs.setTemplate(false); ManagedObjectReference ref = connexion.cloneVM_Task(baseRef, vmFolder, clone, vmcs); |
Any help would be appreciated.
M@
Message was edited by: pomattic (changed to more descriptive thread name)