Sha256: bc659764fb4f1543329c259e20055382dde31167e60b6941f8dd338599195d79

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

# -*- coding: utf-8 -*-

module Dcmgr
  module Scheduler
    module StorageNode

      # Find storage node which has the largest available disk space.
      class LeastUsage < StorageNodeScheduler
        include Dcmgr::Logger
        
        def schedule(volume)
          storage_node = Models::StorageNode.online_nodes.all.find_all { |s|
            s.free_disk_space >= volume.size
          }.sort_by { |s|
            s.free_disk_space
          }.reverse.first
          raise StorageNodeSchedulingError if storage_node.nil?
          volume.storage_node = storage_node
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
wakame-vdc-agents-11.12.0 lib/dcmgr/scheduler/storage_node/least_usage.rb
wakame-vdc-dcmgr-11.12.0 lib/dcmgr/scheduler/storage_node/least_usage.rb