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

Fixes: #63045
This commit is contained in:
sky-joker 2020-01-28 13:16:29 +09:00 committed by Abhijeet Kasurde
parent 5c1fe78685
commit 65aedc5d4a
2 changed files with 15 additions and 2 deletions

View file

@ -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).

View file

@ -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: