Class: VirtualMachineDevice::Nic
Overview
Nic class
Class Method Summary collapse
- .nic_model_class(nicmodel) ⇒ Object
-
.one_nic(id, one_res) ⇒ Object
Create the OpenNebula nic representation Allow as to create the class without vCenter representation example: attached nics not synced with vCenter.
-
.vc_nic(vc_res) ⇒ Object
Create the vCenter nic representation Allow as to create the class without OpenNebula representation example: detached nics that not exists in OpenNebula.
Instance Method Summary collapse
Methods inherited from Device
#detached?, #exists?, #id, #initialize, #managed?, #no_exists?, #one?, #one_item, #raise_if_no_exists_in_one, #raise_if_no_exists_in_vcenter, #synced?, #unsynced?, #vc_item
Constructor Details
This class inherits a constructor from VirtualMachineDevice::Device
Class Method Details
.nic_model_class(nicmodel) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/vm_nic.rb', line 47 def self.nic_model_class(nicmodel) case nicmodel when 'virtuale1000', 'e1000' RbVmomi::VIM::VirtualE1000 when 'virtuale1000e', 'e1000e' RbVmomi::VIM::VirtualE1000e when 'virtualpcnet32', 'pcnet32' RbVmomi::VIM::VirtualPCNet32 when 'virtualsriovethernetcard', 'sriovethernetcard' RbVmomi::VIM::VirtualSriovEthernetCard when 'virtualvmxnetm', 'vmxnetm' RbVmomi::VIM::VirtualVmxnetm when 'virtualvmxnet2', 'vmnet2' RbVmomi::VIM::VirtualVmxnet2 when 'virtualvmxnet3', 'vmxnet3' RbVmomi::VIM::VirtualVmxnet3 else # If none matches, use vmxnet3 RbVmomi::VIM::VirtualVmxnet3 end end |
.one_nic(id, one_res) ⇒ Object
Create the OpenNebula nic representation Allow as to create the class without vCenter representation example: attached nics not synced with vCenter
24 25 26 |
# File 'lib/vm_nic.rb', line 24 def self.one_nic(id, one_res) new(id, one_res, nil) end |
.vc_nic(vc_res) ⇒ Object
Create the vCenter nic representation Allow as to create the class without OpenNebula representation example: detached nics that not exists in OpenNebula
31 32 33 |
# File 'lib/vm_nic.rb', line 31 def self.vc_nic(vc_res) new(nil, nil, vc_res) end |
Instance Method Details
#boot_dev ⇒ Object
40 41 42 43 44 45 |
# File 'lib/vm_nic.rb', line 40 def boot_dev RbVmomi::VIM .VirtualMachineBootOptionsBootableEthernetDevice( :deviceKey => key ) end |
#key ⇒ Object
35 36 37 38 |
# File 'lib/vm_nic.rb', line 35 def key raise_if_no_exists_in_vcenter @vc_res.key end |