1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-09 09:57:23 +03:00

Improve code for vcenter nic model

Co-authored-by: semedi <ssemedi@opennebula.systems>
This commit is contained in:
joseangelgm 2018-12-21 13:01:20 +01:00 committed by Tino Vázquez
parent cab61f519e
commit 094878cf88

View File

@ -1232,20 +1232,17 @@ class VirtualMachine < VCenterDriver::Template
unmanaged_nics.each do |unic|
vnic = select.call(unic['BRIDGE'])
if unic['MODEL'] && !unic['MODEL'].empty? && !unic['MODEL'].nil?
vcenter_nic_class = vnic.class
opennebula_nic_class = nic_model_class(unic['MODEL'])
if vcenter_nic_class != opennebula_nic_class
vcenter_nic_class = vnic.class
new_model = unic['MODEL'] && !unic['MODEL'].empty? && !unic['MODEL'].nil?
opennebula_nic_class = nic_model_class(unic['MODEL']) if new_model
if new_model && opennebula_nic_class != vcenter_nic_class
# delete actual nic and update the new one.
device_change << { :device => vnic, :operation => :remove }
device_change << calculate_add_nic_spec(unic)
else
else
vnic.macAddress = unic['MAC']
device_change << { :device => vnic, :operation => :edit }
end
else
vnic.macAddress = unic['MAC']
device_change << { :device => vnic, :operation => :edit }
end
end
end