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`.
-
#fetch_ip_tries ⇒ Object
Returns the value of attribute fetch_ip_tries.
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.
23 24 25 26 27 28 29 |
# File 'lib/vagrant-lxc/config.rb', line 23 def initialize @customizations = [] @backingstore = UNSET_VALUE = [] @container_name = UNSET_VALUE @fetch_ip_tries = 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 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 |
#fetch_ip_tries ⇒ Object
Returns the value of attribute fetch_ip_tries.
21 22 23 |
# File 'lib/vagrant-lxc/config.rb', line 21 def fetch_ip_tries @fetch_ip_tries end |
Instance Method Details
#backingstore_option(key, value) ⇒ Object
Stores options for backingstores like lvm, btrfs, etc
47 48 49 |
# File 'lib/vagrant-lxc/config.rb', line 47 def backingstore_option(key, value) << [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.
42 43 44 |
# File 'lib/vagrant-lxc/config.rb', line 42 def customize(key, value) @customizations << [key, value] end |
#finalize! ⇒ Object
51 52 53 54 55 56 |
# File 'lib/vagrant-lxc/config.rb', line 51 def finalize! @container_name = nil if @container_name == UNSET_VALUE @backingstore = "best" if @backingstore == UNSET_VALUE @existing_container_name = nil if @existing_container_name == UNSET_VALUE @fetch_ip_tries = 10 if @fetch_ip_tries == UNSET_VALUE end |