Class: Distem::Node::CPUForge

Inherits:
Forge
  • Object
show all
Defined in:
lib/distem/node/cpuforge.rb

Overview

Allows to modify CPU physical resources to fit with the virtual resources specifications

Instance Attribute Summary

Attributes inherited from Forge

#algorithm, #resource

Instance Method Summary (collapse)

Methods inherited from Forge

#apply, #undo

Constructor Details

- (CPUForge) initialize(vnode, algorithm = Algorithm::CPU::HOGS)

Create a new CPUForge specifying the virtual node resource to modify (limit) and the algorithm to use

Attributes

  • vnode The VNode object

  • algorithm The Algorithm::CPU object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/distem/node/cpuforge.rb', line 13

def initialize(vnode, algorithm=Algorithm::CPU::HOGS)
  #raise unless algorithm.is_a?(Algorithm::CPU)
  
  case algorithm.upcase
    when Algorithm::CPU::GOV.upcase
      algorithm = Algorithm::CPU::Gov.new
    when Algorithm::CPU::HOGS.upcase
      algorithm = Algorithm::CPU::Hogs.new
    else
      algorithm = Algorithm::CPU::Hogs.new
  end

  super(vnode,algorithm)
end