Skip to content

Commit

Permalink
shifting from management to VMFS script
Browse files Browse the repository at this point in the history
  • Loading branch information
Malika133 committed Sep 11, 2023
1 parent a4a1454 commit 3f475b8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Microsoft.AVS.VMFS/Microsoft.AVS.VMFS.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
"Get-StorageAdapters",
"Get-VmKernelAdapters",
"Set-NVMeTCP",
"New-NVMeTCPAdapter"
"New-NVMeTCPAdapter",
"Set-DatastoreMultipathingPolicy"
)

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
Expand Down
37 changes: 37 additions & 0 deletions Microsoft.AVS.VMFS/Microsoft.AVS.VMFS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1544,3 +1544,40 @@ function New-NVMeTCPAdapter {
Write-Host ""

}


<#
.DESCRIPTION
Set default Multipath Policy to Round Robin.
.PARAMETER DatastoreName
Datastore name
.EXAMPLE
Set-DatastoreMultipathingPolicy -DatastoreName "myDatastore"
.INPUTS
vCenter datastore name.
.OUTPUTS
None.
#>
function Set-DatastoreMultipathingPolicy {
[CmdletBinding()]
[AVSAttribute(10, UpdatesSDDC = $false, AutomationOnly = $true)]
param(
[Parameter(Mandatory=$true)]
[string]$DatastoreName
)
try {
$datastore = Get-Datastore -Name $DatastoreName -ErrorAction Stop
$policy = Get-ScsiLun -Datastore $datastore | Get-View | Select-Object -First 1 -ExpandProperty MultipathPolicy
$policy.ChangePolicy("VMW_PSP_RR")
Write-Host "Successfully set Multipath Policy to Round Robin for datastore $DatastoreName."
}
catch {
Write-Error "Failed to set Multipath Policy for datastore $DatastoreName. Error: $($_.Exception.Message)"
}
}


0 comments on commit 3f475b8

Please sign in to comment.