Module: ProxmoxComputeSelectorsHelper

Defined in:
app/helpers/proxmox_compute_selectors_helper.rb

Overview

You should have received a copy of the GNU General Public License along with TheForemanProxmox. If not, see <www.gnu.org/licenses/>.

Instance Method Summary collapse

Instance Method Details

#get_controller(id) ⇒ Object



84
85
86
# File 'app/helpers/proxmox_compute_selectors_helper.rb', line 84

def get_controller(id)
  proxmox_controllers_map.find { |controller| controller.id == id}
end

#proxmox_caches_mapObject



93
94
95
96
97
98
99
# File 'app/helpers/proxmox_compute_selectors_helper.rb', line 93

def proxmox_caches_map
  [OpenStruct.new(id: 'directsync', name: 'Direct sync'),
   OpenStruct.new(id: 'writethrough', name: 'Write through'),
   OpenStruct.new(id: 'writeback', name: 'Write back'),
   OpenStruct.new(id: 'unsafe', name: 'Write back unsafe'),
   OpenStruct.new(id: 'none', name: 'No cache')]
end

#proxmox_controllers_mapObject



21
22
23
24
25
26
# File 'app/helpers/proxmox_compute_selectors_helper.rb', line 21

def proxmox_controllers_map
  [TheForemanProxmox::OptionsSelect.new(id:'ide', name: 'IDE', range: 3), 
    TheForemanProxmox::OptionsSelect.new(id:'sata', name: 'SATA', range: 5), 
    TheForemanProxmox::OptionsSelect.new(id:'scsi', name: 'SCSI', range: 13), 
    TheForemanProxmox::OptionsSelect.new(name:'VirtIO Block', id: 'virtio', range: 15)]
end

#proxmox_cpus_mapObject



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'app/helpers/proxmox_compute_selectors_helper.rb', line 101

def proxmox_cpus_map
  [OpenStruct.new(id: '486', name: '486'),
   OpenStruct.new(id: 'athlon', name: 'athlon'),
   OpenStruct.new(id: 'core2duo', name: 'core2duo'),
   OpenStruct.new(id: 'coreduo', name: 'coreduo'),
   OpenStruct.new(id: 'kvm32', name: 'kvm32'),
   OpenStruct.new(id: 'kvm64', name: '(Default) kvm64'),
   OpenStruct.new(id: 'pentium', name: 'pentium'),
   OpenStruct.new(id: 'pentium2', name: 'pentium2'),
   OpenStruct.new(id: 'pentium3', name: 'pentium3'),
   OpenStruct.new(id: 'phenom', name: 'phenom'),
   OpenStruct.new(id: 'qemu32', name: 'qemu32'),
   OpenStruct.new(id: 'qemu64', name: 'qemu64'),
   OpenStruct.new(id: 'Conroe', name: 'Conroe'),
   OpenStruct.new(id: 'Penryn', name: 'Penryn'),
   OpenStruct.new(id: 'Nehalem', name: 'Nehalem'),
   OpenStruct.new(id: 'Westmere', name: 'Westmere'),
   OpenStruct.new(id: 'SandyBridge', name: 'SandyBridge'),
   OpenStruct.new(id: 'IvyBridge', name: 'IvyBridge'),
   OpenStruct.new(id: 'Haswell', name: 'Haswell'),
   OpenStruct.new(id: 'Haswell-noTSX', name: 'Haswell-noTSX'),
   OpenStruct.new(id: 'Broadwell', name: 'Broadwell'),
   OpenStruct.new(id: 'Broadwell-noTSX', name: 'Broadwell-noTSX'),
   OpenStruct.new(id: 'Skylake-Client', name: 'Skylake-Client'),
   OpenStruct.new(id: 'Opteron_G1', name: 'Opteron_G1'),
   OpenStruct.new(id: 'Opteron_G2', name: 'Opteron_G2'),
   OpenStruct.new(id: 'Opteron_G3', name: 'Opteron_G3'),
   OpenStruct.new(id: 'Opteron_G4', name: 'Opteron_G4'),
   OpenStruct.new(id: 'Opteron_G5', name: 'Opteron_G5'),
   OpenStruct.new(id: 'host', name: 'host')]
end

#proxmox_keyboards_mapObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'app/helpers/proxmox_compute_selectors_helper.rb', line 56

def proxmox_keyboards_map
  [OpenStruct.new(id: 'de', name: 'Deutsch'),
  OpenStruct.new(id: 'de-ch', name: 'Deutsch (Swiss)'),
  OpenStruct.new(id: 'da', name: 'Danish'), 
  OpenStruct.new(id: 'en-gb', name: 'English (UK)'), 
  OpenStruct.new(id: 'en-us', name: 'English (US)'),  
  OpenStruct.new(id: 'es', name: 'Spanish'),
  OpenStruct.new(id: 'fi', name: 'Finnish'), 
  OpenStruct.new(id: 'fr', name: 'French'),
  OpenStruct.new(id: 'fr-be', name: 'French (Belgium)'), 
  OpenStruct.new(id: 'fr-ca', name: 'French (Canadian)'),
  OpenStruct.new(id: 'fr-ch', name: 'French (Swiss)'),
  OpenStruct.new(id: 'hu', name: 'Hungarian'),
  OpenStruct.new(id: 'is', name: 'Israelian'), 
  OpenStruct.new(id: 'it', name: 'Italian'), 
  OpenStruct.new(id: 'ja', name: 'Japanese'), 
  OpenStruct.new(id: 'lt', name: 'Lituanian'), 
  OpenStruct.new(id: 'mk', name: ''),
  OpenStruct.new(id: 'nl', name: 'Nederland'), 
  OpenStruct.new(id: 'no', name: 'Norway'), 
  OpenStruct.new(id: 'pl', name: 'Polish'), 
  OpenStruct.new(id: 'pt', name: 'Portugese'),
  OpenStruct.new(id: 'pt-br', name: 'Portugese (Brasilian)'),
  OpenStruct.new(id: 'sv', name: 'Sv'),
  OpenStruct.new(id: 'sl', name: 'Slovakian'),
  OpenStruct.new(id: 'tr', name: 'Tr')]
end

#proxmox_max_device(id) ⇒ Object



88
89
90
91
# File 'app/helpers/proxmox_compute_selectors_helper.rb', line 88

def proxmox_max_device(id)
  options_select = get_controller(id)
  options_select ? options_select.range  : 1
end

#proxmox_networkcards_mapObject



142
143
144
145
146
147
# File 'app/helpers/proxmox_compute_selectors_helper.rb', line 142

def proxmox_networkcards_map
  [OpenStruct.new(id: 'e1000', name:  'Intel E1000'),
    OpenStruct.new(id: 'virtio', name:  'VirtIO (paravirtualized)'),
    OpenStruct.new(id: 'rtl8139', name:  'Realtek RTL8139'),
      OpenStruct.new(id: 'vmxnet3', name:  'VMware vmxnet3')]
end

#proxmox_operating_systems_mapObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/proxmox_compute_selectors_helper.rb', line 28

def proxmox_operating_systems_map
   [OpenStruct.new(id: 'other', name: 'Unspecified OS'),
    OpenStruct.new(id: 'wxp', name: 'Microsoft Windows XP'),
    OpenStruct.new(id: 'w2k', name: 'Microsoft Windows 2000'),
    OpenStruct.new(id: 'w2k3', name: 'Microsoft Windows 2003'),
    OpenStruct.new(id: 'w2k8', name: 'Microsoft Windows 2008'),
    OpenStruct.new(id: 'wvista', name: 'Microsoft Windows Vista'),
    OpenStruct.new(id: 'win7', name: 'Microsoft Windows 7'),
    OpenStruct.new(id: 'win8', name: 'Microsoft Windows 8/2012/2012r2'),
    OpenStruct.new(id: 'win10', name: 'Microsoft Windows 10/2016'),
    OpenStruct.new(id: 'l24', name: 'Linux 2.4 Kernel'),
    OpenStruct.new(id: 'l26', name: 'Linux 2.6/3.X + Kernel'),
    OpenStruct.new(id: 'solaris', name: 'Solaris/OpenSolaris/OpenIndiania kernel')]
end

#proxmox_scsihw_mapObject



133
134
135
136
137
138
139
140
# File 'app/helpers/proxmox_compute_selectors_helper.rb', line 133

def proxmox_scsihw_map
  [OpenStruct.new(id: 'lsi', name: 'lsi'),
   OpenStruct.new(id: 'lsi53c810', name: 'lsi53c810'),
   OpenStruct.new(id: 'megasas', name: 'megasas'),
   OpenStruct.new(id: 'virtio-scsi-pci', name: 'virtio-scsi-pci'),
    OpenStruct.new(id: 'virtio-scsi-single', name: 'virtio-scsi-single'),
   OpenStruct.new(id: 'pvscsi', name: 'pvscsi')]
end

#proxmox_vgas_mapObject



43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/helpers/proxmox_compute_selectors_helper.rb', line 43

def proxmox_vgas_map
   [OpenStruct.new(id: 'std', name: 'Standard VGA'),
   OpenStruct.new(id: 'vmware', name: 'Vmware compatible'),
   OpenStruct.new(id: 'qxl', name: 'SPICE'),
   OpenStruct.new(id: 'qxl2', name: 'SPICE 2 monnitors'),
   OpenStruct.new(id: 'qxl3', name: 'SPICE 3 monnitors'),
   OpenStruct.new(id: 'qxl4', name: 'SPICE 4 monnitors'),
   OpenStruct.new(id: 'serial0', name: 'Serial terminal 0'),
   OpenStruct.new(id: 'serial1', name: 'Serial terminal 1'),
   OpenStruct.new(id: 'serial2', name: 'Serial terminal 2'),
   OpenStruct.new(id: 'serial3', name: 'Serial terminal 3')]
end