Hi,
I have a code which opens a VMware disk for read. The code is working properly in 5.x now. But the code is failing in 4.x - failing here is not returning an error, but crashing and I have no clue what is happening.
1. This was a tested code on 4.x and 5.x before have no idea what changed.
2. For debugging I took the VixDiskSample.exe that comes as part of the VDDK and that too crashes in the same call(VixDiskLib_Open).
Following is the sequence of steps I followed for the disk open:
std::string strVmxSpec;
VixDiskLibConnectParams vixDiskLibConnectParams;
::memset(&vixDiskLibConnectParams,0,sizeof(VixDiskLibConnectParams));
vixDiskLibConnectParams.serverName = const_cast<char*>(strServerName.c_str());
vixDiskLibConnectParams.creds.uid.userName = const_cast<char*>(strUserName.c_str());
vixDiskLibConnectParams.creds.uid.password = const_cast<char*>(strPassword.c_str());
vixDiskLibConnectParams.credType = VIXDISKLIB_CRED_UID;
// vmxSpec is of the format [datastore]vmname/vmdkfilename.vmdk
vixDiskLibConnectParams.vmxSpec = const_cast<char*>(strVmxSpec.c_str());
vixDiskLibConnectParams.port = iPortNumber;
VixError vixError = ::VixDiskLib_Connect((const VixDiskLibConnectParams *)&vixDiskLibConnectParams,&_DiskLibConnection);
CHECK_AND_THROW(vixError);
// The crash happens in the below line
VixError vixError = ::VixDiskLib_Open(_DiskLibConnection, strDiskPath.c_str(), iOpenFlags, pDiskHandle);
RETURN_VIXERROR_IF_FAILED(vixError);
The VixDiskLibSample.exe code too crashes in the same function call, but works with 5.x. So I modified the code like this to take the VMmoref and snapshomofer like this (both VMMoref and snapshotmoref are correct and verified from the web interface)
strVmxSpec = "moref=" + strVMName;
vixDiskLibConnectParams.vmxSpec = const_cast<char*>(strVmxSpec.c_str());
vixDiskLibConnectParams.port = iPortNumber;
Bool ro = (appGlobals.openFlags & VIXDISKLIB_FLAG_OPEN_READ_ONLY);
VixError vixError = VixDiskLib_ConnectEx(&vixDiskLibConnectParams, ro, const_cast<char*>(snapmoref.c_str()),
NULL, &_DiskLibConnection);
CHECK_AND_THROW(vixError);
Can someone tell me what could be the problem? Since VixDiskSample.exe is not my code I am assuming that other people might have noticed this problem.
Thanks,
./Siva.