Class: Haconiwa::Base
Instance Attribute Summary collapse
-
#attached_capabilities ⇒ Object
Returns the value of attribute attached_capabilities.
-
#capabilities ⇒ Object
Returns the value of attribute capabilities.
-
#cgroup ⇒ Object
Returns the value of attribute cgroup.
-
#container_pid_file ⇒ Object
Returns the value of attribute container_pid_file.
-
#filesystem ⇒ Object
Returns the value of attribute filesystem.
-
#init_command ⇒ Object
Returns the value of attribute init_command.
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#pid ⇒ Object
Returns the value of attribute pid.
Class Method Summary collapse
Instance Method Summary collapse
- #add_mount_point(point, options) ⇒ Object
- #attach(*run_command) ⇒ Object
-
#chroot_to(dest) ⇒ Object
aliases.
- #default_container_pid_file ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #mount_independent_procfs ⇒ Object
- #start(*init_command) ⇒ Object (also: #run)
Methods included from Utils
Constructor Details
#initialize ⇒ Base
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/haconiwa/base.rb', line 24 def initialize @filesystem = Filesystem.new @cgroup = CGroup.new @namespace = Namespace.new @capabilities = Capabilities.new @attached_capabilities = nil @name = "haconiwa-#{Time.now.to_i}" @init_command = "/bin/bash" # FIXME: maybe /sbin/init is better @container_pid_file = nil @pid = nil end |
Instance Attribute Details
#attached_capabilities ⇒ Object
Returns the value of attribute attached_capabilities.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def attached_capabilities @attached_capabilities end |
#capabilities ⇒ Object
Returns the value of attribute capabilities.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def capabilities @capabilities end |
#cgroup ⇒ Object
Returns the value of attribute cgroup.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def cgroup @cgroup end |
#container_pid_file ⇒ Object
Returns the value of attribute container_pid_file.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def container_pid_file @container_pid_file end |
#filesystem ⇒ Object
Returns the value of attribute filesystem.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def filesystem @filesystem end |
#init_command ⇒ Object
Returns the value of attribute init_command.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def init_command @init_command end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def namespace @namespace end |
#pid ⇒ Object
Returns the value of attribute pid.
10 11 12 |
# File 'lib/haconiwa/base.rb', line 10 def pid @pid end |
Class Method Details
.define(&b) ⇒ Object
20 21 22 |
# File 'lib/haconiwa/base.rb', line 20 def self.define(&b) new.tap(&b) end |
Instance Method Details
#add_mount_point(point, options) ⇒ Object
41 42 43 44 |
# File 'lib/haconiwa/base.rb', line 41 def add_mount_point(point, ) self.namespace.unshare "mount" self.filesystem.mount_points << MountPoint.new(point, ) end |
#attach(*run_command) ⇒ Object
57 58 59 60 |
# File 'lib/haconiwa/base.rb', line 57 def attach(*run_command) self.container_pid_file ||= default_container_pid_file Runners::Linux.attach(self, run_command) end |
#chroot_to(dest) ⇒ Object
aliases
37 38 39 |
# File 'lib/haconiwa/base.rb', line 37 def chroot_to(dest) self.filesystem.chroot = dest end |
#default_container_pid_file ⇒ Object
62 63 64 |
# File 'lib/haconiwa/base.rb', line 62 def default_container_pid_file "/var/run/haconiwa-#{@name}.pid" end |
#mount_independent_procfs ⇒ Object
46 47 48 49 |
# File 'lib/haconiwa/base.rb', line 46 def mount_independent_procfs self.namespace.unshare "mount" self.filesystem.mount_independent_procfs = true end |