Class: OsCtl::ExportFS::Operations::Server::CGroup

Inherits:
Base
  • Object
show all
Defined in:
lib/osctl/exportfs/operations/server/cgroup.rb

Constant Summary collapse

PATH =
'osctl/exportfs/server'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#execute, run

Constructor Details

#initialize(server) ⇒ CGroup

Returns a new instance of CGroup.

Parameters:



8
9
10
11
12
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 8

def initialize(server)
  super()
  @server = server
  @cgroup = OsCtl::ExportFS::CGroup.new(PATH)
end

Instance Attribute Details

#cgroupObject (readonly, protected)

Returns the value of attribute cgroup.



51
52
53
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 51

def cgroup
  @cgroup
end

#serverObject (readonly, protected)

Returns the value of attribute server.



51
52
53
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 51

def server
  @server
end

Instance Method Details

#clear_allObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 33

def clear_all
  begin
    clear_manager
  rescue Errno::ENOENT
    # ignore
  end

  begin
    clear_payload
  rescue Errno::ENOENT
    # ignore
  end

  nil
end

#clear_managerObject



19
20
21
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 19

def clear_manager
  cgroup.destroy(manager_path)
end

#clear_payloadObject



28
29
30
31
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 28

def clear_payload
  cgroup.kill_all_until_empty(payload_path)
  cgroup.destroy(payload_path)
end

#enter_managerObject



14
15
16
17
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 14

def enter_manager
  cgroup.create(manager_path)
  cgroup.enter(manager_path)
end

#enter_payloadObject



23
24
25
26
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 23

def enter_payload
  cgroup.create(payload_path)
  cgroup.enter(payload_path)
end

#manager_pathObject (protected)



57
58
59
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 57

def manager_path
  File.join(server.name, 'manager')
end

#pathObject (protected)



53
54
55
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 53

def path
  server.name
end

#payload_pathObject (protected)



61
62
63
# File 'lib/osctl/exportfs/operations/server/cgroup.rb', line 61

def payload_path
  File.join(server.name, 'payload')
end