opennebula 6.10.3 → 6.99.85.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cloud/CloudClient.rb +3 -3
- data/lib/models/role.rb +349 -823
- data/lib/models/service.rb +156 -80
- data/lib/models/vmrole.rb +703 -0
- data/lib/models/vrrole.rb +284 -0
- data/lib/models.rb +3 -1
- data/lib/opennebula/acl.rb +1 -1
- data/lib/opennebula/acl_pool.rb +1 -1
- data/lib/opennebula/backupjob.rb +1 -1
- data/lib/opennebula/backupjob_pool.rb +1 -1
- data/lib/opennebula/client.rb +1 -1
- data/lib/opennebula/cluster.rb +45 -2
- data/lib/opennebula/cluster_pool.rb +1 -1
- data/lib/opennebula/datastore.rb +1 -1
- data/lib/opennebula/datastore_pool.rb +1 -1
- data/lib/opennebula/document.rb +1 -1
- data/lib/opennebula/document_json.rb +1 -1
- data/lib/opennebula/document_pool.rb +1 -1
- data/lib/opennebula/document_pool_json.rb +1 -1
- data/lib/opennebula/error.rb +1 -1
- data/lib/opennebula/flow/grammar.rb +1 -1
- data/lib/opennebula/flow/service_pool.rb +1 -1
- data/lib/opennebula/flow/service_template.rb +353 -97
- data/lib/opennebula/flow/service_template_ext.rb +3 -3
- data/lib/opennebula/flow/service_template_pool.rb +1 -1
- data/lib/opennebula/flow/validator.rb +458 -410
- data/lib/opennebula/flow.rb +1 -1
- data/lib/opennebula/group.rb +1 -1
- data/lib/opennebula/group_pool.rb +1 -1
- data/lib/opennebula/hook.rb +1 -1
- data/lib/opennebula/hook_log.rb +1 -1
- data/lib/opennebula/hook_pool.rb +1 -1
- data/lib/opennebula/host.rb +1 -60
- data/lib/opennebula/host_pool.rb +1 -1
- data/lib/opennebula/image.rb +1 -1
- data/lib/opennebula/image_pool.rb +1 -1
- data/lib/opennebula/ldap_auth.rb +1 -1
- data/lib/opennebula/ldap_auth_spec.rb +1 -1
- data/lib/opennebula/lockable_ext.rb +1 -1
- data/lib/opennebula/marketplace.rb +1 -1
- data/lib/opennebula/marketplace_pool.rb +1 -1
- data/lib/opennebula/marketplaceapp.rb +1 -1
- data/lib/opennebula/marketplaceapp_ext.rb +14 -211
- data/lib/opennebula/marketplaceapp_pool.rb +1 -1
- data/lib/opennebula/oneflow_client.rb +11 -9
- data/lib/opennebula/pool.rb +1 -1
- data/lib/opennebula/pool_element.rb +1 -1
- data/lib/opennebula/security_group.rb +1 -1
- data/lib/opennebula/security_group_pool.rb +1 -1
- data/lib/opennebula/server_cipher_auth.rb +1 -1
- data/lib/opennebula/server_x509_auth.rb +1 -1
- data/lib/opennebula/ssh_auth.rb +1 -1
- data/lib/opennebula/system.rb +1 -1
- data/lib/opennebula/template.rb +1 -1
- data/lib/opennebula/template_ext.rb +1 -1
- data/lib/opennebula/template_pool.rb +1 -1
- data/lib/opennebula/user.rb +1 -1
- data/lib/opennebula/user_pool.rb +1 -1
- data/lib/opennebula/utils.rb +2 -2
- data/lib/opennebula/vdc.rb +1 -1
- data/lib/opennebula/vdc_pool.rb +1 -1
- data/lib/opennebula/virtual_machine.rb +3 -12
- data/lib/opennebula/virtual_machine_ext.rb +2 -31
- data/lib/opennebula/virtual_machine_pool.rb +1 -1
- data/lib/opennebula/virtual_network.rb +1 -1
- data/lib/opennebula/virtual_network_pool.rb +1 -1
- data/lib/opennebula/virtual_router.rb +1 -1
- data/lib/opennebula/virtual_router_pool.rb +1 -1
- data/lib/opennebula/vm_group.rb +1 -1
- data/lib/opennebula/vm_group_pool.rb +1 -1
- data/lib/opennebula/vntemplate.rb +1 -1
- data/lib/opennebula/vntemplate_pool.rb +1 -1
- data/lib/opennebula/wait_ext.rb +1 -1
- data/lib/opennebula/x509_auth.rb +1 -1
- data/lib/opennebula/xml_element.rb +2 -2
- data/lib/opennebula/xml_pool.rb +1 -1
- data/lib/opennebula/xml_utils.rb +1 -1
- data/lib/opennebula/zone.rb +1 -1
- data/lib/opennebula/zone_pool.rb +1 -1
- data/lib/opennebula.rb +2 -2
- metadata +6 -67
- data/lib/ActionManager.rb +0 -280
- data/lib/CommandManager.rb +0 -328
- data/lib/DriverExecHelper.rb +0 -213
- data/lib/HostSyncManager.rb +0 -111
- data/lib/OpenNebulaDriver.rb +0 -223
- data/lib/VirtualMachineDriver.rb +0 -404
- data/lib/datacenter.rb +0 -1319
- data/lib/datastore.rb +0 -1049
- data/lib/distributed_firewall.rb +0 -293
- data/lib/file_helper.rb +0 -374
- data/lib/host.rb +0 -1518
- data/lib/logical_port.rb +0 -50
- data/lib/logical_switch.rb +0 -77
- data/lib/memoize.rb +0 -74
- data/lib/network.rb +0 -705
- data/lib/nsx_client.rb +0 -157
- data/lib/nsx_component.rb +0 -28
- data/lib/nsx_constants.rb +0 -162
- data/lib/nsx_driver.rb +0 -91
- data/lib/nsx_error.rb +0 -77
- data/lib/nsx_rule.rb +0 -206
- data/lib/nsxt_client.rb +0 -189
- data/lib/nsxt_dfw.rb +0 -196
- data/lib/nsxt_logical_port.rb +0 -94
- data/lib/nsxt_rule.rb +0 -188
- data/lib/nsxt_tz.rb +0 -38
- data/lib/nsxv_client.rb +0 -189
- data/lib/nsxv_dfw.rb +0 -202
- data/lib/nsxv_logical_port.rb +0 -107
- data/lib/nsxv_rule.rb +0 -172
- data/lib/nsxv_tz.rb +0 -41
- data/lib/opaque_network.rb +0 -134
- data/lib/rest_client.rb +0 -191
- data/lib/scripts_common.rb +0 -176
- data/lib/transport_zone.rb +0 -43
- data/lib/vcenter_driver.rb +0 -152
- data/lib/vcenter_importer.rb +0 -626
- data/lib/vi_client.rb +0 -273
- data/lib/vi_helper.rb +0 -328
- data/lib/virtual_machine.rb +0 -3574
- data/lib/virtual_wire.rb +0 -158
- data/lib/vm_device.rb +0 -80
- data/lib/vm_disk.rb +0 -202
- data/lib/vm_folder.rb +0 -69
- data/lib/vm_helper.rb +0 -30
- data/lib/vm_monitor.rb +0 -305
- data/lib/vm_nic.rb +0 -70
- data/lib/vm_template.rb +0 -2112
- data/lib/vmm_importer.rb +0 -165
data/lib/vm_monitor.rb
DELETED
@@ -1,305 +0,0 @@
|
|
1
|
-
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-2024, OpenNebula Project, OpenNebula Systems #
|
3
|
-
# #
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
5
|
-
# not use this file except in compliance with the License. You may obtain #
|
6
|
-
# a copy of the License at #
|
7
|
-
# #
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0 #
|
9
|
-
# #
|
10
|
-
# Unless required by applicable law or agreed to in writing, software #
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, #
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
13
|
-
# See the License for the specific language governing permissions and #
|
14
|
-
# limitations under the License. #
|
15
|
-
#--------------------------------------------------------------------------- #
|
16
|
-
module VirtualMachineMonitor
|
17
|
-
|
18
|
-
POLL_ATTRIBUTE = OpenNebula::VirtualMachine::Driver::POLL_ATTRIBUTE
|
19
|
-
VM_STATE = OpenNebula::VirtualMachine::Driver::VM_STATE
|
20
|
-
|
21
|
-
# Converts the VI string state to OpenNebula state convention
|
22
|
-
# Guest states are:
|
23
|
-
# - poweredOff The virtual machine is currently powered off.
|
24
|
-
# - poweredOn The virtual machine is currently powered on.
|
25
|
-
# - suspended The virtual machine is currently suspended.
|
26
|
-
def state_to_c(state)
|
27
|
-
case state
|
28
|
-
when 'poweredOn'
|
29
|
-
VM_STATE[:active]
|
30
|
-
when 'suspended'
|
31
|
-
VM_STATE[:paused]
|
32
|
-
when 'poweredOff'
|
33
|
-
VM_STATE[:deleted]
|
34
|
-
else
|
35
|
-
VM_STATE[:unknown]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# monitor function used when poll action is called for all vms
|
40
|
-
def monitor(stats)
|
41
|
-
reset_monitor
|
42
|
-
|
43
|
-
refresh_rate = 20 # 20 seconds between samples (realtime)
|
44
|
-
|
45
|
-
@state = state_to_c(@vm_info['summary.runtime.powerState'])
|
46
|
-
|
47
|
-
return if @state != VM_STATE[:active]
|
48
|
-
|
49
|
-
cpuMhz = @vm_info[:esx_host_cpu]
|
50
|
-
|
51
|
-
@monitor[:used_memory] = @vm_info['summary.quickStats.hostMemoryUsage']
|
52
|
-
.to_i * 1024
|
53
|
-
|
54
|
-
used_cpu = @vm_info['summary.quickStats.overallCpuUsage'].to_f / cpuMhz
|
55
|
-
used_cpu = (used_cpu * 100).to_s
|
56
|
-
@monitor[:used_cpu] = format('%.2f', used_cpu).to_s
|
57
|
-
|
58
|
-
# Check for negative values
|
59
|
-
@monitor[:used_memory] = 0 if @monitor[:used_memory].to_i < 0
|
60
|
-
@monitor[:used_cpu] = 0 if @monitor[:used_cpu].to_i < 0
|
61
|
-
|
62
|
-
guest_ip_addresses = []
|
63
|
-
unless self['guest.net'].empty?
|
64
|
-
@vm_info['guest.net'].each do |net|
|
65
|
-
next unless net.ipConfig
|
66
|
-
next if net.ipConfig.ipAddress.empty?
|
67
|
-
|
68
|
-
net.ipConfig.ipAddress.each do |ip|
|
69
|
-
guest_ip_addresses << ip.ipAddress
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
@guest_ip_addresses = guest_ip_addresses.join(',')
|
75
|
-
|
76
|
-
if stats.key?(@item)
|
77
|
-
metrics = stats[@item][:metrics]
|
78
|
-
|
79
|
-
nettx_kbpersec = 0
|
80
|
-
if metrics['net.transmitted']
|
81
|
-
metrics['net.transmitted'].each do |sample|
|
82
|
-
nettx_kbpersec += sample if sample > 0
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
netrx_kbpersec = 0
|
87
|
-
if metrics['net.bytesRx']
|
88
|
-
metrics['net.bytesRx'].each do |sample|
|
89
|
-
netrx_kbpersec += sample if sample > 0
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
read_kbpersec = 0
|
94
|
-
if metrics['virtualDisk.read']
|
95
|
-
metrics['virtualDisk.read'].each do |sample|
|
96
|
-
read_kbpersec += sample if sample > 0
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
read_iops = 0
|
101
|
-
if metrics['virtualDisk.numberReadAveraged']
|
102
|
-
metrics['virtualDisk.numberReadAveraged'].each do |sample|
|
103
|
-
read_iops += sample if sample > 0
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
write_kbpersec = 0
|
108
|
-
if metrics['virtualDisk.write']
|
109
|
-
metrics['virtualDisk.write'].each do |sample|
|
110
|
-
write_kbpersec += sample if sample > 0
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
write_iops = 0
|
115
|
-
if metrics['virtualDisk.numberWriteAveraged']
|
116
|
-
metrics['virtualDisk.numberWriteAveraged'].each do |sample|
|
117
|
-
write_iops += sample if sample > 0
|
118
|
-
end
|
119
|
-
end
|
120
|
-
else
|
121
|
-
nettx_kbpersec = 0
|
122
|
-
netrx_kbpersec = 0
|
123
|
-
read_kbpersec = 0
|
124
|
-
read_iops = 0
|
125
|
-
write_kbpersec = 0
|
126
|
-
write_iops = 0
|
127
|
-
end
|
128
|
-
|
129
|
-
# Accumulate values if present
|
130
|
-
if @one_item && @one_item['MONITORING/NETTX']
|
131
|
-
previous_nettx = @one_item['MONITORING/NETTX'].to_i
|
132
|
-
else
|
133
|
-
previous_nettx = 0
|
134
|
-
end
|
135
|
-
|
136
|
-
if @one_item && @one_item['MONITORING/NETRX']
|
137
|
-
previous_netrx = @one_item['MONITORING/NETRX'].to_i
|
138
|
-
else
|
139
|
-
previous_netrx = 0
|
140
|
-
end
|
141
|
-
|
142
|
-
if @one_item && @one_item['MONITORING/DISKRDIOPS']
|
143
|
-
previous_diskrdiops = @one_item['MONITORING/DISKRDIOPS'].to_i
|
144
|
-
else
|
145
|
-
previous_diskrdiops = 0
|
146
|
-
end
|
147
|
-
|
148
|
-
if @one_item && @one_item['MONITORING/DISKWRIOPS']
|
149
|
-
previous_diskwriops = @one_item['MONITORING/DISKWRIOPS'].to_i
|
150
|
-
else
|
151
|
-
previous_diskwriops = 0
|
152
|
-
end
|
153
|
-
|
154
|
-
if @one_item && @one_item['MONITORING/DISKRDBYTES']
|
155
|
-
previous_diskrdbytes = @one_item['MONITORING/DISKRDBYTES'].to_i
|
156
|
-
else
|
157
|
-
previous_diskrdbytes = 0
|
158
|
-
end
|
159
|
-
|
160
|
-
if @one_item && @one_item['MONITORING/DISKWRBYTES']
|
161
|
-
previous_diskwrbytes = @one_item['MONITORING/DISKWRBYTES'].to_i
|
162
|
-
else
|
163
|
-
previous_diskwrbytes = 0
|
164
|
-
end
|
165
|
-
|
166
|
-
@monitor[:nettx] = previous_nettx +
|
167
|
-
(nettx_kbpersec * 1024 * refresh_rate).to_i
|
168
|
-
@monitor[:netrx] = previous_netrx +
|
169
|
-
(netrx_kbpersec * 1024 * refresh_rate).to_i
|
170
|
-
|
171
|
-
@monitor[:diskrdiops] = previous_diskrdiops + read_iops
|
172
|
-
@monitor[:diskwriops] = previous_diskwriops + write_iops
|
173
|
-
@monitor[:diskrdbytes] = previous_diskrdbytes +
|
174
|
-
(read_kbpersec * 1024 * refresh_rate).to_i
|
175
|
-
@monitor[:diskwrbytes] = previous_diskwrbytes +
|
176
|
-
(write_kbpersec * 1024 * refresh_rate).to_i
|
177
|
-
end
|
178
|
-
|
179
|
-
# Generates a OpenNebula IM Driver valid string with the monitor info
|
180
|
-
def info
|
181
|
-
# return 'STATE=d' if @state == 'd'
|
182
|
-
|
183
|
-
if @vm_info
|
184
|
-
guest_ip = @vm_info['guest.ipAddress']
|
185
|
-
else
|
186
|
-
guest_ip = self['guest.ipAddress']
|
187
|
-
end
|
188
|
-
|
189
|
-
used_cpu = @monitor[:used_cpu]
|
190
|
-
used_memory = @monitor[:used_memory]
|
191
|
-
netrx = @monitor[:netrx]
|
192
|
-
nettx = @monitor[:nettx]
|
193
|
-
diskrdbytes = @monitor[:diskrdbytes]
|
194
|
-
diskwrbytes = @monitor[:diskwrbytes]
|
195
|
-
diskrdiops = @monitor[:diskrdiops]
|
196
|
-
diskwriops = @monitor[:diskwriops]
|
197
|
-
|
198
|
-
if @vm_info
|
199
|
-
esx_host = @vm_info[:esx_host_name].to_s
|
200
|
-
else
|
201
|
-
esx_host = self['runtime.host.name'].to_s
|
202
|
-
end
|
203
|
-
|
204
|
-
if @vm_info
|
205
|
-
guest_state = @vm_info['guest.guestState'].to_s
|
206
|
-
else
|
207
|
-
guest_state = self['guest.guestState'].to_s
|
208
|
-
end
|
209
|
-
|
210
|
-
if @vm_info
|
211
|
-
vmware_tools = @vm_info['guest.toolsRunningStatus'].to_s
|
212
|
-
else
|
213
|
-
vmware_tools = self['guest.toolsRunningStatus'].to_s
|
214
|
-
end
|
215
|
-
|
216
|
-
if @vm_info
|
217
|
-
vm_name = @vm_info['name'].to_s
|
218
|
-
else
|
219
|
-
vm_name = self['name'].to_s
|
220
|
-
end
|
221
|
-
|
222
|
-
if @vm_info
|
223
|
-
vmtools_ver = @vm_info['guest.toolsVersion'].to_s
|
224
|
-
else
|
225
|
-
vmtools_ver = self['guest.toolsVersion'].to_s
|
226
|
-
end
|
227
|
-
|
228
|
-
if @vm_info
|
229
|
-
vmtools_verst = @vm_info['guest.toolsVersionStatus2'].to_s
|
230
|
-
else
|
231
|
-
vmtools_verst = self['guest.toolsVersionStatus2'].to_s
|
232
|
-
end
|
233
|
-
|
234
|
-
if @vm_info
|
235
|
-
rp_name = @vm_info[:rp_list]
|
236
|
-
.select do |item|
|
237
|
-
item[:ref] == @vm_info['resourcePool']._ref
|
238
|
-
end
|
239
|
-
.first[:name] rescue ''
|
240
|
-
|
241
|
-
rp_name = 'Resources' if rp_name.empty?
|
242
|
-
else
|
243
|
-
rp_name = self['resourcePool'].name
|
244
|
-
end
|
245
|
-
|
246
|
-
str_info = ''
|
247
|
-
|
248
|
-
str_info = 'GUEST_IP=' << guest_ip.to_s << "\n" if guest_ip
|
249
|
-
|
250
|
-
if @guest_ip_addresses && !@guest_ip_addresses.empty?
|
251
|
-
str_info << 'GUEST_IP_ADDRESSES="' << @guest_ip_addresses.to_s \
|
252
|
-
<< '" '
|
253
|
-
end
|
254
|
-
|
255
|
-
str_info << "#{POLL_ATTRIBUTE[:cpu]}=" << used_cpu.to_s << "\n"
|
256
|
-
str_info << "#{POLL_ATTRIBUTE[:memory]}=" << used_memory.to_s << "\n"
|
257
|
-
str_info << "#{POLL_ATTRIBUTE[:netrx]}=" << netrx.to_s << "\n"
|
258
|
-
str_info << "#{POLL_ATTRIBUTE[:nettx]}=" << nettx.to_s << "\n"
|
259
|
-
|
260
|
-
str_info << 'DISKRDBYTES=' << diskrdbytes.to_s << "\n"
|
261
|
-
str_info << 'DISKWRBYTES=' << diskwrbytes.to_s << "\n"
|
262
|
-
str_info << 'DISKRDIOPS=' << diskrdiops.to_s << "\n"
|
263
|
-
str_info << 'DISKWRIOPS=' << diskwriops.to_s << "\n"
|
264
|
-
|
265
|
-
str_info << 'VCENTER_ESX_HOST="' << esx_host << '" ' << "\n"
|
266
|
-
str_info << 'VCENTER_GUEST_STATE=' << guest_state << "\n"
|
267
|
-
str_info << 'VCENTER_VM_NAME="' << vm_name << '" ' << "\n"
|
268
|
-
str_info << 'VCENTER_VMWARETOOLS_RUNNING_STATUS=' \
|
269
|
-
<< vmware_tools << "\n"
|
270
|
-
str_info << 'VCENTER_VMWARETOOLS_VERSION=' << vmtools_ver << "\n"
|
271
|
-
str_info << 'VCENTER_VMWARETOOLS_VERSION_STATUS=' \
|
272
|
-
<< vmtools_verst << "\n"
|
273
|
-
str_info << 'VCENTER_RP_NAME="' << rp_name << '" ' << "\n"
|
274
|
-
|
275
|
-
info_disks.each do |disk|
|
276
|
-
next if disk[1].no_exists?
|
277
|
-
|
278
|
-
# disk[0] contains the disk ID in OpenNebula or the disk path if
|
279
|
-
# there is no corresponding OpenNebula disk
|
280
|
-
# disk[1] contains the vcenter resource corresponding to the VM disk
|
281
|
-
|
282
|
-
# Delete special characters
|
283
|
-
name = disk[0].gsub(/[^0-9A-Za-z]/, '_')
|
284
|
-
|
285
|
-
str_info << "DISK_#{name}_ACTUAL_PATH=\"[" <<
|
286
|
-
disk[1].ds.name << '] ' << disk[1].path << '" ' << "\n"
|
287
|
-
end
|
288
|
-
|
289
|
-
str_info
|
290
|
-
end
|
291
|
-
|
292
|
-
def reset_monitor
|
293
|
-
@monitor = {
|
294
|
-
:used_cpu => 0,
|
295
|
-
:used_memory => 0,
|
296
|
-
:netrx => 0,
|
297
|
-
:nettx => 0,
|
298
|
-
:diskrdbytes => 0,
|
299
|
-
:diskwrbytes => 0,
|
300
|
-
:diskrdiops => 0,
|
301
|
-
:diskwriops => 0
|
302
|
-
}
|
303
|
-
end
|
304
|
-
|
305
|
-
end
|
data/lib/vm_nic.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-2024, OpenNebula Project, OpenNebula Systems #
|
3
|
-
# #
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
5
|
-
# not use this file except in compliance with the License. You may obtain #
|
6
|
-
# a copy of the License at #
|
7
|
-
# #
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0 #
|
9
|
-
# #
|
10
|
-
# Unless required by applicable law or agreed to in writing, software #
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS, #
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
13
|
-
# See the License for the specific language governing permissions and #
|
14
|
-
# limitations under the License. #
|
15
|
-
#--------------------------------------------------------------------------- #
|
16
|
-
module VirtualMachineDevice
|
17
|
-
|
18
|
-
# Nic class
|
19
|
-
class Nic < Device
|
20
|
-
|
21
|
-
# Create the OpenNebula nic representation
|
22
|
-
# Allow as to create the class without vCenter representation
|
23
|
-
# example: attached nics not synced with vCenter
|
24
|
-
def self.one_nic(id, one_res)
|
25
|
-
new(id, one_res, nil)
|
26
|
-
end
|
27
|
-
|
28
|
-
# Create the vCenter nic representation
|
29
|
-
# Allow as to create the class without OpenNebula representation
|
30
|
-
# example: detached nics that not exists in OpenNebula
|
31
|
-
def self.vc_nic(vc_res)
|
32
|
-
new(nil, nil, vc_res)
|
33
|
-
end
|
34
|
-
|
35
|
-
def key
|
36
|
-
raise_if_no_exists_in_vcenter
|
37
|
-
@vc_res.key
|
38
|
-
end
|
39
|
-
|
40
|
-
def boot_dev
|
41
|
-
RbVmomi::VIM
|
42
|
-
.VirtualMachineBootOptionsBootableEthernetDevice(
|
43
|
-
:deviceKey => key
|
44
|
-
)
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.nic_model_class(nicmodel)
|
48
|
-
case nicmodel
|
49
|
-
when 'virtuale1000', 'e1000'
|
50
|
-
RbVmomi::VIM::VirtualE1000
|
51
|
-
when 'virtuale1000e', 'e1000e'
|
52
|
-
RbVmomi::VIM::VirtualE1000e
|
53
|
-
when 'virtualpcnet32', 'pcnet32'
|
54
|
-
RbVmomi::VIM::VirtualPCNet32
|
55
|
-
when 'virtualsriovethernetcard', 'sriovethernetcard'
|
56
|
-
RbVmomi::VIM::VirtualSriovEthernetCard
|
57
|
-
when 'virtualvmxnetm', 'vmxnetm'
|
58
|
-
RbVmomi::VIM::VirtualVmxnetm
|
59
|
-
when 'virtualvmxnet2', 'vmnet2'
|
60
|
-
RbVmomi::VIM::VirtualVmxnet2
|
61
|
-
when 'virtualvmxnet3', 'vmxnet3'
|
62
|
-
RbVmomi::VIM::VirtualVmxnet3
|
63
|
-
else # If none matches, use vmxnet3
|
64
|
-
RbVmomi::VIM::VirtualVmxnet3
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|