Class: PackerFiles::Core::Hypervisor

Inherits:
Object
  • Object
show all
Defined in:
lib/PackerFiles/Core/Hypervisor.rb

Overview

The Hypervisor class just abstracts out various settings that are applicable on Hypervisors. It is upto the providers to ensure that the appropriate Packer variables are generated for these settings.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Hypervisor

Constructor initializes some sane values for various parameters.

Yields:

  • (_self)

Yield Parameters:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 68

def initialize
   @cpu_count               = 1
   @cpu_speed               = '1GHz'
   @cpu_hot_plug            = false
   @cpu_execution_cap       = 100
   @ram_size	             = '1GiB'
   @video_ram_size          = '64MiB'
   @acpi_enabled            = true
   @pae_enabled             = true
   @hw_virt_enabled         = true
   @use_large_pages         = true
   @unrestricted_guest_mode = false
   @video_3d_acceleration   = false
   @use_efi		     = false
   @guest_balloon_size      = '0MiB'
   @custom                  = nil
   yield self if block_given?
end

Instance Attribute Details

#acpi_enabledObject

Is ACPI enabled?



32
33
34
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 32

def acpi_enabled
  @acpi_enabled
end

#cpu_countObject

CPU count



14
15
16
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 14

def cpu_count
  @cpu_count
end

#cpu_execution_capObject

CPU Execution Cap



23
24
25
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 23

def cpu_execution_cap
  @cpu_execution_cap
end

#cpu_hot_plugObject

Enable CPU Hot plug?



20
21
22
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 20

def cpu_hot_plug
  @cpu_hot_plug
end

#cpu_speedObject

CPU Speed



17
18
19
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 17

def cpu_speed
  @cpu_speed
end

#customObject (readonly)

it suits the caller



60
61
62
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 60

def custom
  @custom
end

#guest_balloon_sizeObject

Guest memory balloon size



56
57
58
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 56

def guest_balloon_size
  @guest_balloon_size
end

#hw_nested_pagesObject

Should nested paging for guest be enabled



41
42
43
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 41

def hw_nested_pages
  @hw_nested_pages
end

#hw_virt_enabledObject

Should H/w Virtualization for Guest be enabled



38
39
40
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 38

def hw_virt_enabled
  @hw_virt_enabled
end

#pae_enabledObject

Should PAE (Processor Address Extensions) enabled?



35
36
37
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 35

def pae_enabled
  @pae_enabled
end

#ram_sizeObject

RAM Size



26
27
28
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 26

def ram_size
  @ram_size
end

#unrestricted_guest_modeObject

Should the guest run in unrestricted mode



47
48
49
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 47

def unrestricted_guest_mode
  @unrestricted_guest_mode
end

#use_efiObject

Should EFI firmware be used instead of bios



53
54
55
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 53

def use_efi
  @use_efi
end

#use_large_pagesObject

Should Hypervisor use large pages for this guest



44
45
46
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 44

def use_large_pages
  @use_large_pages
end

#video_3d_accelerationObject

Should 3d acceleration be enabled for Video



50
51
52
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 50

def video_3d_acceleration
  @video_3d_acceleration
end

#video_ram_sizeObject

Video ram size



29
30
31
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 29

def video_ram_size
  @video_ram_size
end

Class Method Details

.doc_fileObject

Documentation for this class



63
64
65
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 63

def self.doc_file
   PackerFiles.DirPath('Core/example/Hypervisor.txt').first
end

Instance Method Details

#Custom(&block) ⇒ Object

The Custom object is filled with whatever is the result of the block



88
89
90
# File 'lib/PackerFiles/Core/Hypervisor.rb', line 88

def Custom(&block)
	    @custom = block.call(self)
end