Hi, i need to use the sdk to create a p2v job of a physical machine but only cloning the c: volume, so i used the dot net sample, wich is made for vs 2005, with visual c# 2005.
so i added this code:
ConverterStorageParams converterStorageParams = new ConverterStorageParams();
converterStorageParams.cloningMode = "volumeBasedCloning";
ConverterComputerSpec computerSpec = new ConverterComputerSpec();
computerSpec.location = Common.BuildLiveSourceLocation(_sourceName, _sourceUsername, _sourcePassword,
_sourceOsType, false, "");
ConverterComputerInfo computerInfo = _converterServer._converterService.ConverterQuery(_converterServer._converterServerContent.queryManager, computerSpec);
for (int diskcount = 0; diskcount < computerInfo.osInfo.logicalVolumeInfo.Length; diskcount++)
{
if (computerInfo.osInfo.logicalVolumeInfo[diskcount].mountPoint[0] == "C:")
{
ConverterStorageParamsVolumeCloningParams volume;
volume = new ConverterStorageParamsVolumeCloningParams();
volume.resize = false;
volume.sourceVolumeId = computerInfo.osInfo.logicalVolumeInfo[diskcount].volumeId;
ConverterStorageParamsTargetDiskParams targetdisk ;
targetdisk = new ConverterStorageParamsTargetDiskParams();
targetdisk.volumesToClone = volume;
converterStorageParams.targetDiskParams[0] = targetdisk;
}
}
cloningParams.storageParams = converterStorageParams;
when i use this syntax vc# tell me that i cannot implicitly convert ConverterStorageParamsVolumeCloningParams to ConverterStorageParamsVolumeCloningParams[]
so i searched the web and tried using the syntax used in this post:
https://communities.vmware.com/thread/282496?start=0&tstart=0
but vc# cast me that it's a bad array declaration and that i've to put the bracket on the object type.
Sadly when i put the bracket on the object type vc# tells me that the array type don't contain a resize or sourcevolumeID property.
i'm kind of running in circle, so can anyone tell me the good syntax for this code to work?