18.08.2013 Views

Virtual Disk API Programming Guide - Documentation - VMware

Virtual Disk API Programming Guide - Documentation - VMware

Virtual Disk API Programming Guide - Documentation - VMware

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Change the Parent for a <strong>Disk</strong><br />

<strong>Virtual</strong> <strong>Disk</strong> <strong>API</strong> Functions<br />

Vix<strong>Disk</strong>Lib_Reparent() changes the parent for the disk path to the given string value. The VMDK file name<br />

must be an absolute path. The parentHint could be the file name of the parent disk. If the function succeeds,<br />

the function returns VIX_OK. Otherwise, the appropriate VIX error code is returned. This function is available<br />

only for hosted disk in new releases.<br />

vixError =<br />

Vix<strong>Disk</strong>Lib_Reparent(Vix<strong>Disk</strong>LibConnection connection, const char *path, const char *parentHint);<br />

Shut Down<br />

All <strong>Virtual</strong> <strong>Disk</strong> <strong>API</strong> applications should call these functions at end of program.<br />

Disconnect from Server<br />

Vix<strong>Disk</strong>Lib_Disconnect() breaks an existing connection.<br />

Vix<strong>Disk</strong>Lib_Disconnect(srcConnection);<br />

Clean Up and Exit<br />

Vix<strong>Disk</strong>Lib_Exit() cleans up the library before exit.<br />

Vix<strong>Disk</strong>Lib_Exit();<br />

Advanced Transport <strong>API</strong>s<br />

For managed disk, the first release of VDDK required network access ESX/ESXi host (LAN or NBD transport).<br />

With VDDK 1.1 programs can access virtual disks directly on a storage device, LAN‐free. Direct SAN access<br />

increases I/O performance. To select the most efficient transport method, a set of <strong>API</strong>s is available, including:<br />

Vix<strong>Disk</strong>Lib_InitEx() – Initializes the advanced transport library. You must specify the library location.<br />

Replaces Vix<strong>Disk</strong>Lib_Init() in your application.<br />

Vix<strong>Disk</strong>Lib_ListTransportModes() – Lists transport modes that the virtual disk library supports.<br />

Vix<strong>Disk</strong>Lib_ConnectEx() – Establishes a connection using the best transport mode available, or one you<br />

select, to access a given machine’s virtual disk. Currently it does not check validity of transport type.<br />

Replaces Vix<strong>Disk</strong>Lib_Connect() in your application.<br />

Initialize <strong>Virtual</strong> <strong>Disk</strong> <strong>API</strong><br />

Replacing Vix<strong>Disk</strong>Lib_Init(), Vix<strong>Disk</strong>Lib_InitEx() initializes new releases of the library, Parameters are<br />

similar, except you should specify an actual libDir, and the new configFile parameter. For multithreaded<br />

programming, you should write your own logFunc, because the default logging function is not thread‐safe.<br />

On Windows, *libDir could be C:\Program Files\<strong>VMware</strong>\<strong>VMware</strong> <strong>Virtual</strong> <strong>Disk</strong> Development Kit.<br />

On Linux, *libDir is probably /usr/lib/vmware-vix-disklib.<br />

VixError vixErr = Vix<strong>Disk</strong>Lib_InitEx(majorVersion, minorVersion, &logFunc, &warnFunc, &panicFunc,<br />

*libDir, *configFile);<br />

Logged messages appear by default in a temporary folder or log directory, for VDDK and for many other<br />

<strong>VMware</strong> products. See “Location of Log Files” on page 37.<br />

The currently supported entries in the configFile are listed below. The correct way to specify a configuration<br />

is name=value. See Example 4‐1 for a sample configuration file.<br />

tmpDirectory = ""<br />

vix<strong>Disk</strong>Lib.transport.LogLevel – Overrides the default logging for vix<strong>Disk</strong>Lib transport functions<br />

(not including NFC). The default value is 6. The range is 0 to 6, where 6 is most verbose and 0 is quiet.<br />

The following NFC related options override the default numbers provided to the various NFC functions.<br />

Timeout values are stored in a 32‐bit field, so the maximum timeout you may specify is 2G (2,147,483,648).<br />

<strong>VMware</strong>, Inc. 35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!