29.8 C
Dubai
Friday, April 19, 2024

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
Award-winning Technology Leader with a wealth of experience running large teams and diversified industry exposure in cloud computing. From shipping lines to rolling stocks.In-depth expertise in driving cloud adoption strategies and modernizing systems to cloud native. Specialized in Microsoft Cloud, DevOps, and Microsoft 365 Stack and conducted numerous successful projects worldwide. Also, Acting as a 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?