mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
bug #3462: show defined nics for hybrid VMs
This commit is contained in:
parent
b95f0188cc
commit
c59cf85bf7
@ -452,7 +452,28 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
||||
puts
|
||||
CLIHelper.print_header(str_h1 % "VM NICS",false)
|
||||
|
||||
vm_nics = [vm.to_hash['VM']['TEMPLATE']['NIC']].flatten if !vm_nics
|
||||
# vm_nics is defined for hybridvisors. If there are both IP from
|
||||
# the hybridvisor and from OpenNebula nics check if the IP is the
|
||||
# same as one of IPs generated by OpenNebula and show standard
|
||||
# information. If it's a different IP show all the information.
|
||||
#
|
||||
# The template can already contain one NIC not controled by
|
||||
# OpenNebula and we want to show also that info.
|
||||
if vm_nics
|
||||
if vm.has_elements?("/VM/TEMPLATE/NIC")
|
||||
nics = [vm.to_hash['VM']['TEMPLATE']['NIC']].flatten
|
||||
ips = nics.map {|n| n['IP'] }
|
||||
ip = vm_nics.first['IP']
|
||||
|
||||
if ips.include? ip
|
||||
vm_nics = nics
|
||||
else
|
||||
vm_nics += nics
|
||||
end
|
||||
end
|
||||
else
|
||||
vm_nics = [vm.to_hash['VM']['TEMPLATE']['NIC']].flatten
|
||||
end
|
||||
|
||||
nic_default = {"NETWORK" => "-",
|
||||
"IP" => "-",
|
||||
|
Loading…
x
Reference in New Issue
Block a user