27.5 C
Dubai
Tuesday, November 29, 2022

Perennially Reservation with PowerCLI for RDMs

ESXi/ESX hosts with visibility to RDM LUNs being used by MSCS nodes with RDMs may take a long time to start/reboot or during LUN rescan

Lets see how to set for specific hosts and to all hosts in a cluster.

To see ScsiCanonicalName of a Specific Virtual Machine –

(Get-VM VMNAME | Get-HardDisk -DiskType RawPhysical).ScsiCanonicalName

image

To See current status of “IsPerenniallyReserved”  for a Specific Host –

$myesxcli = get-esxcli -VMHost 10.10.10.10
$myesxcli.storage.core.device.list("naa.6000044444523030303836").IsPerenniallyReserved

image

To Set this for a Specific Host –

$myesxcli = get-esxcli -VMHost 10.10.10.10
$myesxcli.storage.core.device.setconfig($false, "naa.600009444423252523030303836", $true)

To Apply  on a Cluster  –

Enter VMNAME

Enter CLUSTERNAME

First – Remove  Line 10 to See Current Status of all hosts in the Cluster – $myesxcli.storage.core.device.setconfig($false, “$device”, $true)

If you are ok .Then insert line 10 and run the script


$devices = (Get-VM VMNAME | Get-HardDisk -DiskType RawPhysical).ScsiCanonicalName
$Cluster = Get-Cluster CLUSTERNAME
$vmhosts = $Cluster | Get-VMHost
Foreach ($Vmhost in $Vmhosts)
{
$myesxcli = get-esxcli -VMHost $Vmhost.Name
Foreach ($device in $devices)
{
$myesxcli.storage.core.device.setconfig($false, "$device", $true)
$Device
$ReservedStatus = $myesxcli.storage.core.device.list("$device").IsPerenniallyReserved
$ReservedStatus
}
}

Satheshwaran Manoharan
Satheshwaran Manoharanhttps://www.azure365pro.com
Specialized in Microsoft Azure - Office 365 / Microsoft Exchange; conducted numerous projects worldwide in designing, supporting, and implementing messaging and virtualization infrastructure for medium-sized and large enterprises. Further, I am a Cloud Architect and Technical Advisor for various start-ups.

Related Articles

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

× How can I help you?