Hello everybody.
I have little question: How should I use this function to create virtual disk on ESX server?
What machine I have to specify in connection parameters? What exactly path to the disk have to be?
I have machine with moref 256 registered. It has path "[datastore1] Ubuntu/Ubuntu.vmx"
All goes fine, but function VixDiskLib_Create() return Error code 3 with text "One of the parameters was invalid".
My code:
char tempStr[MAX_PATH];
VixError vixError;
StringCbCopy(VixConnectParams.serverName,24,"192.168.1.240");
StringCbCopy(VixConnectParams.creds.uid.userName,21,"login");
StringCbCopy(VixConnectParams.creds.uid.password,128,"password");
VixConnectParams.port = 902;
VixConnectParams.credType=VIXDISKLIB_CRED_UID;
StringCbCopy(tempStr,MAX_PATH,"moref=256");
VixConnectParams.vmxSpec=tempStr;
vixError= VixDiskLib_InitEx(1,
0,
NULL,
NULL,
NULL,
NULL,
NULL);
if(vixError!=VIX_OK)
return false;
vixError= VixDiskLib_ConnectEx(&VixConnectParams,
false,
NULL,
NULL,
&VixConnection);
if(vixError!=VIX_OK)
return false;
VixDiskLibCreateParams createParams;
createParams.adapterType=VIXDISKLIB_ADAPTER_SCSI_LSILOGIC;
createParams.capacity=536870912;
createParams.diskType=VIXDISKLIB_DISK_MONOLITHIC_SPARSE;
createParams.hwVersion=VIXDISKLIB_HWVERSION_CURRENT;
//opening disk
vixError=VixDiskLib_Create(VixConnection,
"[datastore1] Ubuntu/test.vmdk",
&createParams,
NULL,
NULL);
if(vixError!=VIX_OK)
{
char *r=VixDiskLib_GetErrorText(vixError,NULL);
return false;
}