mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
* 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:
parent
17f3c37955
commit
aa0eae8eda
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user