Class: VagrantPlugins::ProviderBhyve::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/vagrant-bhyve/config.rb', line 29

def initialize
	@cpus			= UNSET_VALUE
	@memory			= UNSET_VALUE
	@pcis			= UNSET_VALUE
	@lpc			= UNSET_VALUE
	@hostbridge		= UNSET_VALUE
	@disks			= []
	@cdroms			= []
	#@grub_config_file	= ''
	#@grub_run_partition	= ''
	#@grub_run_dir 		= ''
end

Instance Attribute Details

#cdromsObject

Returns the value of attribute cdroms.



27
28
29
# File 'lib/vagrant-bhyve/config.rb', line 27

def cdroms
  @cdroms
end

#cpusObject

Specify the number of virtual CPUs.



15
16
17
# File 'lib/vagrant-bhyve/config.rb', line 15

def cpus
  @cpus
end

#disksObject

Addition storage



26
27
28
# File 'lib/vagrant-bhyve/config.rb', line 26

def disks
  @disks
end

#hostbridgeObject

Returns the value of attribute hostbridge.



24
25
26
# File 'lib/vagrant-bhyve/config.rb', line 24

def hostbridge
  @hostbridge
end

#lpcObject

Specify console device which will be attached to the VM



23
24
25
# File 'lib/vagrant-bhyve/config.rb', line 23

def lpc
  @lpc
end

#memoryObject

Specify the size of guest physical memory.



17
18
19
# File 'lib/vagrant-bhyve/config.rb', line 17

def memory
  @memory
end

#pcisObject

Specify virtual devices will be attached to bhyve’s emulated PCI bus. Network interface and disk will both attched as this kind of devices.



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

def pcis
  @pcis
end

Instance Method Details

#_handle_cdrom_storage(options = {}) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/vagrant-bhyve/config.rb', line 57

def _handle_cdrom_storage(options={})
	options = {
	  path: nil,
	  name: nil,
	  size: "20G",
	  format: "raw",
	}.merge(options)

	disk = {
	  path: options[:path],
	  size: options[:size],
	}

	@disks << disk
end

#_handle_disk_storage(options = {}) ⇒ Object



50
51
52
53
54
55
# File 'lib/vagrant-bhyve/config.rb', line 50

def _handle_disk_storage(options={})
	cdrom = {
	  path: options[:path]
	}
	@cdroms << cdrom
end

#storage(options = {}) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/vagrant-bhyve/config.rb', line 42

def storage(options={})
	if options[:device] == :cdrom
	  _handle_cdrom_storage(options)
	elsif options[:device] == :disk
	  _handle_disk_storage(options)
	end
end