class PackerFiles::Virtual::VMWare
Abstraction for VMWare
builder in Packer. Refer to Packer.io documentation on more details on the various variables for VMWare
ISO Builder
.
Public Class Methods
new() { |self| ... }
click to toggle source
Constructor. Supports the standard block semantics via yield
# File lib/PackerFiles/Virtual/VMWare.rb, line 64 def initialize(&block) self.type = 'vmware-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 VMX commands and set vmx_data accordingly
# File lib/PackerFiles/Virtual/VMWare.rb, line 71 def Hypervisor(hyper) value = Hash.new value['numvcpus'] = hyper.cpu_count.to_s value['vcpu.hotadd'] = true_false(hyper.cpu_hot_plug) value['memsize'] = MiB(hyper.ram_size).to_s value['mem.hotadd'] = 'TRUE' value['svga.vramsize'] = Bytes(MiB(hyper.video_ram_size)).to_s value['acpi.present'] = true_false(hyper.acpi_enabled) value['paevm'] = true_false(hyper.pae_enabled) value['vhv.enable'] = true_false(hyper.hw_virt_enabled) value['monitor_control.disable_mmu_largepages'] = true_false(!hyper.use_large_pages) value['mks.enable3d'] = true_false(hyper.video_3d_acceleration) value['firmware'] = 'efi' if (hyper.use_efi) value['sched.mem.maxmemctl'] = MiB(hyper.guest_balloon_size) # CPU Speed limit is done by converting any value into MHZ value['sched.cpu.max'] = MiB(hyper.cpu_speed) value['sched.cpu.units'] = 'mhz' #NOTE: CPU Execution Cap is not supported in VMX File settings. #NOTE: Extended Page Table [Nested Paging] is enabled because of VHV. #NOTE: Unrestricted Guest Mode is enabled because of VHV. self.vmx_data = value end
Private Instance Methods
true_false(value)
click to toggle source
Convert a boolean to a TRUE/FALSE string
# File lib/PackerFiles/Virtual/VMWare.rb, line 98 def true_false(value) return "TRUE" if (value) return "FALSE" if (!value) end