Update VMware.HV.Helper.psm1

Adding new parameters for New-HVFarm function to configure the ComputeProfile of the VMs underlying a farm:
- NumCPU
- Ram
- CoresPerSocket 

Adding the use of the parameter ReusePreExistingAccounts for INSTANT_CLONE farm

Signed-off-by: Mathieu Desrosiers <desrosim@gmail.com>
This commit is contained in:
desrosim232
2023-04-21 10:31:32 -04:00
committed by GitHub
parent ee6e800726
commit ddc96d276e

View File

@@ -2140,6 +2140,15 @@ function New-HVFarm {
.PARAMETER Spec .PARAMETER Spec
Path of the JSON specification file. Path of the JSON specification file.
.PARAMETER NumCPU
Number of CPU of the Vm Instances
.PARAMETER Ram
Ram of the Vm Instances
.PARAMETER CoresPerSocket
CoresPerSocket of the Vm Instances
.PARAMETER HvServer .PARAMETER HvServer
Reference to Horizon View Server to query the farms from. If the value is not passed or null then first element from global:DefaultHVServers would be considered in-place of hvServer. Reference to Horizon View Server to query the farms from. If the value is not passed or null then first element from global:DefaultHVServers would be considered in-place of hvServer.
@@ -2339,6 +2348,24 @@ function New-HVFarm {
[int] [int]
$diskWriteLatencyThreshold = 0, $diskWriteLatencyThreshold = 0,
#farmSpec.automatedfarmSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.ComputeProfile
[Parameter(Mandatory = $false)]
[ValidateRange(1,[Int]::MaxValue)]
[int]
$NumCPU = 4,
#farmSpec.automatedfarmSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.ComputeProfile
[Parameter(Mandatory = $false)]
[ValidateRange(1,[Int]::MaxValue)]
[int]
$Ram = 16384,
#farmSpec.automatedfarmSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.ComputeProfile
[Parameter(Mandatory = $false)]
[ValidateRange(1,[Int]::MaxValue)]
[int]
$CoresPerSocket = 1,
#farmSpec.automatedfarmSpec.virtualCenter if LINKED_CLONE, INSTANT_CLONE #farmSpec.automatedfarmSpec.virtualCenter if LINKED_CLONE, INSTANT_CLONE
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")] [Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')] [Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
@@ -2499,6 +2526,7 @@ function New-HVFarm {
#farmSpec.automatedfarmSpec.customizationSettings.reusePreExistingAccounts #farmSpec.automatedfarmSpec.customizationSettings.reusePreExistingAccounts
[Parameter(Mandatory = $false,ParameterSetName = 'LINKED_CLONE')] [Parameter(Mandatory = $false,ParameterSetName = 'LINKED_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "INSTANT_CLONE")]
[Boolean] [Boolean]
$ReusePreExistingAccounts = $false, $ReusePreExistingAccounts = $false,
@@ -2639,6 +2667,7 @@ function New-HVFarm {
$powerOffScriptParameters = $jsonObject.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.PowerOffScriptParameters $powerOffScriptParameters = $jsonObject.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.PowerOffScriptParameters
$postSynchronizationScriptName = $jsonObject.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.PostSynchronizationScriptName $postSynchronizationScriptName = $jsonObject.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.PostSynchronizationScriptName
$postSynchronizationScriptParameters = $jsonObject.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.PostSynchronizationScriptParameters $postSynchronizationScriptParameters = $jsonObject.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.PostSynchronizationScriptParameters
$reusePreExistingAccounts = $jsonObject.AutomatedFarmSpec.CustomizationSettings.ReusePreExistingAccounts
} }
} elseif ($jsonObject.AutomatedFarmSpec.ProvisioningType -eq "VIEW_COMPOSER") { } elseif ($jsonObject.AutomatedFarmSpec.ProvisioningType -eq "VIEW_COMPOSER") {
$LinkedClone = $true $LinkedClone = $true
@@ -2824,6 +2853,10 @@ function New-HVFarm {
$farmSpecObj.AutomatedFarmSpec.RdsServerNamingSpec = $vmNamingSpec $farmSpecObj.AutomatedFarmSpec.RdsServerNamingSpec = $vmNamingSpec
} }
$farmSpecObj.AutomatedFarmSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.ComputeProfile.NumCPU = $NumCPU
$farmSpecObj.AutomatedFarmSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.ComputeProfile.Ram = $Ram
$farmSpecObj.AutomatedFarmSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.ComputeProfile.CoresPerSocket = $CoresPerSocket
# #
# build the VM LIST # build the VM LIST
# #
@@ -3238,6 +3271,7 @@ function Get-HVFarmCustomizationSetting {
$farmSpecObj.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.powerOffScriptParameters = $powerOffScriptParameters $farmSpecObj.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.powerOffScriptParameters = $powerOffScriptParameters
$farmSpecObj.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.postSynchronizationScriptName = $postSynchronizationScriptName $farmSpecObj.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.postSynchronizationScriptName = $postSynchronizationScriptName
$farmSpecObj.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.postSynchronizationScriptParameters = $postSynchronizationScriptParameters $farmSpecObj.AutomatedFarmSpec.CustomizationSettings.CloneprepCustomizationSettings.postSynchronizationScriptParameters = $postSynchronizationScriptParameters
$farmSpecObj.AutomatedFarmSpec.CustomizationSettings.ReusePreExistingAccounts = $reusePreExistingAccounts
$customObject = $farmSpecObj.AutomatedFarmSpec.CustomizationSettings $customObject = $farmSpecObj.AutomatedFarmSpec.CustomizationSettings
} elseif ($LinkedClone) { } elseif ($LinkedClone) {
$ViewComposerDomainAdministrator_service_helper = New-Object VMware.Hv.ViewComposerDomainAdministratorService $ViewComposerDomainAdministrator_service_helper = New-Object VMware.Hv.ViewComposerDomainAdministratorService
@@ -3301,8 +3335,7 @@ function Get-FarmSpec {
if ($farmType -eq 'AUTOMATED') { if ($farmType -eq 'AUTOMATED') {
$farm_spec_helper.getDataObject().AutomatedFarmSpec.RdsServerNamingSpec.PatternNamingSettings = $farm_helper.getFarmPatternNamingSettingsHelper().getDataObject() $farm_spec_helper.getDataObject().AutomatedFarmSpec.RdsServerNamingSpec.PatternNamingSettings = $farm_helper.getFarmPatternNamingSettingsHelper().getDataObject()
$farm_spec_helper.getDataObject().AutomatedFarmSpec.VirtualCenterProvisioningSettings.VirtualCenterStorageSettings.ViewComposerStorageSettings = $farm_helper.getFarmViewComposerStorageSettingsHelper().getDataObject() $farm_spec_helper.getDataObject().AutomatedFarmSpec.VirtualCenterProvisioningSettings.VirtualCenterStorageSettings.ViewComposerStorageSettings = $farm_helper.getFarmViewComposerStorageSettingsHelper().getDataObject()
$farm_spec_helper.getDataObject().AutomatedFarmSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.ComputeProfile = $farm_helper.getFarmComputeProfileSpecHelper().getDataObject()
} }
$farm_spec_helper.getDataObject().Data.Settings = $farm_helper.getFarmSessionSettingsHelper().getDataObject() $farm_spec_helper.getDataObject().Data.Settings = $farm_helper.getFarmSessionSettingsHelper().getDataObject()
$farm_spec_helper.getDataObject().Data.LbSettings = $farm_helper.getRDSHLoadBalancingSettingsHelper().getDataObject() $farm_spec_helper.getDataObject().Data.LbSettings = $farm_helper.getRDSHLoadBalancingSettingsHelper().getDataObject()
@@ -4485,6 +4518,8 @@ function New-HVPool {
$vmFolder = $jsonObject.AutomatedDesktopSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.VmFolder $vmFolder = $jsonObject.AutomatedDesktopSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.VmFolder
$hostOrCluster = $jsonObject.AutomatedDesktopSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.HostOrCluster $hostOrCluster = $jsonObject.AutomatedDesktopSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.HostOrCluster
$resourcePool = $jsonObject.AutomatedDesktopSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.ResourcePool $resourcePool = $jsonObject.AutomatedDesktopSpec.VirtualCenterProvisioningSettings.VirtualCenterProvisioningData.ResourcePool
$dataStoreList = $jsonObject.AutomatedDesktopSpec.VirtualCenterProvisioningSettings.VirtualCenterStorageSettings.Datastores $dataStoreList = $jsonObject.AutomatedDesktopSpec.VirtualCenterProvisioningSettings.VirtualCenterStorageSettings.Datastores
foreach ($dtStore in $dataStoreList) { foreach ($dtStore in $dataStoreList) {
$datastores += $dtStore.Datastore $datastores += $dtStore.Datastore