Skip to content

Commit

Permalink
B OpenNebula#2474 Network model is not working in vCenter
Browse files Browse the repository at this point in the history
  • Loading branch information
joseangelgm committed Oct 17, 2018
1 parent 5acdf18 commit c06c9cb
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 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 @@ -903,7 +903,17 @@ def calculate_add_nic_spec(nic)

mac = nic["MAC"]
pg_name = nic["BRIDGE"]
model = one_item.retrieve_xmlelements("TEMPLATE/NIC_DEFAULT/MODEL") || nic["VCENTER_NET_MODEL"] || VCenterDriver::VIHelper.get_default("VM/TEMPLATE/NIC/MODEL")
mode = ''
if !one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').nil? &&
!one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').empty?
model = one_item['TEMPLATE/NIC_DEFAULT/MODEL']
elsif (model.nil? || model.empty?) &&
!nic['MODEL'].nil? &&
!nic['MODEL'].empty?
model = nic['MODEL']
else
model = VCenterDriver::VIHelper.get_default('VM/TEMPLATE/NIC/MODEL')
end
vnet_ref = nic["VCENTER_NET_REF"]
backing = nil

Expand Down Expand Up @@ -1002,7 +1012,17 @@ def calculate_add_nic_spec(nic)
def calculate_add_nic_spec_autogenerate_mac(nic)

pg_name = nic["BRIDGE"]
model = one_item.retrieve_xmlelements("TEMPLATE/NIC_DEFAULT/MODEL") || nic["VCENTER_NET_MODEL"] || VCenterDriver::VIHelper.get_default("VM/TEMPLATE/NIC/MODEL")
mode = ''
if !one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').nil? &&
!one_item.retrieve_xmlelements('TEMPLATE/NIC_DEFAULT/MODEL').empty?
model = one_item['TEMPLATE/NIC_DEFAULT/MODEL']
elsif (model.nil? || model.empty?) &&
!nic['MODEL'].nil? &&
!nic['MODEL'].empty?
model = nic['MODEL']
else
model = VCenterDriver::VIHelper.get_default('VM/TEMPLATE/NIC/MODEL')
end
vnet_ref = nic["VCENTER_NET_REF"]
backing = nil

Expand Down

0 comments on commit c06c9cb

Please sign in to comment.