Following code convention. do not name variables having _

Renamed SCHEDULEDMAINTENANCE operation to SCHEDULED_MAINTENANCE  and
CANCELMAINTENANCE to CANCEL_MAINTENANCE
This commit is contained in:
vkg1215
2017-01-23 14:36:26 +05:30
committed by praveenmathamsetty
parent 142e6361ef
commit a15c61cedf

View File

@@ -1941,7 +1941,7 @@ function New-HVFarm {
New-HVFarm -Spec C:\VMWare\Specs\LinkedClone.json -Confirm:$false New-HVFarm -Spec C:\VMWare\Specs\LinkedClone.json -Confirm:$false
.EXAMPLE .EXAMPLE
Creates new linkedClone farm by using json file Creates new instantClone farm by using json file
New-HVFarm -Spec C:\VMWare\Specs\InstantCloneFarm.json -Confirm:$false New-HVFarm -Spec C:\VMWare\Specs\InstantCloneFarm.json -Confirm:$false
.EXAMPLE .EXAMPLE
@@ -5810,14 +5810,14 @@ function Start-HVFarm {
.PARAMETER Recompose .PARAMETER Recompose
Switch for recompose operation. Requests a recompose of RDS Servers in the specified 'AUTOMATED' farm. This marks the RDS Servers for recompose, which is performed asynchronously. Switch for recompose operation. Requests a recompose of RDS Servers in the specified 'AUTOMATED' farm. This marks the RDS Servers for recompose, which is performed asynchronously.
.PARAMETER Schedule_Maintenance .PARAMETER ScheduleMaintenance
Switch for Schedule_Maintenance operation. Requests for scheduling maintenance operation on RDS Servers in the specified Instant clone farm. This marks the RDS Servers for scheduled maintenance, which is performed according to the schedule. Switch for ScheduleMaintenance operation. Requests for scheduling maintenance operation on RDS Servers in the specified Instant clone farm. This marks the RDS Servers for scheduled maintenance, which is performed according to the schedule.
.PARAMETER Cancel_Maintenance .PARAMETER CancelMaintenance
Switch for cancelling maintenance operation. Requests for cancelling a scheduled maintenance operation on the specified Instant clone farm. This stops further maintenance operation on the given farm. Switch for cancelling maintenance operation. Requests for cancelling a scheduled maintenance operation on the specified Instant clone farm. This stops further maintenance operation on the given farm.
.PARAMETER StartTime .PARAMETER StartTime
Specifies when to start the recompose/Schedule_Maintenance operation. If unset, the recompose operation will begin immediately. Specifies when to start the recompose/ScheduleMaintenance operation. If unset, the recompose operation will begin immediately.
For IMMEDIATE maintenance if unset, maintenance will begin immediately. For RECURRING maintenance if unset, will be calculated based on recurring maintenance configuration. If in the past, maintenance will begin immediately. For IMMEDIATE maintenance if unset, maintenance will begin immediately. For RECURRING maintenance if unset, will be calculated based on recurring maintenance configuration. If in the past, maintenance will begin immediately.
.PARAMETER LogoffSetting .PARAMETER LogoffSetting
@@ -5877,16 +5877,16 @@ function Start-HVFarm {
Start-HVFarm -Farm 'Farm-01' -Recompose -LogoffSetting 'FORCE_LOGOFF' -ParentVM 'ParentVM' -SnapshotVM 'SnapshotVM' -StartTime $myTime Start-HVFarm -Farm 'Farm-01' -Recompose -LogoffSetting 'FORCE_LOGOFF' -ParentVM 'ParentVM' -SnapshotVM 'SnapshotVM' -StartTime $myTime
.EXAMPLE .EXAMPLE
Requests a Schedule_Maintenance task for instant-clone farm. Schedules an IMMEDIATE maintenance. Requests a ScheduleMaintenance task for instant-clone farm. Schedules an IMMEDIATE maintenance.
Start-HVFarm -Farm 'ICFarm-01' -Schedule_Maintenance -MaintenanceMode IMMEDIATE Start-HVFarm -Farm 'ICFarm-01' -ScheduleMaintenance -MaintenanceMode IMMEDIATE
.EXAMPLE .EXAMPLE
Requests a Schedule_Maintenance task for instant-clone farm. Schedules a recurring weekly maintenace every Saturday night at 23:30 and updates the parentVM and snapshot. Requests a ScheduleMaintenance task for instant-clone farm. Schedules a recurring weekly maintenace every Saturday night at 23:30 and updates the parentVM and snapshot.
Start-HVFarm -Schedule_Maintenance -Farm 'ICFarm-01' -MaintenanceMode RECURRING -MaintenancePeriod WEEKLY -MaintenanceStartTime '11:30' -StartInt 6 -EveryInt 1 -ParentVM 'vm-rdsh-ic' -SnapshotVM 'Snap_Updated' Start-HVFarm -ScheduleMaintenance -Farm 'ICFarm-01' -MaintenanceMode RECURRING -MaintenancePeriod WEEKLY -MaintenanceStartTime '11:30' -StartInt 6 -EveryInt 1 -ParentVM 'vm-rdsh-ic' -SnapshotVM 'Snap_Updated'
.EXAMPLE .EXAMPLE
Requests a Cancel_Maintenance task for instant-clone farm. Cancels recurring maintenance. Requests a CancelMaintenance task for instant-clone farm. Cancels recurring maintenance.
Start-HVFarm -Cancel_Maintenance -Farm 'ICFarm-01' -MaintenanceMode RECURRING Start-HVFarm -CancelMaintenance -Farm 'ICFarm-01' -MaintenanceMode RECURRING
.OUTPUTS .OUTPUTS
None None
@@ -5913,58 +5913,58 @@ function Start-HVFarm {
[Parameter(Mandatory = $false,ParameterSetName = 'RECOMPOSE')] [Parameter(Mandatory = $false,ParameterSetName = 'RECOMPOSE')]
[switch]$Recompose, [switch]$Recompose,
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[switch]$Schedule_Maintenance, [switch]$ScheduleMaintenance,
[Parameter(Mandatory = $false,ParameterSetName = 'CANCEL_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'CANCELMAINTENANCE')]
[switch]$Cancel_Maintenance, [switch]$CancelMaintenance,
[Parameter(Mandatory = $false,ParameterSetName = 'RECOMPOSE')] [Parameter(Mandatory = $false,ParameterSetName = 'RECOMPOSE')]
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[System.DateTime]$StartTime, [System.DateTime]$StartTime,
[Parameter(Mandatory = $true,ParameterSetName = 'RECOMPOSE')] [Parameter(Mandatory = $true,ParameterSetName = 'RECOMPOSE')]
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[ValidateSet('FORCE_LOGOFF','WAIT_FOR_LOGOFF')] [ValidateSet('FORCE_LOGOFF','WAIT_FOR_LOGOFF')]
[string]$LogoffSetting = 'FORCE_LOGOFF', [string]$LogoffSetting = 'FORCE_LOGOFF',
[Parameter(Mandatory = $false,ParameterSetName = 'RECOMPOSE')] [Parameter(Mandatory = $false,ParameterSetName = 'RECOMPOSE')]
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[boolean]$StopOnFirstError = $true, [boolean]$StopOnFirstError = $true,
[Parameter(Mandatory = $false,ParameterSetName = 'RECOMPOSE')] [Parameter(Mandatory = $false,ParameterSetName = 'RECOMPOSE')]
[string []]$Servers, [string []]$Servers,
[Parameter(Mandatory = $true,ParameterSetName = 'RECOMPOSE')] [Parameter(Mandatory = $true,ParameterSetName = 'RECOMPOSE')]
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[string]$ParentVM, [string]$ParentVM,
[Parameter(Mandatory = $true,ParameterSetName = 'RECOMPOSE')] [Parameter(Mandatory = $true,ParameterSetName = 'RECOMPOSE')]
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[string]$SnapshotVM, [string]$SnapshotVM,
[Parameter(Mandatory = $false,ParameterSetName = 'RECOMPOSE')] [Parameter(Mandatory = $false,ParameterSetName = 'RECOMPOSE')]
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[string]$Vcenter, [string]$Vcenter,
[Parameter(Mandatory = $true,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $true,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[Parameter(Mandatory = $true,ParameterSetName = 'CANCEL_MAINTENANCE')] [Parameter(Mandatory = $true,ParameterSetName = 'CANCELMAINTENANCE')]
[ValidateSet('IMMEDIATE','RECURRING')] [ValidateSet('IMMEDIATE','RECURRING')]
[string]$MaintenanceMode, [string]$MaintenanceMode,
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[ValidatePattern('^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$')] [ValidatePattern('^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$')]
[string]$MaintenanceStartTime, [string]$MaintenanceStartTime,
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[ValidateSet('DAILY','WEEKLY','MONTHLY')] [ValidateSet('DAILY','WEEKLY','MONTHLY')]
[string]$MaintenancePeriod, [string]$MaintenancePeriod,
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[ValidateRange(1, 31)] [ValidateRange(1, 31)]
[int]$StartInt, [int]$StartInt,
[Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULE_MAINTENANCE')] [Parameter(Mandatory = $false,ParameterSetName = 'SCHEDULEMAINTENANCE')]
[ValidateRange(1, 100)] [ValidateRange(1, 100)]
[int]$EveryInt = 1, [int]$EveryInt = 1,
@@ -6068,9 +6068,9 @@ function Start-HVFarm {
Write-Host "Performed recompose task on farm: " $farmList.$item Write-Host "Performed recompose task on farm: " $farmList.$item
} }
} }
'SCHEDULE_MAINTENANCE' { 'SCHEDULEMAINTENANCE' {
if ($farmSource.$item -ne 'INSTANT_CLONE_ENGINE') { if ($farmSource.$item -ne 'INSTANT_CLONE_ENGINE') {
Write-Error "SCHEDULE_MAINTENANCE operation is not supported for farm with name [$farmList.$item]. It is only supported for instant-clone farms." Write-Error "SCHEDULEMAINTENANCE operation is not supported for farm with name [$farmList.$item]. It is only supported for instant-clone farms."
break break
} else { } else {
$spec = New-Object VMware.Hv.FarmMaintenanceSpec $spec = New-Object VMware.Hv.FarmMaintenanceSpec
@@ -6108,21 +6108,21 @@ function Start-HVFarm {
try { try {
$spec.ImageMaintenanceSettings = Set-HVFarmSpec -vcId $vcId -spec $spec.ImageMaintenanceSettings $spec.ImageMaintenanceSettings = Set-HVFarmSpec -vcId $vcId -spec $spec.ImageMaintenanceSettings
} catch { } catch {
Write-Error "SCHEDULE_MAINTENANCE task failed with error: $_" Write-Error "SCHEDULEMAINTENANCE task failed with error: $_"
break break
} }
} }
# call scheduleMaintenance service on farm # call scheduleMaintenance service on farm
if ($pscmdlet.ShouldProcess($farmList.$item)) { if ($pscmdlet.ShouldProcess($farmList.$item)) {
$farm_service_helper.Farm_ScheduleMaintenance($services, $item, $spec) $farm_service_helper.Farm_ScheduleMaintenance($services, $item, $spec)
Write-Host "Performed SCHEDULE_MAINTENANCE task on farm: " $farmList.$item Write-Host "Performed SCHEDULEMAINTENANCE task on farm: " $farmList.$item
} }
} }
} }
'CANCEL_MAINTENANCE' { 'CANCELMAINTENANCE' {
if ($pscmdlet.ShouldProcess($farmList.$item)) { if ($pscmdlet.ShouldProcess($farmList.$item)) {
$farm_service_helper.Farm_CancelScheduleMaintenance($services, $item, $MaintenanceMode) $farm_service_helper.Farm_CancelScheduleMaintenance($services, $item, $MaintenanceMode)
Write-Host "Performed CANCEL_MAINTENANCE task on farm: " $farmList.$item Write-Host "Performed CANCELMAINTENANCE task on farm: " $farmList.$item
} }
} }
} }