Skip to content

Commit

Permalink
B #3280: Check clusters (#3317)
Browse files Browse the repository at this point in the history
* fix bug-3280

* B #3280: Import vCenter cluster as host needs to check existing OpenNebula clusters

* B #3280: Import vCenter cluster as host needs to check existing OpenNebula clusters

* fix bug-3280

Signed-off-by: jmdelafe <[email protected]>

* B #3280: Import vCenter cluster as host needs to check existing OpenNebula clusters

Signed-off-by: jmdelafe <[email protected]>

* B #3280: Import vCenter cluster as host needs to check existing OpenNebula clusters

Signed-off-by: jmdelafe <[email protected]>
  • Loading branch information
jmdelafe authored and Tino Vázquez committed May 14, 2019
1 parent 17f3c37 commit aa0eae8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/sunstone/models/OpenNebulaJSON/ClusterJSON.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ def create(template_json)
return cluster_hash
end

self.allocate(cluster_hash['name'])
# Check if cluster exists
cluster_pool = OpenNebula::ClusterPool.new(@client)
cluster_pool.info
cluster_pool.each do |cluster|
if cluster.name == cluster_hash['name']
# Use existing cluster
@pe_id = cluster.id
else
# Create cluster
self.allocate(cluster_hash['name'])
end
end
end

def perform_action(template_json)
Expand Down
5 changes: 5 additions & 0 deletions src/vmm_mad/remotes/lib/vcenter_driver/vcenter_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ def self.import_clusters(con_ops, options)
answer = STDIN.gets.strip
if !answer.empty?
one_cluster_id = answer
else
# Check if the Cluster exists
cluster_list.each do |key, value|
one_cluster_id = key if value == "#{cluster[:cluster_name]}"
end
end
end

Expand Down

0 comments on commit aa0eae8

Please sign in to comment.