SAN Policy Changes
The first step to resolving this issue long term is changing the SAN Policy to "Online All", as per our Disk Policy Configuration (SAN Policy) KB article. By setting this policy, you ensure that any newly created disks attached to the Windows Server will be in an online state after a Windows Server reboot. Windows Server defaults to OfflineShared which is the correct setting when using Windows Server Failover Clustering.
This task can be completed by following the Microsoft TechNet Article: https://technet.microsoft.com/en-us/library/gg252636.aspx
Update Existing Disk Attributes for Future Compliance
If the SAN Policy was set to 'Offline Shared', and disks were already presented to the Windows host from the FlashArray , then you must edit the existing disks 'Attributes' to ensure they will remain online following a Purity//FA upgrade and Windows host reboot. However, if this volume is used in Windows Server Failover Clustering, you must ensure the disks are returned to the correct state following a reboot since setting the SAN Policy will not set the disk to read and write as these disks are on a "shared bus (such as SCSI and iSCSI)" and will be set to read-only, as per the TechNet article above.
To quickly edit the FlashArray volume attributes, the following script has been created. The script will modify the Registry values of Everpure FlashArray volumes to OnlineAll.
This script will ask the user to create a registry backup and iterate through the Everpure volumes attached to the host and change the registry value to " VDS_SP_ONLINE".
The script will not bring any volumes into an "Online" state. Please use PowerShell or the Disk Manager to bring any Offline volumes Online. This script is meant to be used with stand-alone Windows hosts and should not be used with Windows Server Failover Clustering configured hosts.
Details regarding the process the script does can be found in the following Microsoft article: https://support.microsoft.com/en-us/help/2849097/how-to-set-the-partmgr-attributes-registry-value-using-powershell
When editing the Windows Registry, making a backup is recommended and included as part of the script. Please review the script's contents.
Clear-Host
Write-Host "----------------------------------------------------------------------------------------------------------"
Write-Host " Purpose"
Write-Host "----------------------------------------------------------------------------------------------------------"
Write-Host " This script is intended to change the Pure Storage disk 'Attributes' to a SAN Policy"
Write-Host " equivalent of 'OnlineAll'. This is intended to ensure disks presented to the Windows Host"
Write-Host " are brought online after a Purity upgrade and Windows Server reboot are performed."
Write-Host "----------------------------------------------------------------------------------------------------------"
Write-Host " Value for VDS_SAN_POLICY"
Write-Host " VDS_SP_UNKNOWN = 0x0 (0)"
Write-Host " VDS_SP_ONLINE = 0x1 (1)"
Write-Host " VDS_SP_OFFLINE_SHARED = 0x2 (2)"
Write-Host " VDS_SP_OFFLINE = 0x3 (3)"
Write-Host " Refer to Virtual Disk Service (VDS) Documentation for more details `n`r https://msdn.microsoft.com/en-us/library/bb525577%28vs.85%29.aspx?f=255&MSPPError=-2147217396."
Write-Host "----------------------------------------------------------------------------------------------------------"
Write-Host
#Requires -Version 3
$VDS_SP_UNKNOWN = 0
$VDS_SP_ONLINE = 1
$VDS_SP_OFFLINE_SHARED = 2
$VDS_SP_OFFLINE = 3
$DeviceInfoFile = ".\Desktop\PureStorage-Devices-Information-$(Get-Date -Format FileDateTime).txt"
$RegistryBackup = '.\Desktop\PureStorage-RegistryBackup.reg'
$DeviceHKLMHive = 'HKLM:\SYSTEM\CurrentControlSet\Enum\SCSI\Disk&Ven_PURE&Prod_FlashArray\*\Device Parameters\'
$DeviceIds = Get-ChildItem $DeviceHKLMHive
$Devices = @()
# Registry backup is required to execute this script.
$retBackupReg = Read-Host -Prompt "`n`rThis script makes changes to the Windows Server Registry. Backup the HKLM Registry before beginning? [Y/N]"
if ($retBackupReg.ToUpper() -eq 'Y') {
# Backup registry via export, see REG EXPORT /?
REG EXPORT HKLM $RegistryBackup /y
} else {
Write-Warning -Message 'No Windows Server Registry backup created. Please create a Registry backup manually before proceeding.'
Break
}
$retScriptMode = Read-Host -Prompt "Would you like to Update or Restore the configuration on $($env:COMPUTERNAME)? [U/R]"
if ($retScriptMode.ToUpper() -eq 'U') {
foreach ($DeviceId in $DeviceIds) {
$RegistryPath = $DeviceId.PSPath + "\Partmgr\"
$DeviceSANPolicy = Get-ItemProperty -Path $RegistryPath -Name Attributes -ErrorAction SilentlyContinue
if (!$DeviceSANPolicy) {
Write-Host "$($DeviceId.Name.Substring(84)) did not have an Attributes property. A new Attributes REG_DWORD as been created and value set to VDS_SP_ONLINE."
Set-ItemProperty -Path "$($DeviceId.PSPath)\Partmgr" -Name Attributes -Value $VDS_SP_ONLINE
}
$Devices += ((($DeviceId.Name).Replace('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\SCSI\Disk&Ven_PURE&Prod_FlashArray\',"")).Replace(($DeviceId.PSChildName),""))+$DeviceSANPolicy.Attributes
switch ($DeviceSANPolicy.Attributes) {
$VDS_SP_UNKNOWN {
# Setting a value of 0 (VDS_SP_UNKNOWN) will be mapped to VDS_SP_ONLINE, so a value of 0 or 1 may be used to bring a disk online.
Write-Host "$($DeviceId.Name.Substring(84)) is set to VDS_SP_UNKNOWN."
}
$VDS_SP_ONLINE {
Write-Host "$($DeviceId.Name.Substring(84)) is set to VDS_SP_ONLINE."
}
$VDS_SP_OFFLINE_SHARED {
Write-Host "$($DeviceId.Name.Substring(84)) is set to VDS_SP_OFFLINE_SHARED." -ForegroundColor Red
$retUpdateAttributes = Read-Host -Prompt "Update device to VDS_SP_ONLINE? [Y/N]"
if ($retUpdateAttributes.ToUpper() -eq 'Y') {
Set-ItemProperty -Path $RegistryPath -Name Attributes -Value $VDS_SP_ONLINE
}
}
$VDS_SP_OFFLINE {
Write-Host "$($DeviceId.Name.Substring(84)) is set to VDS_SP_OFFLINE." -ForegroundColor Red
$retUpdateAttributes = Read-Host -Prompt "Update device to VDS_SP_OFFLINE? [Y/N]"
if ($retUpdateAttributes.ToUpper() -eq 'Y') {
Set-ItemProperty -Path $RegistryPath -Name Attributes -Value $VDS_SP_ONLINE
}
}
}
}
# Store DeviceId Name and Attributes
Add-Content -Value $Devices -LiteralPath $DeviceInfoFile
} else {
$DeviceFiles = Get-ChildItem -Path '.\Desktop\' -Filter 'PureStorage-Devices-Information*' | Select Name
Write-Host "The following Pure Storage Devices Information files exist on $($env:COMPUTERNAME). Please select which file to use for restore.`n`r"
for($i=0;$i -lt ($DeviceFiles.Count);$i++) {
Write-Host "($($i+1)) $($DeviceFiles[$i].Name)"
}
Write-Host
[uint16]$RestoreFile = Read-Host "Which file?"
$DeviceProperties = Get-Content -Path ".\Desktop\$($DeviceFiles[$RestoreFile-1].Name)"
foreach ($DeviceProperty in Get-Content -Path ".\Desktop\$($DeviceFiles[$RestoreFile-1].Name)") {
$RestoreRegistryPath = "HKLM:\SYSTEM\CurrentControlSet\Enum\SCSI\Disk&Ven_PURE&Prod_FlashArray\$($DeviceProperty.Substring(0,$DeviceProperty.Length-2))\Device Parameters\Partmgr\"
Set-ItemProperty -Path $RestoreRegistryPath -Name Attributes -Value $($DeviceProperty.Substring($DeviceProperty.Length-1,1))
}
}