VMware: Change node_wwn and port_wwn for FC HBA to hexadecimal value

Fixes: #63045
pull/66836/head
sky-joker 4 years ago committed by Abhijeet Kasurde
parent 5c1fe78685
commit 65aedc5d4a

@ -0,0 +1,2 @@
bugfixes:
- vmware_host_vmhba_info - fixed node_wwn and port_wwn for FC HBA to hexadecimal format(https://github.com/ansible/ansible/issues/63045).

@ -120,6 +120,11 @@ hosts_vmhbas_info:
}
'''
try:
from pyVmomi import vim
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.vmware import vmware_argument_spec, PyVmomi
@ -167,11 +172,17 @@ class HostVmhbaMgr(PyVmomi):
hba_info['model'] = hba.model
hba_info['driver'] = hba.driver
try:
hba_info['node_wwn'] = self.format_number(hba.nodeWorldWideName)
if isinstance(hba, (vim.host.FibreChannelHba, vim.host.FibreChannelOverEthernetHba)):
hba_info['node_wwn'] = self.format_number('%X' % hba.nodeWorldWideName)
else:
hba_info['node_wwn'] = self.format_number(hba.nodeWorldWideName)
except AttributeError:
pass
try:
hba_info['port_wwn'] = self.format_number(hba.portWorldWideName)
if isinstance(hba, (vim.host.FibreChannelHba, vim.host.FibreChannelOverEthernetHba)):
hba_info['port_wwn'] = self.format_number('%X' % hba.portWorldWideName)
else:
hba_info['port_wwn'] = self.format_number(hba.portWorldWideName)
except AttributeError:
pass
try:

Loading…
Cancel
Save