Class: VagrantPlugins::HYPERKIT::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-hyperkit/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(region_specific = false) ⇒ Config

Returns a new instance of Config.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/vagrant-hyperkit/config.rb', line 47

def initialize(region_specific=false)
  @cpus           = UNSET_VALUE
  @memory         = UNSET_VALUE
  @xhyve_binary   = UNSET_VALUE
  @mac            = UNSET_VALUE
  @uuid           = UNSET_VALUE
  @kernel_command = UNSET_VALUE

  # Internal state (prefix with __ so they aren't automatically
  # merged)
  @__compiled_region_configs = {}
  @__finalized = false
  @__region_config = {}
  @__region_specific = region_specific
end

Instance Attribute Details

#cpusFixnum

The number of CPUs to give the VM

Returns:

  • (Fixnum)


12
13
14
# File 'lib/vagrant-hyperkit/config.rb', line 12

def cpus
  @cpus
end

#kernel_commandString

The kernel command to initialize the machine The default command assumes that the instalation is done directly on the disk and not using a lvm. For example, by default, Centos intallation uses LVM. Moreover, it might be interesting to add new kernel options.

Returns:

  • (String)


45
46
47
# File 'lib/vagrant-hyperkit/config.rb', line 45

def kernel_command
  @kernel_command
end

#macString

The mac address of the VM

Returns:

  • (String)


33
34
35
# File 'lib/vagrant-hyperkit/config.rb', line 33

def mac
  @mac
end

#memoryString

The amount of memory to give the VM

This can just be a simple integer for memory in MB or you can use the suffixed style, eg. 2G for two Gigabytes

Returns:

  • (String)


21
22
23
# File 'lib/vagrant-hyperkit/config.rb', line 21

def memory
  @memory
end

#uuidString

The uuid of the VM

Returns:

  • (String)


38
39
40
# File 'lib/vagrant-hyperkit/config.rb', line 38

def uuid
  @uuid
end

#xhyve_binaryString

The path to the xhyve binary if you don’t want to use the one bundled with xhyve-ruby

Returns:

  • (String)


28
29
30
# File 'lib/vagrant-hyperkit/config.rb', line 28

def xhyve_binary
  @xhyve_binary
end

Instance Method Details

#finalize!Object


Internal methods.




67
68
69
70
71
72
73
74
75
# File 'lib/vagrant-hyperkit/config.rb', line 67

def finalize!

  @cpus = 1 if @cpus == UNSET_VALUE
  @memory = 1024 if @memory == UNSET_VALUE
  @xhyve_binary = nil if @xhyve_binary == UNSET_VALUE
  @kernel_command = %Q{"earlyprintk=serial console=ttyS0 root=/dev/vda1 ro"} if @kernel_command == UNSET_VALUE
  # Mark that we finalized
  @__finalized = true
end

#validate(machine) ⇒ Object



77
78
79
80
# File 'lib/vagrant-hyperkit/config.rb', line 77

def validate(machine)
  errors = _detected_errors
  { "XHYVE Provider" => errors }
end