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

Bug #1213: Handle errors when listing aggregated resources and zone resources when one or several zones are down.

This commit is contained in:
Hector Sanjuan 2012-04-30 13:48:40 +02:00
parent 0e02730af8
commit a935e147fb
2 changed files with 14 additions and 10 deletions

View File

@ -34,26 +34,24 @@ module OZones
zone_pool_hash = zone.to_hash["ZONE"]
client = OpenNebula::Client.new("#{zone.ONENAME}:#{zone.ONEPASS}",
zone.ENDPOINT)
client = OpenNebula::Client.new("#{zone.ONENAME}:#{zone.ONEPASS}",
zone.ENDPOINT)
pool = factory(client)
if OpenNebula.is_error?(pool)
zone_pool_hash.merge!(pool.to_hash)
next
end
rc = pool.info
if !rc
zone_pool_hash.merge!(pool.to_hash)
elsif OpenNebula.is_error?(rc)
error = "Error communicating with #{zone.NAME}."
error << " Retrieving #{self.class.name.split('::').last}: "
error << "#{rc.to_str}"
zone_pool_hash.merge!({:error => {:message => error}})
else
zone_pool_hash.merge!(rc.to_hash)
end
@sup_aggregated_pool[@tag]["ZONE"] << zone_pool_hash
}
end

View File

@ -199,7 +199,13 @@ module OZones
return [404, error.to_json]
end
pool.info
rc = pool.info
if OpenNebula.is_error?(rc)
error = "Error communicating with #{@zone.NAME}."
error << " Retrieving #{pool_kind} pool: "
error << "#{rc.to_str}"
return [500, OZones::Error.new(error).to_json]
end
return [200, pool.to_json]
end