1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #1640: show networks in list mode, onevm show

This commit is contained in:
Javi Fontan 2013-02-26 16:07:00 +01:00
parent cc9233e64b
commit 101097d0d9

View File

@ -351,6 +351,49 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
puts
end
if vm.has_elements?("/VM/TEMPLATE/NIC")
CLIHelper.print_header(str_h1 % "VM NICS",false)
nic_id=0
CLIHelper::ShowTable.new(nil, self) do
column :ID, "", :size=>3 do |d|
nic_id+=1
nic_id-1
end
column :NETWORK, "", :left, :size=>25 do |d|
d["NETWORK"] || "-"
end
column :IP, "", :size=>15 do |d|
d["IP"] || "-"
end
column :MAC, "", :size=>17 do |d|
d["MAC"] || "-"
end
column :VLAN, "", :size=>4 do |d|
if !d["VLAN"]
"no"
else
d["VLAN"].downcase
end
end
column :BRIDGE, "", :left, :size=>11 do |d|
d["BRIDGE"] || "-"
end
end.show([vm.to_hash['VM']['TEMPLATE']['NIC']].flatten, {})
while vm.has_elements?("/VM/TEMPLATE/NIC")
vm.delete_element("/VM/TEMPLATE/NIC")
end if !options[:all]
puts
end
CLIHelper.print_header(str_h1 % "VIRTUAL MACHINE TEMPLATE",false)
puts vm.template_str