Reply to Message

View discussion in a popup

Replying to:
pomattic
Contributor
Contributor

Alright so one step further.

I can clone from a datastore to another one now. Using this:

VirtualMachineCloneSpec vmcs = new VirtualMachineCloneSpec();

VirtualMachineRelocateSpec vmrs = new VirtualMachineRelocateSpec();

vmrs.setDatastore(dataStore); // mor ref to datastore

vmrs.setHost(findHostByName(serverName)); // findInventoryPath is used

vmrs.setPool(getResourcePool(serverName));

vmcs.setLocation(vmrs);

vmcs.setPowerOn(false);

vmcs.setTemplate(false);

ManagedObjectReference ref = connexion.cloneVM_Task(baseRef, vmFolder, clone, vmcs);

getResourcePool(serverName) is a method written with help from the solution found at: http://communities.vmware.com/thread/100144

So now if I can figure out this folder thing we will be good! : )

M@

Reply
0 Kudos