Been working on this a few hours now, but just can't seem to get it to work. Creating an organization with the Any(*) storage profile works, but as soon as i remove that profile and leave only the ones I want, it stops working.
vCenter 5.5
vCD 5.5
PowerCLI 5.5 R1
Here's the error:
PowerCLI D:\DC-DEV\Powershell> .\test2.ps1
storageprofilename
https://url/api/admin/extension/pvdcStorageProfile/34599474-b8ad-4000-8b3a-ac2a7a08a49b
Organization vDC Creation failed! The provider vdc does not contain the any storage policy.
PowerCLI D:\DC-DEV\Powershell>
Here's the code:
| | #Create a new vDC in the new Organization |
$adminVdc = New-Object VMware.VimAutomation.Cloud.Views.AdminVdc
$adminVdc.Name = $name
$adminVdc.IsEnabled = $Enabled
| | #ProviderVDC |
| | $providerVdc = Get-ProviderVdc $ProviderVDC |
$providerVdcRef = New-Object VMware.VimAutomation.Cloud.Views.Reference
$providerVdcRef.Href = $providerVdc.Href
$adminVdc.ProviderVdcReference =$providerVdcRef
$adminVdc.AllocationModel = $AllocationModel
| | #Storage Profile |
| | $adminVdc.VdcStorageProfiles = New-Object VMware.VimAutomation.Cloud.Views.VdcStorageProfiles |
| | $StorageProfileCIview = search-cloud ProviderVdcStorageProfile -name $StorageProfile | Get-CIView | | |
| | $StorageVdcRef = New-Object VMware.VimAutomation.Cloud.Views.Reference |
| | $StorageVdcRef.Href = $StorageProfileCIview.href |
| | $StorageVdcRef.Name = $StorageProfile |
| | write-host $StorageVdcRef.name |
| | write-host $StorageVdcRef.href |
| | $adminVdc.VdcStorageProfiles.VdcStorageProfile = $StorageVdcRef |
$adminVdc.ComputeCapacity = New-Object VMware.VimAutomation.Cloud.Views.ComputeCapacity
$adminVdc.ComputeCapacity.Cpu = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
$adminVdc.ComputeCapacity.Cpu.Units = "MHz"
$adminVdc.ComputeCapacity.Cpu.Limit = $CPULimit
$adminVdc.ComputeCapacity.Cpu.Allocated = $CPUAllocated
$adminVdc.ComputeCapacity.Memory = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
$adminVdc.ComputeCapacity.Memory.Units = "MB"
$adminVdc.ComputeCapacity.Memory.Limit = $MEMLimit
$adminVdc.ComputeCapacity.Memory.Allocated = $MEMAllocated
$adminVdc.StorageCapacity = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
$adminVdc.StorageCapacity.Units = "MB"
$adminVdc.StorageCapacity.Limit = $StorageLimit
$OrgED = (Get-Org $Org).ExtensionData
| | try { | |
| | | $orgVdc = $orgED.CreateVdc($adminVdc) |
| | } | |
| | catch [Exception] { | |
| | | $Exception = $_.Exception.Message |
| | } | |