Class: PackerFiles::Virtual::VMWare
- Inherits:
-
Utils::HashSerializer
- Object
- Utils::HashSerializer
- PackerFiles::Virtual::VMWare
- Includes:
- Utils::Size
- Defined in:
- lib/PackerFiles/Virtual/VMWare.rb
Overview
Abstraction for VMWare builder in Packer. Refer to Packer.io documentation on more details on the various variables for VMWare ISO Builder.
Instance Method Summary collapse
-
#Hypervisor(hyper) ⇒ Object
Given an Hypervisor object, convert into a list of VMX commands and set vmx_data accordingly.
-
#initialize {|_self| ... } ⇒ VMWare
constructor
Constructor.
Methods included from Utils::Size
Methods inherited from Utils::HashSerializer
hash_attributes, hash_variable, #merge_hs, #to_hash
Constructor Details
#initialize {|_self| ... } ⇒ VMWare
Constructor. Supports the standard block semantics via yield
64 65 66 67 |
# File 'lib/PackerFiles/Virtual/VMWare.rb', line 64 def initialize(&block) self.type = 'vmware-iso' yield self if block_given? end |
Instance Method Details
#Hypervisor(hyper) ⇒ Object
Given an Hypervisor object, convert into a list of VMX commands and set vmx_data accordingly
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# 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 |