diff --git a/src/ozones/Server/lib/OZones/AggregatedPool.rb b/src/ozones/Server/lib/OZones/AggregatedPool.rb index 6ac96ce8a8..b098b8d1bb 100644 --- a/src/ozones/Server/lib/OZones/AggregatedPool.rb +++ b/src/ozones/Server/lib/OZones/AggregatedPool.rb @@ -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 diff --git a/src/ozones/Server/lib/OZones/Zones.rb b/src/ozones/Server/lib/OZones/Zones.rb index 95300c0d0d..34b48e655a 100644 --- a/src/ozones/Server/lib/OZones/Zones.rb +++ b/src/ozones/Server/lib/OZones/Zones.rb @@ -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