pyvmomi:检索“传输”信息

时间:2018-04-23 18:56:09

标签: api vsphere esxi pyvmomi

我正在尝试使用pyvmomi打印出传输详细信息(来自vCenter - 主机>存储设备>设备详细信息>传输> SAS(例如))。

这是我一直用作参考的API: https://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.host.MultipathInfo.Path.html

HostMultiPathInfoLuns = host.config.storageDevice.multipathInfo.lun
        for lun in HostMultiPathInfoLuns:
            for path in lun.path:
                print(path.transport)

这打印出以下内容:

(vim.host.SerialAttachedTargetTransport) {
   dynamicType = <unset>,
   dynamicProperty = (vmodl.DynamicProperty) []
}
(vim.host.SerialAttachedTargetTransport) {
   dynamicType = <unset>,
   dynamicProperty = (vmodl.DynamicProperty) []
}

我有兴趣检索这样的东西: (运行esxcli storage core path list命令以生成当前连接到ESXi主机的所有LUN路径的列表。)

fc.5001438005685fb5:5001438005685fb4-fc.50060160c46036df:50060167446036df-naa.6006016094602800e07ff528b73ae011
UID: fc.5001438005685fb5:5001438005685fb4-fc.50060160c46036df:50060167446036df-naa.6006016094602800e07ff528b73ae011
Runtime Name: vmhba0:C0:T0:L23
Device: naa.6006016094602800e07ff528b73ae011
Device Display Name: DGC Fibre Channel Disk ( naa.6006016094602800e07ff528b73ae011)
Adapter: vmhba0
Channel: 0
Target: 0
LUN: 23
Plugin: NMP
State: active
Transport: fc
Adapter Identifier: fc.5001438005685fb5:5001438005685fb4
Target Identifier: fc.50060160c46036df:50060167446036df
Adapter Transport Details: WWNN:-43-WWPN: 50:01:43:80:05:68:5f:b4
Target Transport Details: WWNN:-45-WWPN: 50:06:01:67:44:60:36:d

提前致谢...

1 个答案:

答案 0 :(得分:0)

然后,您可能需要访问您感兴趣的lun路径的各个属性。尝试使用print(path.transport)print(path.transport.address)之类的方法,而不仅仅是做print(path.transport.iScsiName)。我在调试器中仅在该对象上看到三个属性,它们是地址,iScsiName和iScsiAlias