Sha256: 2f61c863647717f95ae0b512b5f2ddbc1e6d735ac504ade3c247e738fd2f595c

Contents?: true

Size: 611 Bytes

Versions: 2

Compression:

Stored size: 611 Bytes

Contents

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

module Dcmgr
  module Scheduler
    module HostNode

      class ExcludeSame < HostNodeScheduler
        include Dcmgr::Logger

        def schedule(instance)
          ds = Models::HostNode.online_nodes.filter(:arch=>instance.spec.arch,
                                                    :hypervisor=>instance.spec.hypervisor)

          host_node = ds.all.find_all { |hn|
            hn.node_id != instance.host_node.node_id
          }.first

          raise HostNodeSchedulingError if host_node.nil?
          instance.host_node = host_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/host_node/exclude_same.rb
wakame-vdc-dcmgr-11.12.0 lib/dcmgr/scheduler/host_node/exclude_same.rb