Fallback to the newer object type for dvswitch
(cherry picked from commit 940bf1f627
)
This commit is contained in:
parent
00348c3db0
commit
0ee146fef2
1 changed files with 7 additions and 1 deletions
|
@ -156,7 +156,13 @@ def find_datastore_by_name(content, datastore_name):
|
|||
|
||||
def find_dvs_by_name(content, switch_name):
|
||||
|
||||
vmware_distributed_switches = get_all_objs(content, [vim.dvs.VmwareDistributedVirtualSwitch])
|
||||
# https://github.com/vmware/govmomi/issues/879
|
||||
# https://github.com/ansible/ansible/pull/31798#issuecomment-336936222
|
||||
try:
|
||||
vmware_distributed_switches = get_all_objs(content, [vim.dvs.VmwareDistributedVirtualSwitch])
|
||||
except IndexError:
|
||||
vmware_distributed_switches = get_all_objs(content, [vim.DistributedVirtualSwitch])
|
||||
|
||||
for dvs in vmware_distributed_switches:
|
||||
if dvs.name == switch_name:
|
||||
return dvs
|
||||
|
|
Loading…
Reference in a new issue