Class: VagrantPlugins::QEMU::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/vagrant-qemu/config.rb', line 27

def initialize
  @ssh_host = UNSET_VALUE
  @ssh_port = UNSET_VALUE
  @ssh_auto_correct = UNSET_VALUE
  @arch = UNSET_VALUE
  @machine = UNSET_VALUE
  @cpu = UNSET_VALUE
  @smp = UNSET_VALUE
  @memory = UNSET_VALUE
  @net_device = UNSET_VALUE
  @drive_interface = UNSET_VALUE
  @image_path = UNSET_VALUE
  @qemu_bin = UNSET_VALUE
  @qemu_dir = UNSET_VALUE
  @extra_qemu_args = UNSET_VALUE
  @extra_netdev_args = UNSET_VALUE
  @control_port = UNSET_VALUE
  @debug_port = UNSET_VALUE
  @no_daemonize = UNSET_VALUE
  @firmware_format = UNSET_VALUE
  @other_default = UNSET_VALUE
end

Instance Attribute Details

#archObject

Returns the value of attribute arch.



9
10
11
# File 'lib/vagrant-qemu/config.rb', line 9

def arch
  @arch
end

#control_portObject

Returns the value of attribute control_port.



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

def control_port
  @control_port
end

#cpuObject

Returns the value of attribute cpu.



11
12
13
# File 'lib/vagrant-qemu/config.rb', line 11

def cpu
  @cpu
end

#debug_portObject

Returns the value of attribute debug_port.



22
23
24
# File 'lib/vagrant-qemu/config.rb', line 22

def debug_port
  @debug_port
end

#drive_interfaceObject

Returns the value of attribute drive_interface.



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

def drive_interface
  @drive_interface
end

#extra_netdev_argsObject

Returns the value of attribute extra_netdev_args.



20
21
22
# File 'lib/vagrant-qemu/config.rb', line 20

def extra_netdev_args
  @extra_netdev_args
end

#extra_qemu_argsObject

Returns the value of attribute extra_qemu_args.



19
20
21
# File 'lib/vagrant-qemu/config.rb', line 19

def extra_qemu_args
  @extra_qemu_args
end

#firmware_formatObject

Returns the value of attribute firmware_format.



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

def firmware_format
  @firmware_format
end

#image_pathObject

Returns the value of attribute image_path.



16
17
18
# File 'lib/vagrant-qemu/config.rb', line 16

def image_path
  @image_path
end

#machineObject

Returns the value of attribute machine.



10
11
12
# File 'lib/vagrant-qemu/config.rb', line 10

def machine
  @machine
end

#memoryObject

Returns the value of attribute memory.



13
14
15
# File 'lib/vagrant-qemu/config.rb', line 13

def memory
  @memory
end

#net_deviceObject

Returns the value of attribute net_device.



14
15
16
# File 'lib/vagrant-qemu/config.rb', line 14

def net_device
  @net_device
end

#no_daemonizeObject

Returns the value of attribute no_daemonize.



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

def no_daemonize
  @no_daemonize
end

#other_defaultObject

Returns the value of attribute other_default.



25
26
27
# File 'lib/vagrant-qemu/config.rb', line 25

def other_default
  @other_default
end

#qemu_binObject

Returns the value of attribute qemu_bin.



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

def qemu_bin
  @qemu_bin
end

#qemu_dirObject

Returns the value of attribute qemu_dir.



18
19
20
# File 'lib/vagrant-qemu/config.rb', line 18

def qemu_dir
  @qemu_dir
end

#smpObject

Returns the value of attribute smp.



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

def smp
  @smp
end

#ssh_auto_correctObject

Returns the value of attribute ssh_auto_correct.



8
9
10
# File 'lib/vagrant-qemu/config.rb', line 8

def ssh_auto_correct
  @ssh_auto_correct
end

#ssh_hostObject

Returns the value of attribute ssh_host.



6
7
8
# File 'lib/vagrant-qemu/config.rb', line 6

def ssh_host
  @ssh_host
end

#ssh_portObject

Returns the value of attribute ssh_port.



7
8
9
# File 'lib/vagrant-qemu/config.rb', line 7

def ssh_port
  @ssh_port
end

Instance Method Details

#finalize!Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/vagrant-qemu/config.rb', line 59

def finalize!
  @ssh_host = "127.0.0.1" if @ssh_host == UNSET_VALUE
  @ssh_port = 50022 if @ssh_port == UNSET_VALUE
  @ssh_auto_correct = false if @ssh_auto_correct == UNSET_VALUE
  @arch = "aarch64" if @arch == UNSET_VALUE
  @machine = "virt,accel=hvf,highmem=on" if @machine == UNSET_VALUE
  @cpu = "host" if @cpu == UNSET_VALUE
  @smp = "2" if @smp == UNSET_VALUE
  @memory = "4G" if @memory == UNSET_VALUE
  @net_device = "virtio-net-device" if @net_device == UNSET_VALUE
  @drive_interface = "virtio" if @drive_interface == UNSET_VALUE
  @image_path = nil if @image_path == UNSET_VALUE
  @qemu_bin = nil if @qemu_bin == UNSET_VALUE
  @qemu_dir = "/opt/homebrew/share/qemu" if @qemu_dir == UNSET_VALUE
  @extra_qemu_args = [] if @extra_qemu_args == UNSET_VALUE
  @extra_netdev_args = nil if @extra_netdev_args == UNSET_VALUE
  @control_port = nil if @control_port == UNSET_VALUE
  @debug_port = nil if @debug_port == UNSET_VALUE
  @no_daemonize = false if @no_daemonize == UNSET_VALUE
  @firmware_format = "raw" if @firmware_format == UNSET_VALUE
  @other_default = %W(-parallel null -monitor none -display none -vga none) if @other_default == UNSET_VALUE

  # TODO better error msg
  @ssh_port = Integer(@ssh_port)
end

#merge(other) ⇒ Object


Internal methods.




54
55
56
57
# File 'lib/vagrant-qemu/config.rb', line 54

def merge(other)
  super.tap do |result|
  end
end

#validate(machine) ⇒ Object



85
86
87
88
89
# File 'lib/vagrant-qemu/config.rb', line 85

def validate(machine)
  # errors = _detected_errors
  errors = []
  { "QEMU Provider" => errors }
end