1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[vSphere] Support clusters that are located below folders

This commit is contained in:
Shlomi Zadok 2014-11-12 09:01:31 +02:00
parent fb3007cd63
commit af6c7c90bc

View file

@ -11,11 +11,22 @@ module Fog
end
def raw_clusters(datacenter)
find_raw_datacenter(datacenter).hostFolder.childEntity.grep(RbVmomi::VIM::ClusterComputeResource)
folder ||= find_raw_datacenter(datacenter).hostFolder
@raw_clusters = get_raw_clusters_from_folder(folder)
end
protected
def get_raw_clusters_from_folder(folder)
folder.childEntity.map do |child_entity|
if child_entity.is_a? RbVmomi::VIM::ClusterComputeResource
child_entity
elsif child_entity.is_a? RbVmomi::VIM::Folder
get_raw_clusters_from_folder(child_entity)
end
end.flatten
end
def cluster_attributes cluster, datacenter_name
{
:id => managed_obj_id(cluster),