Module: VirtualBox::VM::GeneralSettings
- Included in:
- VirtualBox::VM
- Defined in:
- lib/virtual_box/vm/general_settings.rb
Overview
Mix-in for the VM class covering the general VM settings.
Instance Attribute Summary collapse
-
#accelerate_3d ⇒ Object
Whether the VM supports 3D acceleration.
-
#acpi ⇒ Object
Whether the VM supports ACPI.
-
#bios_boot_menu ⇒ Object
Whether the BIOS allows the user to temporarily override the boot VM device.
-
#bios_logo_display_time ⇒ Object
The number of seconds to display the BIOS logo when the VM boots.
-
#bios_logo_fade_in ⇒ Object
Whether the BIOS logo will fade in when the VM boots.
-
#bios_logo_fade_out ⇒ Object
Whether the BIOS logo will fade out when the VM boots.
-
#boot_order ⇒ Object
Indicates the boot device search order for the VM’s BIOS.
-
#hardware_virtualization ⇒ Object
Whether the VM attempts to use hardware support (Intel VT-x or AMD-V).
-
#io_apic ⇒ Object
Whether the VM supports I/O APIC.
-
#nested_paging ⇒ Object
Whether the VM uses hardware support for nested paging.
-
#pae ⇒ Object
Whether the VM supports PAE (36-bit address space).
-
#ram ⇒ Object
The amount of megabytes of RAM in the VM.
-
#tagged_tlb ⇒ Object
Whether the VM uses hardware support for tagged TLB (VPID).
-
#video_ram ⇒ Object
The amount of megabytes of video RAM in the VM.
Instance Method Summary collapse
-
#modifyvm_general_params ⇒ Object
Arguments to “VBoxManage modifyvm” describing the VM’s general settings.
-
#reset_general_settings ⇒ Object
Resets the VM’s general settings to their defaults.
Instance Attribute Details
#accelerate_3d ⇒ Object
Whether the VM supports 3D acceleration.
3D acceleration will only work with the proper guest extensions.
49 50 51 |
# File 'lib/virtual_box/vm/general_settings.rb', line 49 def accelerate_3d @accelerate_3d end |
#acpi ⇒ Object
Whether the VM supports ACPI.
24 25 26 |
# File 'lib/virtual_box/vm/general_settings.rb', line 24 def acpi @acpi end |
#bios_boot_menu ⇒ Object
Whether the BIOS allows the user to temporarily override the boot VM device.
If false, no override is allowed. Otherwise, the user can press F12 at boot time to select a boot device. The user gets a prompt at boot time if the value is true. If the value is :menu_only the user does not get a prompt, but can still press F12 to select a device.
63 64 65 |
# File 'lib/virtual_box/vm/general_settings.rb', line 63 def end |
#bios_logo_display_time ⇒ Object
The number of seconds to display the BIOS logo when the VM boots.
56 57 58 |
# File 'lib/virtual_box/vm/general_settings.rb', line 56 def bios_logo_display_time @bios_logo_display_time end |
#bios_logo_fade_in ⇒ Object
Whether the BIOS logo will fade in when the VM boots.
52 53 54 |
# File 'lib/virtual_box/vm/general_settings.rb', line 52 def bios_logo_fade_in @bios_logo_fade_in end |
#bios_logo_fade_out ⇒ Object
Whether the BIOS logo will fade out when the VM boots.
54 55 56 |
# File 'lib/virtual_box/vm/general_settings.rb', line 54 def bios_logo_fade_out @bios_logo_fade_out end |
#boot_order ⇒ Object
Indicates the boot device search order for the VM’s BIOS.
This is an array that can contain the following symbols: :floppy, :dvd, :disk, :net. Symbols should not be repeated.
68 69 70 |
# File 'lib/virtual_box/vm/general_settings.rb', line 68 def boot_order @boot_order end |
#hardware_virtualization ⇒ Object
Whether the VM attempts to use hardware support (Intel VT-x or AMD-V).
Hardware virtualization can increase VM performance, especially used in conjunction with the other hardware virtualization options. However, using hardware virtualzation in conjunction with other hypervisors can crash the host machine.
36 37 38 |
# File 'lib/virtual_box/vm/general_settings.rb', line 36 def hardware_virtualization @hardware_virtualization end |
#io_apic ⇒ Object
Whether the VM supports I/O APIC.
This is necessary for 64-bit OSes, but makes the virtualization slower.
28 29 30 |
# File 'lib/virtual_box/vm/general_settings.rb', line 28 def io_apic @io_apic end |
#nested_paging ⇒ Object
Whether the VM uses hardware support for nested paging.
The option is used only if hardware_virtualization is set.
40 41 42 |
# File 'lib/virtual_box/vm/general_settings.rb', line 40 def nested_paging @nested_paging end |
#pae ⇒ Object
Whether the VM supports PAE (36-bit address space).
22 23 24 |
# File 'lib/virtual_box/vm/general_settings.rb', line 22 def pae @pae end |
#ram ⇒ Object
The amount of megabytes of RAM in the VM.
17 18 19 |
# File 'lib/virtual_box/vm/general_settings.rb', line 17 def ram @ram end |
#tagged_tlb ⇒ Object
Whether the VM uses hardware support for tagged TLB (VPID).
The option is used only if hardware_virtualization is set.
44 45 46 |
# File 'lib/virtual_box/vm/general_settings.rb', line 44 def tagged_tlb @tagged_tlb end |
#video_ram ⇒ Object
The amount of megabytes of video RAM in the VM.
19 20 21 |
# File 'lib/virtual_box/vm/general_settings.rb', line 19 def video_ram @video_ram end |
Instance Method Details
#modifyvm_general_params ⇒ Object
Arguments to “VBoxManage modifyvm” describing the VM’s general settings.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/virtual_box/vm/general_settings.rb', line 96 def modifyvm_general_params params = '' params << " --memory #{ram}" params << " --vram #{video_ram}" params << " --pae #{pae ? 'on' : 'off'}" params << " --acpi #{acpi ? 'on' : 'off'}" params << " --io_apic #{io_apic ? 'on' : 'off'}" params << " --hwvirtex #{hardware_virtualization ? 'on' : 'off'}" nested_paging_enabled = hardware_virtualization && nested_paging params << " --nestedpaging #{nested_paging_enabled ? 'on' : 'off'}" tagged_tlb_enabled = hardware_virtualization && tagged_tlb params << " --vtxvpid #{tagged_tlb_enabled ? 'on' : 'off'}" params << " --bioslogofadein #{@bios_logo_fade_in ? 'on' : 'off'}" params << " --bioslogofadeout #{@bios_logo_fade_out ? 'on' : 'off'}" params << " --bioslogodisplaytime #{@bios_logo_display_time}" = case when false 'disabled' when true 'messageandmenu' when :menu_only 'message' else nil end params << " --biosbootmenu #{bios_boot_menu_str}" unique_boot_order = boot_order.uniq 1.upto(4) do |i| params << " --boot#{i} #{unique_boot_order[i - 1] || 'none'}" end params end |
#reset_general_settings ⇒ Object
Resets the VM’s general settings to their defaults.
The defaults are chosen somewhat arbitrarily by the gem’s author.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/virtual_box/vm/general_settings.rb', line 73 def reset_general_settings self.ram = 512 self.video_ram = 12 self.pae = false self.acpi = true self.io_apic = false self.hardware_virtualization = true self.nested_paging = true self.tagged_tlb = true self.accelerate_3d = false self.bios_logo_fade_in = false self.bios_logo_fade_out = false self.bios_logo_display_time = 0 self. = false self.boot_order = [:disk, :net, :dvd] end |