1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-21 18:03:38 +03:00

B #2474 Network model is not working in vCenter

This commit is contained in:
joseangelgm 2018-10-10 09:55:23 +02:00 committed by Tino Vázquez
parent a2ceb4a405
commit 902abbaeb6

View File

@ -1898,9 +1898,12 @@ class VirtualMachine < Template
def calculate_add_nic_spec(nic)
mac = nic["MAC"]
pg_name = nic["BRIDGE"]
if !one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').nil? && !one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').empty?
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')
elsif (model.nil? || model.empty?) && !nic['MODEL'].nil? && !nic['MODEL'].empty?
elsif (model.nil? || model.empty?) &&
!nic['MODEL'].nil? &&
!nic['MODEL'].empty?
model = nic['MODEL']
else
model = VCenterDriver::VIHelper.get_default('VM/TEMPLATE/NIC/MODEL')
@ -2001,9 +2004,12 @@ class VirtualMachine < Template
# Returns an array of actions to be included in :deviceChange
def calculate_add_nic_spec_autogenerate_mac(nic)
pg_name = nic["BRIDGE"]
if !one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').nil? && !one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').empty?
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')
elsif (model.nil? || model.empty?) && !nic['MODEL'].nil? && !nic['MODEL'].empty?
elsif (model.nil? || model.empty?) &&
!nic['MODEL'].nil? &&
!nic['MODEL'].empty?
model = nic['MODEL']
else
model = VCenterDriver::VIHelper.get_default('VM/TEMPLATE/NIC/MODEL')