How to clone a VM to a specific Datastore?

1.6k Views Asked by At

I would like to use pyvmomi to clone VMs and attach it to specific datastore (specifically with most free space).

I couldn't find a solution for this in pysphere therefore I trying luck with pyvmomi but the it seems that learning curve for this library is a bit steeper.

Any help?

1

There are 1 best solutions below

0
On

pyvmomi gives you access to everything in the VMware vSphere API Reference Documentation. This includes all the methods for cloning VMs from templates and specifying the datastore. Specifically take a look at VirtualMachineRelocateSpec which is a parameter to RelocateVM_Task (the method you will need to clone the VM).