Class: PackerFiles::Virtual::VirtualBox
- Inherits:
-
Utils::HashSerializer
- Object
- Utils::HashSerializer
- PackerFiles::Virtual::VirtualBox
- Includes:
- Utils::Size
- Defined in:
- lib/PackerFiles/Virtual/VirtualBox.rb
Overview
Abstraction for VirtualBox builder in Packer. Refer to Packer.io documentation on more details on the various variables for VirtualBox ISO Builder.
Instance Method Summary collapse
-
#Hypervisor(hyper) ⇒ Object
Given an Hypervisor object, convert into a list of VBoxmanage commands and set vboxmanage attribute accordingly.
-
#initialize {|_self| ... } ⇒ VirtualBox
constructor
Constructor.
Methods included from Utils::Size
Methods inherited from Utils::HashSerializer
hash_attributes, hash_variable, #merge_hs, #to_hash
Constructor Details
#initialize {|_self| ... } ⇒ VirtualBox
Constructor. Supports the standard block semantics via yield
59 60 61 62 |
# File 'lib/PackerFiles/Virtual/VirtualBox.rb', line 59 def initialize(&block) self.type = 'virtualbox-iso' yield self if block_given? end |
Instance Method Details
#Hypervisor(hyper) ⇒ Object
Given an Hypervisor object, convert into a list of VBoxmanage commands and set vboxmanage attribute accordingly.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/PackerFiles/Virtual/VirtualBox.rb', line 66 def Hypervisor(hyper) value = Array.new std = ["modifyvm", "{{.Name}}"] value << std + ["--cpus", hyper.cpu_count.to_s] value << std + ["--cpuhotplug", on_off(hyper.cpu_hot_plug)] value << std + ["--cpuexecutioncap", hyper.cpu_execution_cap.to_s] value << std + ["--memory", MiB(hyper.ram_size).to_s] value << std + ["--vram", MiB(hyper.video_ram_size).to_s] value << std + ["--acpi", on_off(hyper.acpi_enabled)] value << std + ["--pae", on_off(hyper.pae_enabled)] value << std + ["--hwvirtex", on_off(hyper.hw_virt_enabled)] value << std + ["--nestedpaging", on_off(hyper.hw_virt_enabled)] value << std + ["--vtxvpid", on_off(hyper.hw_virt_enabled)] value << std + ["--largepages", on_off(hyper.use_large_pages)] value << std + ["--vtxux", on_off(hyper.unrestricted_guest_mode)] value << std + ["--accelerate3d", on_off(hyper.video_3d_acceleration)] value << std + ["--firmware","efi"] if (hyper.use_efi) value << std + ["--guestmemoryballoon", MiB(hyper.guest_balloon_size).to_s] self.vboxmanage = value end |