As stated in Support for Managed Disk, VixDiskLib_Create() does not support managed disk. To create a managed disk on the remote ESXi host, first create a hosted disk on the local Workstation, then convert the hosted disk into managed disk with VixDiskLib_Clone() over the network.

To create remote managed disk using the sample program, type the following commands:

./vix-disklib-sample -create -cap 1000000 virtdisk.vmdk

./vix-disklib-sample -clone virtdisk.vmdk -host esx3i -user root -password secret vmfsdisk.vmdk

You could write a virtual-machine provisioning application to perform the following steps:

1

Create a hosted disk VMDK with 2GB capacity, using VixDiskLib_Create().

2

Write image of the guest OS and application software into the VMDK, using VixDiskLib_Write().

3

Clone the hosted disk VMDK onto the VMFS file system of the ESXi host.

vixError = VixDiskLib_Clone(appGlobals.connection, appGlobals.diskPath,
               srcConnection, appGlobals.srcPath,
               &createParams, CloneProgressFunc, NULL, TRUE);

In this call, appGlobals.connection and appGolbals.diskPath represent the remote VMDK on the ESXi host, while srcConnection and appGlobals.srcPath represent the local hosted VMDK.

4

Power on the new guest OS to get a new virtual machine.

On Workstation, the VixVMPowerOn() function in the VIX API does this. For ESXi hosts, you must use the PowerOnVM_Task method. As easy way to use this method is in the VMware vSphere Perl Toolkit, which has the PowerOnVM_Task() call (non-blocking), and the PowerOnVM() call (synchronous).

5

Provision and deploy the new virtual machine on the ESXi host.