From f94ba3da529b21958da990522821c2e0e9e7613b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 21 Feb 2013 14:20:25 +0100 Subject: [PATCH] Feature #1224: onevm show formats the snapshots in a table --- src/cli/one_helper/onevm_helper.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/cli/one_helper/onevm_helper.rb b/src/cli/one_helper/onevm_helper.rb index aaa53b8435..b7e691b2bf 100644 --- a/src/cli/one_helper/onevm_helper.rb +++ b/src/cli/one_helper/onevm_helper.rb @@ -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