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:
parent
0e02730af8
commit
a935e147fb
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user