PowerCLI-Example-Scripts icon indicating copy to clipboard operation
PowerCLI-Example-Scripts copied to clipboard

Error while importing pool in json

Open GitH49 opened this issue 2 years ago • 1 comments
trafficstars

Describe the bug

Hi,

When importing a pool with powershell in json format, this error appears :

Exception lors de l'appel de « Desktop_Create » avec « 2 » argument(s) : « ExceptionType : VMware.Hv.InvalidArgument ErrorMessage : A null value is invalid. ParameterName : automatedDesktopSpec.virtualCenterProvisioningSettings.virtualCenterStorageSettings.viewStorageAcceleratorSettings.viewComposerDiskTypes » C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.Hv.Helper.psm1:5008 : 7

  • $id = $desktop_helper.Desktop_create($services,$desktopSpecObj)
  • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
  • FullyQualifiedErrorId : VimException

This seems related to a null value in the json file ?

The property automatedDesktopSpec.virtualCenterProvisioningSettings.virtualCenterStorageSettings.viewStorageAcceleratorSettings.viewComposerDiskTypes is not null for this pool.

Reproduction steps

Export a pool in json format then create a new pool using powershell.

Expected behavior

The cmdlet is obviously supposed to create the pool but whatever.

Additional context

No response

GitH49 avatar Sep 01 '23 14:09 GitH49

I fixed this by modifying the function Get-HVPoolStorageObject in VMware.HV.Helper.psm1. This function should start at line 5382 (I think), and the line I modified was at 5405, from this: if ($LinkedClone) {

To this: if ($LinkedClone -or $InstantClone) {

Then force re-import the module: Import-Module VMware.HV.Helper -force

That should fix it.

triegler avatar Dec 07 '23 16:12 triegler