mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
vmware: Add portgroup_portkey and portgroup_key (#38958)
* VMware: apply correct value for datacenter in TC Signed-off-by: Tim Steinbach <tim@nequissimus.com> Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
7437d6fdc4
commit
f61172e6c7
4 changed files with 114 additions and 4 deletions
|
@ -103,7 +103,7 @@ def find_entity_child_by_path(content, entityRootFolder, path):
|
|||
|
||||
if entity.name == paths[-1]:
|
||||
return entity
|
||||
except:
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
@ -337,7 +337,7 @@ def gather_vm_facts(content, vm):
|
|||
for item in vm.layout.disk:
|
||||
for disk in item.diskFile:
|
||||
facts['hw_files'].append(disk)
|
||||
except:
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
facts['hw_folder'] = PyVmomi.get_vm_path(content, vm)
|
||||
|
@ -380,6 +380,14 @@ def gather_vm_facts(content, vm):
|
|||
else:
|
||||
mac_addr = mac_addr_dash = None
|
||||
|
||||
if (hasattr(entry, 'backing') and hasattr(entry.backing, 'port') and
|
||||
hasattr(entry.backing.port, 'portKey') and hasattr(entry.backing.port, 'portgroupKey')):
|
||||
port_group_key = entry.backing.port.portgroupKey
|
||||
port_key = entry.backing.port.portKey
|
||||
else:
|
||||
port_group_key = None
|
||||
port_key = None
|
||||
|
||||
factname = 'hw_eth' + str(ethernet_idx)
|
||||
facts[factname] = {
|
||||
'addresstype': entry.addressType,
|
||||
|
@ -388,6 +396,8 @@ def gather_vm_facts(content, vm):
|
|||
'ipaddresses': net_dict.get(entry.macAddress, None),
|
||||
'macaddress_dash': mac_addr_dash,
|
||||
'summary': entry.deviceInfo.summary,
|
||||
'portgroup_portkey': port_key,
|
||||
'portgroup_key': port_group_key,
|
||||
}
|
||||
facts['hw_interfaces'].append('eth' + str(ethernet_idx))
|
||||
ethernet_idx += 1
|
||||
|
@ -1048,7 +1058,7 @@ class PyVmomi(object):
|
|||
folder_name = fp.name + '/' + folder_name
|
||||
try:
|
||||
fp = fp.parent
|
||||
except:
|
||||
except BaseException:
|
||||
break
|
||||
folder_name = '/' + folder_name
|
||||
return folder_name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue