Class: OsCtld::ContainerControl::Commands::State::Frontend

Inherits:
Frontend
  • Object
show all
Defined in:
lib/osctld/container_control/commands/state.rb

Instance Attribute Summary

Attributes inherited from Frontend

#command_class, #ct

Instance Method Summary collapse

Methods inherited from Frontend

#exec_runner, #fork_runner, #initialize

Constructor Details

This class inherits a constructor from OsCtld::ContainerControl::Frontend

Instance Method Details

#executeContainerState

Returns:



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

def execute
  unless CGroup.abs_cgroup_path_exist?('memory', ct.cgroup_path)
    # If the container's memory cgroup does not exist, it is safe to say
    # that it is not running and we don't have to fork.
    return ContainerState.new(ct.id, :stopped, nil)
  end

  ret = fork_runner

  if ret.ok?
    ContainerState.new(ct.id, ret.data[:state].to_sym, ret.data[:init_pid])
  else
    ret
  end
end