批量修改vsphere共享存儲多路徑選擇策略

傳統方式修改存儲的多路徑選擇策略

首先說一下傳統web界面操做方式:web

vSphere 6.5.0.23000code

能夠看到至少須要點擊6次才能修改完成一個修改。在生產環境中通常會掛載不少FC存儲,這時候就須要一個批量快捷的方式來修改。blog

使用Powercli批量修改存儲多路徑選擇策略

  • 使用 get-vmhost | get-scsilun 能夠看到當前全部主機鏈接的FC多路徑策略。
PS D:\> get-vmhost | get-scsilun

CanonicalN ConsoleDeviceName              LunType         CapacityGB MultipathPolicy
ame
---------- -----------------              -------         ---------- ---------------
naa.650... /vmfs/devices/disks/naa.650... disk             2,234.500 Fixed
naa.600... /vmfs/devices/disks/naa.600... disk             3,071.935 RoundRobin
naa.600... /vmfs/devices/disks/naa.600... disk             3,071.935 RoundRobin
naa.600... /vmfs/devices/disks/naa.600... disk             3,071.935 RoundRobin
naa.650... /vmfs/devices/disks/naa.650... disk             2,234.500 Fixed
naa.600... /vmfs/devices/disks/naa.600... disk             3,071.935 RoundRobin
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 Fixed
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 Fixed
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 Fixed
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 Fixed
mpx.vmh... /vmfs/devices/disks/mpx.vmh... disk                 0.000 Fixed
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 Fixed
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 Fixed
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 Fixed
......

能夠看到不少都是"Fixed(固定)"狀態,通常來講建議改成"RoundRobin(循環)"ip

  • 配合使用Set-ScsiLun -MultipathPolicy RoundRobin能夠批量將多路徑策略改成"RoundRobin(循環)"模式
PS D:\> Get-Cluster -Name Cloud_Production_Cluster | Get-VMHost | Get-ScsiLun| Set-ScsiLun -MultipathPolicy RoundRobin
CanonicalN ConsoleDeviceName              LunType         CapacityGB MultipathPolicy
ame
---------- -----------------              -------         ---------- ---------------
naa.650... /vmfs/devices/disks/naa.650... disk             2,234.500 RoundRobin
naa.600... /vmfs/devices/disks/naa.600... disk             3,071.935 RoundRobin
naa.600... /vmfs/devices/disks/naa.600... disk             3,071.935 RoundRobin
naa.600... /vmfs/devices/disks/naa.600... disk             3,071.935 RoundRobin
naa.650... /vmfs/devices/disks/naa.650... disk             2,234.500 RoundRobin
naa.600... /vmfs/devices/disks/naa.600... disk             3,071.935 RoundRobin
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 RoundRobin
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 RoundRobin
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 RoundRobin
naa.500... /vmfs/devices/disks/naa.500... disk             1,117.813 RoundRobin
mpx.vmh... /vmfs/devices/disks/mpx.vmh... disk                 0.000 RoundRobin
......

參數說明:ci

  • Get-Cluster -Name Cloud_Production_Cluster 指定集羣
  • Get-VMHost 全部主機
  • Get-ScsiLun 獲得LUN信息
  • Set-ScsiLun -MultipathPolicy 設置MultipathPolicy 策略爲RoundRobin OR Fixed

參考:
[1]https://code.vmware.com/docs/1507/vmware-powercli
[2]https://www.shogan.co.uk/vmware/getting-and-setting-path-selection-policies-with-powercli/get

相關文章
相關標籤/搜索