I have this small block of code that goes through each disk and sets it to thin provisioned while setting up the job spec.
if (_vmThinProvision) { ConverterStorageParamsManagedTargetDiskParams targetDiskParams = new ConverterStorageParamsManagedTargetDiskParams(); converterStorageParams.targetDiskParams = new ConverterStorageParamsTargetDiskParams[_computerInfo.hardwareInfo.storage.disk.Length]; for (int diskCount = 0; diskCount < _computerInfo.hardwareInfo.storage.disk.Length; diskCount++) { targetDiskParams.sourceDiskId = _computerInfo.hardwareInfo.storage.disk[diskCount].diskId; Console.WriteLine(targetDiskParams.sourceDiskId); targetDiskParams.diskType = "vmfsMonolithicFlatThinProvisioned"; targetDiskParams.datastoreName = _vmDatastoreName; converterStorageParams.targetDiskParams[diskCount] = targetDiskParams; } }
Lets take an example where a system has 3 disks. In the above code, if I just set up each disk manually instead of having it in a loop (same exact code, just taking the loop out and hard-coding the array index), it works fine. Each disk and volume gets its own ID and the conversion works properly.
For some reason when I implement the loop, it seems to pick the same disk 3 times instead of the 3 different disks and, as would be expected, confuses the heck out of the VSS service. See the log below from the source system.
2012-02-22T10:03:54.782-05:00 [05180 info 'task-29'] CloneTask::SetupTask 2012-02-22T10:03:54.782-05:00 [05180 info 'task-29'] CloneTask::InitializeSourceComputer 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] VolumeBasedCloneTask::CreateSubTasks: Creating SingleVolumeCloneTask subtask with used space of 122512128512 bytes and a contribution percentage of 33 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] VolumeBasedCloneTask::CreateSubTasks: Creating SingleVolumeCloneTask subtask with used space of 122512128512 bytes and a contribution percentage of 33 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] VolumeBasedCloneTask::CreateSubTasks: Creating SingleVolumeCloneTask subtask with used space of 122512128512 bytes and a contribution percentage of 33 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] SingleVolumeCloneTask: estimated time to clone volume [\WindowsBitmapDriverVolumeId=[69-A9-7F-F0-00-7E-00-00-00-00-00-00]] in seconds = 6074 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] SingleVolumeCloneTask: estimated time to clone volume [\WindowsBitmapDriverVolumeId=[69-A9-7F-F0-00-7E-00-00-00-00-00-00]] in seconds = 6074 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] SingleVolumeCloneTask: estimated time to clone volume [\WindowsBitmapDriverVolumeId=[69-A9-7F-F0-00-7E-00-00-00-00-00-00]] in seconds = 6074 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] CloneTask::InitializeTargetComputer 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] CloneTask updates, state: 1, percentage: 0, xfer rate (Bps): <unknown> 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] VolumeBasedCloneTask::StartNextTrackingBitmap: no bitmap ID specified for the next cloning iteration, will not track changes 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] VolumeBasedCloneTask::IsSnapshottingRequested: source volume snapshotting was requested 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] VolumeBasedCloneTask::CollectVolumeIdsToSnapshot: we will try to snapshot volume \WindowsBitmapDriverVolumeId=[69-A9-7F-F0-00-7E-00-00-00-00-00-00] 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] VolumeBasedCloneTask::CollectVolumeIdsToSnapshot: we will try to snapshot volume \WindowsBitmapDriverVolumeId=[69-A9-7F-F0-00-7E-00-00-00-00-00-00] 2012-02-22T10:03:55.251-05:00 [05180 info 'task-29'] VolumeBasedCloneTask::CollectVolumeIdsToSnapshot: we will try to snapshot volume \WindowsBitmapDriverVolumeId=[69-A9-7F-F0-00-7E-00-00-00-00-00-00] 2012-02-22T10:03:56.173-05:00 [05180 error 'task-29'] Converter::AtomicVssVolumeSnapshotSet::CreateSnapshotSet: VSS snapshot failed: Unable to create a snapshot for volume \\.\Volume{db72d0dc-4b08-11de-abf5-002219c7d318}, \\.\Volume{db72d0dc-4b08-11de-abf5-002219c7d318}, \\.\Volume{db72d0dc-4b08-11de-abf5-002219c7d318}. Error code 2147754765 (0x8004230D)
You may noticed I put a little console.writeline in there to show me the ID. They are different at that point. Sometime between there and the job submission process the IDs get all fudged up.
Again, if I just take out the loop and hard-code the indexes, it works fine. Any ideas? This one has really stumped me.
Thanks,