Hi,
I am working in a project using VDDK API. I have been able to Connect, Open, Read and Write to VM virtual disks using VixDiskLib. But I have a problem using VixDiskLib_Clone() function to copy a vdisk. I have defined this function:
public static bool Clone(vixDiskSourceVixDisk, string SourceDiskPath, vixDisk TargetVixDisk, string TargetDiskPath, VixDiskLibProgressFunc ProgressFunc)
{
VixDiskLibCreateParams CreateParams = new VixDiskLibCreateParams();
CreateParams.adapterType = VixDiskLibAdapterType.VIXDISKLIB_ADAPTER_SCSI_LSILOGIC;
CreateParams.capacity = 20 * 2048;
CreateParams.diskType = VixDiskLibDiskType.VIXDISKLIB_DISK_MONOLITHIC_SPARSE;
CreateParams.hwVersion = vixDiskLib.VIXDISKLIB_HWVERSION_WORKSTATION_6;
IntPtr clientData = (IntPtr) null;
ulong ulStatus;
ulStatus = vixDiskLib.Clone(TargetVixDisk.VixConnHandle, TargetDiskPath, SourceVixDisk.VixConnHandle, SourceDiskPath, out CreateParams, ProgressFunc, clientData, true);
if (ulStatus != 0)
{
string msg = vixDisk.GetError(ulStatus);
return false;
}
return true;
}
If I define Target Server as blank "" to copy to local and call Clone() I get error: "invalid parameter was supplied"
TargetVmdkPath = @"C:\Users\Alberto\Desktop\vddk\test.vmdk";
TargetServer = "";
TargetVmxPath = "";
TargetDatacenter = "";
TargetDatastore = "";
TargetUser = "";
TargetPass= "";
TargetPort = 0;
If I define Target as ESX I can Connect,Open, Read.. disks in that ESX with Connect(), Open(), Read(). But when I call Clone() I get error: "Cannot connect to host" (17179887184) and I get this log in ESX hostd.log:
Event 155 : User root@127.0.0.1 logged in
FormatField: Invalid (vim.LicenseManager.DiagnosticInfo.key)
Task Created : haTask--vim.SearchIndex.findByInventoryPath-158510209
Task Completed : haTask--vim.SearchIndex.findByInventoryPath-158510209
Task Created : haTask--vim.SearchIndex.findByDatastorePath-158510210
Task Completed : haTask--vim.SearchIndex.findByDatastorePath-158510210
Task Created : haTask--vim.NfcService.randomAccessOpen-158510212
Task Completed : haTask--vim.NfcService.randomAccessOpen-158510212
Event 156 : User root logged out
Throw vim.fault.NotAuthenticated
PROXY connection to NFC(useSSL=0): found session ticket:[N9VimShared15NfcTicketByPathE:0xa1240b4]
NfcNetTcpGetSockFd: sockFd = 0, sSockFd = 53
NfcServerLoop: sockFd ready for READ
NfcServerLoop: Received session complete
(vim.fault.NotAuthenticated) {
dynamicType = ,
object = 'vmodl.query.PropertyCollector:ha-property-collector',
privilegeId = "System.View",
msg = ""
}
Failed to send response to the client: Broken pipe
I have imported the function in C# as:
public static extern System.UInt64 Clone(IntPtr dstConnection, string dstPath, IntPtr srcConnection, string srcPath, out VixDiskLibCreateParams vixCreateParams, VixDiskLibProgressFunc progressFunc, IntPtr progressCallbackData, bool overWrite);
Regards,
Alberto