Class: Vagrant::LXC::Config
- Inherits:
-
Object
- Object
- Vagrant::LXC::Config
- Defined in:
- lib/vagrant-lxc/config.rb
Instance Attribute Summary collapse
-
#backingstore ⇒ Object
A string that contains the backing store type used with lxc-create -B.
-
#backingstore_options ⇒ Array
Optional arguments for the backing store, such as –fssize, –fstype, …
-
#container_name ⇒ Object
A string to explicitly set the container name.
-
#customizations ⇒ Array
readonly
An array of container’s configuration overrides to be provided to ‘lxc-start`.
Instance Method Summary collapse
-
#backingstore_option(key, value) ⇒ Object
Stores options for backingstores like lvm, btrfs, etc.
-
#customize(key, value) ⇒ Object
Customize the container by calling ‘lxc-start` with the given configuration overrides.
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
21 22 23 24 25 26 27 |
# File 'lib/vagrant-lxc/config.rb', line 21 def initialize @customizations = [] @backingstore = UNSET_VALUE @backingstore_options = [] @sudo_wrapper = UNSET_VALUE @container_name = UNSET_VALUE end |
Instance Attribute Details
#backingstore ⇒ Object
A string that contains the backing store type used with lxc-create -B
10 11 12 |
# File 'lib/vagrant-lxc/config.rb', line 10 def backingstore @backingstore end |
#backingstore_options ⇒ Array
Optional arguments for the backing store, such as –fssize, –fstype, …
15 16 17 |
# File 'lib/vagrant-lxc/config.rb', line 15 def @backingstore_options end |
#container_name ⇒ Object
A string to explicitly set the container name. To use the vagrant machine name, set this to :machine
19 20 21 |
# File 'lib/vagrant-lxc/config.rb', line 19 def container_name @container_name end |
#customizations ⇒ Array (readonly)
An array of container’s configuration overrides to be provided to ‘lxc-start`.
7 8 9 |
# File 'lib/vagrant-lxc/config.rb', line 7 def customizations @customizations end |
Instance Method Details
#backingstore_option(key, value) ⇒ Object
Stores options for backingstores like lvm, btrfs, etc
45 46 47 |
# File 'lib/vagrant-lxc/config.rb', line 45 def backingstore_option(key, value) @backingstore_options << [key, value] end |
#customize(key, value) ⇒ Object
Customize the container by calling ‘lxc-start` with the given configuration overrides.
For example, if you want to set the memory limit, you can use it like: config.customize ‘cgroup.memory.limit_in_bytes’, ‘400M’
When ‘lxc-start`ing the container, vagrant-lxc will pass in “-s lxc.cgroup.memory.limit_in_bytes=400M” to it.
40 41 42 |
# File 'lib/vagrant-lxc/config.rb', line 40 def customize(key, value) @customizations << [key, value] end |
#finalize! ⇒ Object
49 50 51 52 53 54 |
# File 'lib/vagrant-lxc/config.rb', line 49 def finalize! @sudo_wrapper = nil if @sudo_wrapper == UNSET_VALUE @container_name = nil if @container_name == UNSET_VALUE @backingstore = "best" if @backingstore == UNSET_VALUE @existing_container_name = nil if @existing_container_name == UNSET_VALUE end |