IBM Powerサーバーの Linux LPAR で I/O パスがどのVIOS に紐づいているか調べる方法

##### はじめに


Linux LPAR (VIO Client) で、VIOS の vfchost のマッピングがコマンドで確認できることを知りましたので確認しました。

・(参考) [How to identify which VIOS is serving their IO paths from Linux LPAR (vFC)](https://www.ibm.com/support/pages/node/6599925?myns=swgother&mynp=OCSSAGD3&mync=F&cm_sp=swgother-_-OCSSAGD3-_-F)


---
##### 環境

RHEL 8.4 on IBM Power S824
 - 冗長VIOS構成
 - ディスクは NPIV接続 SAN boot 
 - 仮想光学ディスク1つ (vSCSI)

---
##### 確認方法


・Linux LPAR 上でパスを確認

```
# multipath -ll
Jul 12 22:58:17 | /etc/multipath.conf line 3, duplicate keyword: find_multipaths
mpatha (360050768028083dfd8000000000009ca) dm-0 IBM,2145
size=50G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 0:0:0:0 sda  8:0    active ready running
| |- 1:0:0:0 sdi  8:128  active ready running
| |- 2:0:0:0 sdq  65:0   active ready running
| `- 4:0:1:0 sdac 65:192 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 0:0:1:0 sde  8:64   active ready running
  |- 1:0:1:0 sdm  8:192  active ready running
  |- 2:0:1:0 sdu  65:64  active ready running
  `- 4:0:0:0 sdy  65:128 active ready running
```

=> mpatha は 0,1,2,4 の番号で接続しています。


・systool コマンドの実行

```
# systool -c scsi_host -v
Class = "scsi_host"

  Class Device = "host0"            　　　　　　　　　　　　　　　  #<==
  Class Device path = "/sys/devices/vio/30000003/host0/scsi_host/host0"
    active_mode         = "Initiator"
    can_queue           = "100"
    capabilities        = "d00000000000000"
    cmd_per_lun         = "16"
    device_name         = "vfchost28"                          #<==
    drc_name            = "U8286.42A.XXXXXXX-V1-C47"
    eh_deadline         = "off"
    host_busy           = "0"
    host_reset          = <store method only>
    log_level           = "2"
    npiv_version        = "33554432"
    partition_name      = "VIOS_1"            　　　　　　　　　  #<==
    port_loc_code       = "U78C9.001.XXXXXYY-P1-C2-T1"
    proc_name           = "ibmvfc"      　　　　　　　　　        
    prot_capabilities   = "0"
    prot_guard_type     = "0"
    scan                = <store method only>
    sg_prot_tablesize   = "0"
    sg_tablesize        = "128"
    state               = "running"
    supported_mode      = "Initiator"
    trace               = "��e"
    uevent              =
    unchecked_isa_dma   = "0"
    unique_id           = "0"
    use_blk_mq          = "1"

    Device = "host0"
    Device path = "/sys/devices/vio/30000003/host0"
      uevent              = "DEVTYPE=scsi_host"


  Class Device = "host1"            　　　　　　　　　　　　　　　  #<==
  Class Device path = "/sys/devices/vio/30000004/host1/scsi_host/host1"
    active_mode         = "Initiator"
    can_queue           = "100"
    capabilities        = "d00000000000000"
    cmd_per_lun         = "16"
    device_name         = "vfchost29"                          #<==
    drc_name            = "U8286.42A.XXXXXXX-V2-C43"
    eh_deadline         = "off"
    host_busy           = "0"
    host_reset          = <store method only>
    log_level           = "2"
    npiv_version        = "33554432"
    partition_name      = "VIOS_2"            　　　　　　　　　  #<==
    port_loc_code       = "U78C9.001.XXXXXYY-P1-C3-T2"
    proc_name           = "ibmvfc"            　　　　　　　　　  
    prot_capabilities   = "0"
    prot_guard_type     = "0"
    scan                = <store method only>
    sg_prot_tablesize   = "0"
    sg_tablesize        = "128"
    state               = "running"
    supported_mode      = "Initiator"
    trace               = "h�ne"
    uevent              =
    unchecked_isa_dma   = "0"
    unique_id           = "1"
    use_blk_mq          = "1"

    Device = "host1"
    Device path = "/sys/devices/vio/30000004/host1"
      uevent              = "DEVTYPE=scsi_host"


  Class Device = "host2"            　　　　　　　　　　　　　　　  #<==
  Class Device path = "/sys/devices/vio/30000005/host2/scsi_host/host2"
    active_mode         = "Initiator"
    can_queue           = "100"
    capabilities        = "d00000000000000"
    cmd_per_lun         = "16"
    device_name         = "vfchost29"                          #<==
    drc_name            = "U8286.42A.XXXXXXX-V1-C49"
    eh_deadline         = "off"
    host_busy           = "0"
    host_reset          = <store method only>
    log_level           = "2"
    npiv_version        = "33554432"
    partition_name      = "VIOS_1"            　　　　　　　　　  #<==
    port_loc_code       = "U78C9.001.XXXXXYY-P1-C2-T2"
    proc_name           = "ibmvfc"            　　　　　　　　　
    prot_capabilities   = "0"
    prot_guard_type     = "0"
    scan                = <store method only>
    sg_prot_tablesize   = "0"
    sg_tablesize        = "128"
    state               = "running"
    supported_mode      = "Initiator"
    trace               = "���e"
    uevent              =
    unchecked_isa_dma   = "0"
    unique_id           = "2"
    use_blk_mq          = "1"

    Device = "host2"
    Device path = "/sys/devices/vio/30000005/host2"
      uevent              = "DEVTYPE=scsi_host"

　　
  Class Device = "host3"            　　　　　　　　　　　　　　　  #<==
  Class Device path = "/sys/devices/vio/30000002/host3/scsi_host/host3"
    active_mode         = "Initiator"
    can_queue           = "100"
    cmd_per_lun         = "16"
    config              =
    eh_deadline         = "off"
    host_busy           = "0"
    host_reset          = <store method only>
    mad_version         = "1"
    os_type             = "3"
    partition_name      = "VIOS_2"            　　　　　　　　　  #<==
    partition_number    = "2"
    proc_name           = "ibmvscsi"            　　　　　　　　　#<==
    prot_capabilities   = "0"
    prot_guard_type     = "0"
    scan                = <store method only>
    sg_prot_tablesize   = "0"
    sg_tablesize        = "128"
    srp_version         = "16.a"
    state               = "running"
    supported_mode      = "Initiator"
    uevent              =
    unchecked_isa_dma   = "0"
    unique_id           = "0"
    use_blk_mq          = "1"
    vhost_loc           = "U8286.42A.XXXXXXX-V45-C2-T1"
    vhost_name          = "vhost6"

    Device = "host3"
    Device path = "/sys/devices/vio/30000002/host3"
      uevent              = "DEVTYPE=scsi_host"


  Class Device = "host4"            　　　　　　　　　　　　　　　  #<==
  Class Device path = "/sys/devices/vio/30000006/host4/scsi_host/host4"
    active_mode         = "Initiator"
    can_queue           = "100"
    capabilities        = "d00000000000000"
    cmd_per_lun         = "16"
    device_name         = "vfchost30"                          #<==
    drc_name            = "U8286.42A.XXXXXXX-V2-C44"
    eh_deadline         = "off"
    host_busy           = "0"
    host_reset          = <store method only>
    log_level           = "2"
    npiv_version        = "33554432"
    partition_name      = "VIOS_2"            　　　　　　　　　  #<==
    port_loc_code       = "U78C9.001.XXXXXYY-P1-C3-T1"
    proc_name           = "ibmvfc"            　　　　　　　　　
    prot_capabilities   = "0"
    prot_guard_type     = "0"
    scan                = <store method only>
    sg_prot_tablesize   = "0"
    sg_tablesize        = "128"
    state               = "running"
    supported_mode      = "Initiator"
    trace               = �`"
    uevent              =
    unchecked_isa_dma   = "0"
    unique_id           = "4"
    use_blk_mq          = "1"

    Device = "host4"
    Device path = "/sys/devices/vio/30000006/host4"
      uevent              = "DEVTYPE=scsi_host"

#
```

proc_name から host0,1,2,4 が "ibmvfc"(NPIV)、host3 が "ibmvscsi" (vSCSI) であることが確認できます。
multipath -ll コマンドで確認した番号にも一致します。


---
上記よりこの環境では、host0, host2 が VIOS_1 に接続、host1,host4 が VIOS_2 に接続している、host3 は vSCSI の仮想光学デバイスで VIOS_2 に接続していることことがわかりました。



```
# multipath -ll
Jul 12 22:58:17 | /etc/multipath.conf line 3, duplicate keyword: find_multipaths
mpatha (360050768028083dfd8000000000009ca) dm-0 IBM,2145
size=50G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 0:0:0:0 sda  8:0    active ready running　　　　     ### =>  VIOS_1
| |- 1:0:0:0 sdi  8:128  active ready running　　　　     ### =>  VIOS_2
| |- 2:0:0:0 sdq  65:0   active ready running　　　　     ### =>  VIOS_1
| `- 4:0:1:0 sdac 65:192 active ready running　　　     　### =>  VIOS_2
`-+- policy='service-time 0' prio=10 status=enabled
  |- 0:0:1:0 sde  8:64   active ready running　　　   　　### =>　VIOS_1
  |- 1:0:1:0 sdm  8:192  active ready running　　　　 　　### =>  VIOS_2
  |- 2:0:1:0 sdu  65:64  active ready running　　　      ### =>  VIOS_1
  `- 4:0:0:0 sdy  65:128 active ready running　　　　 　　### =>  VIOS_2
```




##### おわりに

AIX での確認方法は下記で確認しました。

https://qiita.com/c_u/items/341949edfc1ab544aca8



以上です。