Skip to content

Commit

Permalink
B OpenNebula#2474 fix retrieve info from template
Browse files Browse the repository at this point in the history
  • Loading branch information
joseangelgm committed Oct 17, 2018
1 parent bb8af04 commit f4cdf24
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1901,13 +1901,16 @@ def calculate_add_nic_spec(nic)
mode = ""
if !one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').nil? &&
!one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').empty?
model = one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL')
model = one_item['TEMPLATE/NIC_DEFAULT/MODEL']
File.open("/tmp/culo", 'w') {|f| f.write("Lo pilla del nic default: #{model}\n") }
elsif (model.nil? || model.empty?) &&
!nic['MODEL'].nil? &&
!nic['MODEL'].empty?
model = nic['MODEL']
File.open("/tmp/culo", 'w') {|f| f.write("Lo pilla del nic: #{model}\n") }
else
model = VCenterDriver::VIHelper.get_default('VM/TEMPLATE/NIC/MODEL')
File.open("/tmp/culo", 'w') {|f| f.write("Lo pilla vcenter default #{model}\n") }
end
vnet_ref = nic["VCENTER_NET_REF"]
backing = nil
Expand Down Expand Up @@ -2008,13 +2011,16 @@ def calculate_add_nic_spec_autogenerate_mac(nic)
model = ""
if !one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').nil? &&
!one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').empty?
model = one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL')
model = one_item['TEMPLATE/NIC_DEFAULT/MODEL']
File.open("/tmp/culo", 'w') {|f| f.write("Lo pilla del nic default: #{model}\n") }
elsif (model.nil? || model.empty?) &&
!nic['MODEL'].nil? &&
!nic['MODEL'].empty?
model = nic['MODEL']
File.open("/tmp/culo", 'w') {|f| f.write("Lo pilla del nic: #{model}\n") }
else
model = VCenterDriver::VIHelper.get_default('VM/TEMPLATE/NIC/MODEL')
File.open("/tmp/culo", 'w') {|f| f.write("Lo pilla del vcenter default: #{model}\n") }
end
vnet_ref = nic["VCENTER_NET_REF"]
backing = nil
Expand Down

0 comments on commit f4cdf24

Please sign in to comment.