1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

Bug #5246: Add better handling of dist switches import

This commit is contained in:
Tino Vazquez 2017-09-06 18:46:10 +02:00
parent c9d22b8b40
commit 722cc2dc0a

View File

@ -549,7 +549,14 @@ class Template
# Let's find out if it is a standard or distributed network
# If distributed, it needs to be instantitaed from the ref
if device.backing.is_a? RbVmomi::VIM::VirtualEthernetCardDistributedVirtualPortBackingInfo
ref = device.backing.port.portKey == "0" ? device.backing.port.portgroupKey : device.backing.port.portKey
if device.backing.port.portKey.match(/^[a-z]+-\d+$/)
ref = device.backing.port.portKey
elsif device.backing.port.portgroupKey.match(/^[a-z]+-\d+$/)
ref = device.backing.port.portgroupKey
else
raise "Cannot get hold of Network for device #{device}"
end
network = RbVmomi::VIM::Network.new(@vi_client.vim, ref)
else
network = device.backing.network