vmware / PowerCLI-Example-Scripts

http://blogs.vmware.com/powercli
Other
743 stars 601 forks source link

Error while importing pool in json #618

Open GitH49 opened 10 months ago

GitH49 commented 10 months ago

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

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

triegler commented 7 months ago

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.