批量修改vsphere共享存储多路径选择策略

传统方式修改存储的多路径选择策略

首先说一下传统web界面操作方式:

vSphere 6.5.0.23000

可以看到至少需要点击6次才能修改完成一个修改。在生产环境中一般会挂载很多FC存储,这时候就需要一个批量快捷的方式来修改。

使用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(循环)"

  • 配合使用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
......

参数说明:

  • 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/

posted @ 2021-01-01 21:55  吴诺克  阅读(2009)  评论(0编辑  收藏  举报
Copyright © 豆子林克 DOUZI.LINK  版权所有. 除特别申明外,本站原创内容版权遵循 CC-BY-NC-SA 协议规定