10 Replies Latest reply on Jan 16, 2019 10:50 PM by CloudServices

    Error when specifying DiskStorageFormat during Template deployment in PowerCLI 5.5 R2

    MKguy Virtuoso

      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.