Create Remote Disk
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:
- Create a hosted disk VMDK with 2GB capacity, usingVixDiskLib_Create().
- Write image of the guest OS and application software into the VMDK, usingVixDiskLib_Write().
- 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.connectionandappGolbals.diskPathrepresent the remote VMDK on the ESXi host, whilesrcConnectionandappGlobals.srcPath represent the local hosted VMDK.
- Power on the new guest OS to get a new virtual machine.On Workstation, theVixVMPowerOn()function in the VIX API does this. For ESXi hosts, you must use thePowerOnVM_Taskmethod. As easy way to use this method is in the VMware vSphere Perl Toolkit, which has thePowerOnVM_Task()call (non-blocking), and thePowerOnVM()call (synchronous).
- Provision and deploy the new virtual machine on the ESXi host.