1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

B #3280: Check clusters (#3317)

* 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 <13242860+jmdelafe@users.noreply.github.com>

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

Signed-off-by: jmdelafe <13242860+jmdelafe@users.noreply.github.com>

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

Signed-off-by: jmdelafe <13242860+jmdelafe@users.noreply.github.com>
This commit is contained in:
jmdelafe 2019-05-14 11:47:49 -04:00 committed by Tino Vázquez
parent 17f3c37955
commit aa0eae8eda
2 changed files with 17 additions and 1 deletions

View File

@ -26,7 +26,18 @@ module OpenNebulaJSON
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)

View File

@ -476,6 +476,11 @@ module VCenterDriver
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