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

Feature #1224: onevm show formats the snapshots in a table

This commit is contained in:
Carlos Martín 2013-02-21 14:20:25 +01:00
parent ac87bd785c
commit f94ba3da52

View File

@ -281,6 +281,35 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
puts
end
if vm.has_elements?("/VM/TEMPLATE/SNAPSHOT")
CLIHelper.print_header(str_h1 % "SNAPSHOTS",false)
CLIHelper::ShowTable.new(nil, self) do
column :"ID", "", :size=>4 do |d|
d["SNAPSHOT_ID"] if !d.nil?
end
column :"TIME", "", :size=>12 do |d|
OpenNebulaHelper.time_to_str(d["TIME"], false) if !d.nil?
end
column :"NAME", "", :left, :size=>46 do |d|
d["NAME"] if !d.nil?
end
column :"HYPERVISOR_ID", "", :left, :size=>15 do |d|
d["NAME"] if !d.nil?
end
end.show([vm.to_hash['VM']['TEMPLATE']['SNAPSHOT']].flatten, {})
vm.delete_element("/VM/TEMPLATE/SNAPSHOT")
puts
end
CLIHelper.print_header(str_h1 % "VIRTUAL MACHINE TEMPLATE",false)
puts vm.template_str