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

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

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

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

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

可以看到至少需要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

上一篇:VMware vSphere Hypervisor 7.0 U1 下载


下一篇:vsphere