I'm running into what seems like a bug when deploying a VM from template via New-VM to a Datastore Cluster while using the DiskStorageFormat option.
The following code throws an error:
New-VM -Name "testvm" -ResourcePool (Get-Cluster MyCluster1) -Datastore (Get-DatastoreCluster MyDatastoreCluster1) -Template (Get-Template MyTemplate) -DiskStorageFormat Thin
New-VM : 19.03.2014 12:51:11 | New-VM |
Required property datastore is missing from data object of type VirtualMachineRelocateSpecDiskLocator
while parsing serialized DataObject of type vim.vm.RelocateSpec.DiskLocator
at line 1, column 1073
while parsing property "disk" of static type ArrayOfVirtualMachineRelocateSpecDiskLocator
while parsing serialized DataObject of type vim.vm.RelocateSpec
at line 1, column 1017
while parsing property "location" of static type VirtualMachineRelocateSpec
while parsing serialized DataObject of type vim.vm.CloneSpec
at line 1, column 1006
while parsing property "cloneSpec" of static type VirtualMachineCloneSpec
while parsing serialized DataObject of type vim.storageDrs.StoragePlacementSpec
at line 1, column 324
while parsing call information for method RecommendDatastores
at line 1, column 218
while parsing SOAP body
at line 1, column 207
while parsing SOAP envelope
at line 1, column 38
while parsing HTTP request for method recommendDatastores
on object of type vim.StorageResourceManager
at line 1, column 0 | In Zeile:1 Zeichen:1 |
+ New-VM -Name "testvm" -ResourcePool ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo | : NotSpecified: (:) [New-VM], InvalidRequest | |
+ FullyQualifiedErrorId : Client20_VmServiceImpl_ApplySdrsRecommendation_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM |
Omitting -DiskStorageFormat however works fine:
New-VM -Name "testvm" -ResourcePool (Get-Cluster MyCluster1) -Datastore (Get-DatastoreCluster MyDatastoreCluster1) -Template (Get-Template MyTemplate)
Using a Datastore object instead of a DatastoreCluster object while keeping -DiskStorageFormat also works fine:
New-VM -Name "testvm" -ResourcePool (Get-Cluster MyCluster1) -Datastore (Get-DatastoreCluster MyDatastoreCluster1 | Get-Datastore | Select -first 1) -Template (Get-Template MyTemplate) -DiskStorageFormat Thin
It doesn't matter whether Thin, Thick or EagerzeroedThick is specified for DiskStorageFormat. Creating a new VM from scratch (no Template) also works fine in all cases
It worked without any issues before I upgraded to PowerCLI 5.5 R2. (Was using PowerCLI 5.1 R2 before)
Get-PowerCLIVersion
PowerCLI Version
----------------
VMware vSphere PowerCLI 5.5 Release 2 build 1671586
---------------
Snapin Versions
---------------
VMWare AutoDeploy PowerCLI Component 5.5 build 1598391
VMWare ImageBuilder PowerCLI Component 5.5 build 1598391
VMware License PowerCLI Component 5.5 build 1265954
VMware VDS PowerCLI Component 5.5 build 1671576
VMware VDS vSphere PowerCLI Component 4.1.1 build 000001
VMware vSphere PowerCLI Component 5.5 build 1671576
VMware vSphere Update Manager PowerCLI 5.1 build 782803
The target environment I'm connected to is running vCenter 5.1U2 and ESXi 5.1U2.
I can confirm, I get the same error messages.
Looks like you might have found an issue
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
VMware engineering is working on this issue and planning to release a fix with the next PowerCLI release.
I'm seeing the same error with PowerCLI 5.8 Release 1 build 2057893.
Hello all,
Any one knows if they are going to sort out this?
Is there any bug number open to follow?
Regards,
JJ
I'm seeing the same issue with the new 6.0 version of PowerCLI:
PowerCLI Version
----------------
VMware vSphere PowerCLI 6.0 Release 1 build 2548067
---------------
Component Versions
---------------
VMWare AutoDeploy PowerCLI Component 6.0 build 2358282
VMWare ImageBuilder PowerCLI Component 6.0 build 2358282
VMware License PowerCLI Component 6.0 build 2315846
VMware vSphere PowerCLI Component 6.0 build 2548068
VMware Cloud Infrastructure Suite PowerCLI Component 6.0 build 2548068
VMware VDS PowerCLI Component 6.0 build 2548068
VMware vCloud Director PowerCLI Component 6.0 build 2512755
VMware HA PowerCLI Component 6.0 build 2510422
VMware vCloud Air PowerCLI Component 6.0 build 2512755
VMware PowerCLI Component for Storage Management 6.0 build 2522368
Thanks,
I can confirm this is still an issue as well :smileycry:
Until the fix you can use meanwhile instead of get the datastore cluster:
Get-DatastoreCluster -Name ####
The command to get direct datastore with the most aviliable free space:
$DataStoreSystem = (Get-DatastoreCluster -Name ###### | Get-Datastore | sort -Property "FreeSpaceGB" -Descending)[0].name
Still a problem in 6.5.
The bug is still present in version PowerCLI 6.5.1.
still a bug in
PowerCLI Version
----------------
VMware PowerCLI 11.0.0 build 10380590
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component 6.5 build 6983166
VMware VimAutomation Core PowerCLI Component 6.5 build 6234650
VMware Licensing PowerCLI Component 6.5 build 5375648
VMware Vds PowerCLI Component 6.5 build 5374428
VMware Cloud PowerCLI Component 6.5 build 5375799
VMWare ImageBuilder PowerCLI Component 6.6 build 6997673
VMWare AutoDeploy PowerCLI Component 6.6 build 6997673