PowerVM环境下,如果涉及到虚拟 I/O 的维护工作,我们通常会先登陆到 VIO Server 上使用 lsmap 命令查看虚拟适配器( Virtual Adpater )和物理设备之间的对应关系。但是,在某些情况下,如果不允许我们登陆到 VIO Server 上,那我们如何确定 AIX 分区上的虚拟 I/O 设备的映射关系呢?今天我们向大家介绍两种常用的查看方法:
方法一:使用 kdb 查看
使用 kdb 命令我们可以直观地在 AIX 客户端分区( VIOC )查看虚拟 I/O 设备的映射关系
1 ) vSCSI 方式
# echo cvai | kdb -script
read vscsi_scsi_ptrs OK, ptr = 0xF10009D5B0129E98
(0)> cvai
Executing cvai command
NAME STATE CMDS_ACTIVE ACTIVE_QUEUE HOST
vscsi0 0x000007 0x000000001A 0x0 vios2->vhost3
End of execution for cvai command
(0)> Executing q command
从上面的命令输出,我们可以看到 vscsi0 设备来自名称为 vios2 的 VIO Server 上的 vhost3 。
2 ) NPIV 方式
# echo vfcs | kdb -script
read vscsi_scsi_ptrs OK, ptr = 0xF10009D5B0129E98
(0)> vfcs
Executing vfcs command
NAME ADDRESS STATE OPENED CH HOST_ADAP PHYS HOST
fcs0 0xF1000B01C0084000 0x0010 0x0001 8 Secure
fcs1 0xF1000B01C0088000 0x0010 0x0001 0 vfchost0 vios1
从上面的命令输出,我们可以看到 fcs1 设备来自名称为 vios1 的 VIO Server 上的 vfchost0 。
方法二:从 AIX 7.2 TL5 SP3 开始,配合 VIOS 3.1.3.0 ,在 AIX 上提供了一个新的方法,方便系统管理员查看虚拟 FC 卡的映射关系,我们先来看一下这个 fcs0 虚拟 FC 卡的输出结果:
# cat /proc/sys/adapter/fc/fcs0/hostinfo
fcs0
VFC client adapter name : fcs0
Host partition name (VIOS) : vio1
VFC host adapter name : vfchost0
VFC host adapter location code : U9009.22A.XXXXXX-V3-C7
FC adapter name on VIOS : fcs2
FC adapter location code on VIOS : U78D3.001.XXXXXX-P1-C8-T1
从上面的输出我们可以看到我们查看的 fcs0 设备来自名称为 vio1 的 VIO Server 上的 vfchost0 , vfchost 设备的虚拟 slot 为 C7 ,对应的物理 FC 卡为 vio1 上的 fcs2 ,对应的槽位和端口号为 C8-T1 。这个输出结果是不是比之前用 kdb 方式更清楚更直观?
我们来详细介绍一下这种方法:
1 ) 首先使用这种方法对 AIX 系统的版本和 VIO Server 的版本要求比较高 : AIX 要求 7.2 TL5 SP3 或之后的版本, VIOS 则要求 3.1.3.0
# oslevel -s
7200-05-03-2136
2 ) 在满足上述版本要求的前提下,我们可以在 /proc/sys/adapter/fc 路径下看到针对每个虚拟 FC 设备有一个目录
# cd /proc/sys/adapter/fc
# ls -ltr
total 0
dr-xr-xr-x 7 root system 0 Oct 04 16:13 fscsi3
dr-xr-xr-x 7 root system 0 Oct 04 16:13 fscsi2
dr-xr-xr-x 7 root system 0 Oct 04 16:13 fscsi1
dr-xr-xr-x 7 root system 0 Oct 04 16:13 fscsi0
dr-xr-xr-x 3 root system 0 Oct 04 16:13 fcs3
dr-xr-xr-x 3 root system 0 Oct 04 16:13 fcs2
dr-xr-xr-x 3 root system 0 Oct 04 16:13 fcs1
dr-xr-xr-x 3 root system 0 Oct 04 16:13 fcs0
进入每个目录都有一个 hostinfo 的文件,我们进入 fcs0 目录看一下
# cd fcs0
# ls -ltr
total 0
prw-r--r-- 1 root system 0 Oct 04 16:16 hostinfo
接着,我们查看一下这个文件的内容,就能看到 fcs0 这个虚拟 FC 卡的映射关系,从 VIO Server 到 vfchost ,再到对应的物理 FC 端口都能查看到。
# cat hostinfo
VFC client adapter name : fcs0
Host partition name (VIOS) : vio2
VFC host adapter name : vfchost2
VFC host adapter location code : U9009.22A.7891CA0-V3-C16
FC adapter name on VIOS : fcs1
FC adapter location code on VIOS : U78D3.001.WZS0AJN-P1-C8-T1
其他说明:
1 ) 如果 AIX 版本满足 AIX 7.2 TL5 SP3 ,但 VIO Server 的版本不满足 3.1.3.0 的要求。虽然说 AIX 系统中仍然能够在 /proc/sys/adapter/fc 找到对应的 hostinfo 文件,但是在 FC adapter name on VIOS 属性后是空白:
# cat hostinfo
VFC client adapter name : fcs0
Host partition name (VIOS) : vio2
VFC host adapter name : vfchost2
VFC host adapter location code : U9009.22A.7891CA0-V3-C16
FC adapter name on VIOS :
FC adapter location code on VIOS : U78D3.001.WZS0AJN-P1-C8-T1
2 ) 然而在 VIOS 3.1.3.0 这个版本中也支持调整secure_va_info参数隐藏向 VIO Client 分区展示虚拟 FC 卡的映射关系信息
$ chdev -dev viosnpiv0 -attr secure_va_info=yes
viosnpiv0 changed
$ virtadapinfo -list
secure : yes
接着我们到 AIX 客户端分区再查看虚拟 FC 卡的 hostinfo ,此时所有的输出都变成了 Secure ,证明 VIO Server 上的 secure_va_info 调整后,虚拟 FC 卡的映射关系被隐藏了
# cat /proc/sys/adapter/fc/fcs1/hostinfo
VFC client adapter name : fcs1
Host partition name (VIOS) : Secure
VFC host adapter name : Secure
VFC host adapter location code : Secure
FC adapter name on VIOS : Secure
FC adapter location code on VIOS : Secure
注:经过测试同样适用于隐藏通过 kdb 方式查看虚拟 FC 卡映射关系的方法
写在最后:
在新版本的 AIX 上使用虚拟 FC 卡的 hostinfo 查看虚拟 FC 卡的映射关系比使用 kdb 更加直观,但是这种方式只适用于 NPIV 方式映射,如果使用的是 vSCSI 方式,可以继续使用 kdb 进行查看。
如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!
赞13
添加新评论7 条评论
2023-08-02 19:03
2023-02-27 09:31
2022-10-01 20:40
2022-04-18 16:14
2022-02-17 06:00
2021-11-01 14:31
2021-10-29 16:28