While trying to write a script to move our VMs to a newly created datastore cluster I discovered a bug in PowerCLI. The issue only comes into play when trying to convert to thin provisioning. I am using PowerCLI 5.1 Release 1 build 793510.
If you run this command you get a giant trace stack:
Running the same command without the -DiskStorageFormat flag will work fine:
Also if you run the command with the thin provision flag against a datastore and not a datastore cluster it works fine as well:
I posted on the VMware PowerCLI forum and it was confirmed that this was a bug.
Commenter LucD (http://www.lucd.info/) used Onyx to discover that the cmdlet fills in the RelocateSpec.disk property while the SDK Reference seems to say “RelocateSpec.disk.datastore; the fields should be unset if the user wants SDRS recommendations“. If I do the call with an empty RelocateSpec.disk property, the method works without a problem.
He also came up with this work around:
This worked great to get around the issue. I will be posting soon outlining why I needed to do this 🙂