1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

B #2474 fix retrieve info from template

This commit is contained in:
joseangelgm 2018-10-17 11:57:05 +02:00 committed by Tino Vázquez
parent a7e44a2b4f
commit 0d5f51906c

View File

@ -1901,13 +1901,16 @@ class VirtualMachine < Template
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
@ -2008,13 +2011,16 @@ class VirtualMachine < Template
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