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

Feature #3847: Added check to avoid reimporting vCenter clusters

Added error handling
This commit is contained in:
Tino Vazquez 2015-08-21 01:33:30 +02:00
parent 452ca20f56
commit 968730e455
2 changed files with 14 additions and 9 deletions

View File

@ -115,7 +115,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
next if STDIN.gets.strip.downcase != 'y'
if cluster.empty?
STDOUT.puts " No clusters found in #{dc}..."
STDOUT.puts " No new clusters found in #{dc}..."
next
end

View File

@ -244,8 +244,7 @@ class VIClient
ccrs = get_entities(dc.hostFolder, 'ClusterComputeResource')
vc_hosts[dc.name] = []
ccrs.each { |c|
puts c.name
if !hpool["HOST[NAME=\"c.name\"]"]
if !hpool["HOST[NAME=\"#{c.name}\"]"]
vc_hosts[dc.name] << c.name
end
}
@ -266,7 +265,9 @@ class VIClient
tpool = OpenNebula::TemplatePool.new(
(one_client||@one), OpenNebula::Pool::INFO_ALL)
rc = tpool.info
# TODO check error
if OpenNebula.is_error?(rc)
raise "Error contacting OpenNebula #{rc.message}"
end
datacenters = get_entities(@root, 'Datacenter')
@ -312,8 +313,10 @@ class VIClient
rc = vmpool.info
hostpool = OpenNebula::HostPool.new((one_client||@one))
rc = hostpool.info
# TODO check error
rc = hostpool.info
if OpenNebula.is_error?(rc)
raise "Error contacting OpenNebula #{rc.message}"
end
datacenters = get_entities(@root, 'Datacenter')
@ -395,9 +398,11 @@ class VIClient
vnpool = OpenNebula::VirtualNetworkPool.new(
(one_client||@one), OpenNebula::Pool::INFO_ALL)
rc = vnpool.info
# TODO check error
#
rc = vnpool.info
if OpenNebula.is_error?(rc)
raise "Error contacting OpenNebula #{rc.message}"
end
datacenters = get_entities(@root, 'Datacenter')
datacenters.each { |dc|