Class: Dcmgr::Scheduler::HostNode::SpecifyNode

Inherits:
Dcmgr::Scheduler::HostNodeScheduler show all
Includes:
Logger
Defined in:
lib/dcmgr/scheduler/host_node/specify_node.rb

Overview

Find host node which has the same request_params.

Instance Method Summary collapse

Methods included from Logger

create, default_logdev, included

Methods inherited from Dcmgr::Scheduler::HostNodeScheduler

#initialize

Constructor Details

This class inherits a constructor from Dcmgr::Scheduler::HostNodeScheduler

Instance Method Details

#schedule(instance) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dcmgr/scheduler/host_node/specify_node.rb', line 11

def schedule(instance)
  # TODO:
  #  "host_id" and "host_pool_id" will be obsolete.
  #  They are used in lib/dcmgr/endpoints/core_api.rb.
  host_node_uuid = instance.request_params['host_id'] || instance.request_params['host_pool_id'] || instance.request_params['host_node_id']
  ds = Models::HostNode.online_nodes.filter(:uuid=>Models::HostNode.trim_uuid(host_node_uuid))

  host_node = ds.first

  raise HostNodeSchedulingError if host_node.nil?
  instance.host_node = host_node
end