VMware {code} Community
wulikanhua
Contributor
Contributor

How to use DoClone?

I scanned VirtualDiskAPIprogramming,but I am not find how to use clone such as  ./vix-disklib-sample -clone -option,someone can help me?

thanks

Reply
0 Kudos
1 Reply
cyberpaul
Enthusiast
Enthusiast

A bit late, but here's an example of a complete command:

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

Under the hood it looks like this:

VixDiskLibCreateParams createParams;

createParams.adapterType = appGlobals.adapterType;

createParams.capacity = appGlobals.mbSize * 2048;

createParams.diskType = VIXDISKLIB_DISK_MONOLITHIC_SPARSE;

createParams.hwVersion = VIXDISKLIB_HWVERSION_WORKSTATION_5;

vixError = VixDiskLib_Clone(targetConnection, targetDiskPath, srcConnection, srcDiskPath,

    &createParams,     // disk creation params, this parameter is ignored when connecting to a remote host

    CloneProgressFunc, // function to watch progress with

    NULL,              // client data, typically null

    TRUE);             // overwrite if target exists

The VixDiskLib_Clone functions creates an additional connection which can be a source of problems. Several people have reported the example itself not working with some versions of VDDK 🙂

Cheers, Pavel

Reply
0 Kudos