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:
parent
fb3007cd63
commit
af6c7c90bc
1 changed files with 12 additions and 1 deletions
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue