Skip to content

Commit

Permalink
Use get_dvswitch_hosts for host_switches
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Feb 4, 2019
1 parent dfdebdd commit 0b8a18a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ def self.dvs_inv_to_hashes(inv)
result << new_result
result_uids[new_result[:uid_ems]] = new_result

hosts = Array(summary["hostMember"])

hosts = get_dvswitch_hosts(inv, new_result[:uid_ems])
hosts.each { |host_mor| result_uids[:by_host_mor][host_mor] << new_result }
end

Expand Down Expand Up @@ -183,6 +182,13 @@ def self.storage_profile_inv_to_hashes(profile_inv, storage_uids, placement_inv)
return result, result_uids
end

def self.get_dvswitch_hosts(dvswitch_inv, switch_mor)
hosts_list = dvswitch_inv.fetch_path(switch_mor, 'config', 'host') || []
hosts = hosts_list.collect { |host_data| host_data.fetch_path('config', 'host') }
hosts += dvswitch_inv.fetch_path(switch_mor, 'summary', 'hostMember') || []
hosts.uniq
end

def self.host_inv_to_hashes(inv, ems_inv, storage_uids, cluster_uids, dvs_uids)
result = []
result_uids = {}
Expand Down

0 comments on commit 0b8a18a

Please sign in to comment.