class PackerFiles::Virtual::VirtualBox
Abstraction for VirtualBox
builder in Packer. Refer to Packer.io documentation on more details on the various variables for VirtualBox
ISO Builder
.
Public Class Methods
new() { |self| ... }
click to toggle source
Constructor. Supports the standard block semantics via yield
# File lib/PackerFiles/Virtual/VirtualBox.rb, line 59 def initialize(&block) self.type = 'virtualbox-iso' yield self if block_given? end
Public Instance Methods
Hypervisor(hyper)
click to toggle source
Given an Hypervisor
object, convert into a list of VBoxmanage commands and set vboxmanage attribute accordingly.
# 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
Private Instance Methods
on_off(value)
click to toggle source
Convert a boolean to a on/off string
# File lib/PackerFiles/Virtual/VirtualBox.rb, line 89 def on_off(value) return "on" if (value) return "off" if (!value) end