Class: OsCtld::CGroup::ContainerParams

Inherits:
Params
  • Object
show all
Defined in:
lib/osctld/cgroup/container_params.rb

Instance Attribute Summary

Attributes inherited from Params

#owner, #params

Instance Method Summary collapse

Methods inherited from Params

#detect, #dump, #dup, #each, #import, #initialize, load, #replace, #reset, #reset_value, #unset

Methods included from Lockable

#exclusively, included, #inclusively, #init_lock, #lock, #unlock

Constructor Details

This class inherits a constructor from OsCtld::CGroup::Params

Instance Method Details

#apply(keep_going: false) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/osctld/cgroup/container_params.rb', line 12

def apply(keep_going: false)
  super

  if owner.running?
    params.each do |p|
      path = File.join(yield(p.subsystem), 'user-owned', 'lxc', owner.id, p.name)

      begin
        CGroup.set_param(path, p.value)

      rescue CGroupFileNotFound
        next
      end
    end
  end
end

#set(*args) ⇒ Object



5
6
7
8
9
10
# File 'lib/osctld/cgroup/container_params.rb', line 5

def set(*args)
  owner.exclusively do
    super
    owner.lxc_config.configure_cgparams
  end
end