F #4207: fix unmanage nics at deploy time (#4419)

Signed-off-by: Carlos Herrera <cherrera@opennebula.systems>
(cherry picked from commit 5b884dc626)
This commit is contained in:
Carlos J. Herrera authored and Tino Vazquez committed 2020-03-26 17:28:16 +01:00
1 parent f652a5fbb8
commit b19b08427d
1 file changed
+9 -5
@@ -892,18 +892,22 @@ module VCenterDriver
break
end
raise 'Problem with your unmanaged nics!' unless device
nics.delete(device)
if device
nics.delete(device)
else
nil
end
}
unmanaged_nics.each do |unic|
vnic = select_net.call(unic['VCENTER_NET_REF'])
nic_class = vnic.class
nic_class = vnic.class if vnic
new_model = Nic.nic_model_class(unic['MODEL']) if unic['MODEL']
if vnic.nil?
device_change << calculate_add_nic_spec(unic)
# delete actual nic and update the new one.
if new_model && new_model != nic_class
elsif new_model && new_model != nic_class
device_change << { :device => vnic, :operation => :remove }
device_change << calculate_add_nic_spec(unic, vnic.unitNumber)
else