mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 04:12:37 +09:00
bug #3462: show defined nics for hybrid VMs
This commit is contained in:
1 parent
e0b087b4e2
commit
641eac09b5
1 file changed
+22
-1
@@ -438,7 +438,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" => "-",
|
||||
|
||||
Reference in new issue
Block a user