plugins/block_storage/app/controllers/block_storage/snapshots_controller.rb
# this method extends volumes with data from cache
this method extends volumes with data from cache
this method extends volumes with data from cache
def extend_snapshot_data(snapshots)
      snapshots = [snapshots] unless snapshots.is_a?(Array)
      volume_ids = snapshots.collect(&:volume_id)
      cached_volumes = ObjectCache.where(id: volume_ids).pluck(:id,:name).each_with_object({}) do |v,map|
        map[v[0]] = v[1]
      end
      snapshots.each do |snapshot|
        if cached_volumes[snapshot.volume_id]
          snapshot.volume_name = cached_volumes[snapshot.volume_id]
        end
      end
    end
def extend_snapshot_data ( snapshots ) snapshots = [ snapshots ] unless snapshots . is_a? ( Array ) volume_ids = snapshots . collect ( & :volume_id ) cached_volumes = ObjectCache . where ( id : volume_ids ) . pluck ( :id , :name ) . each_with_object ( { } ) do | v , map | map [ v [ 0 ] ] = v [ 1 ] end snapshots . each do | snapshot | if cached_volumes [ snapshot . volume_id ] snapshot . volume_name = cached_volumes [ snapshot . volume_id ] end end end
this method extends volumes with data from cache
this method extends volumes with data from cache
snapshots
<not_specific>