From 414e0dbeaa21123525fd70c2af7428442ab351e9 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Sat, 17 Mar 2012 00:30:55 +0100 Subject: [PATCH] feature #1112: Aggregated pool views in Ozones server --- src/ozones/Client/bin/onezone | 12 ++++++++++-- .../Client/lib/cli/ozones_helper/zones_helper.rb | 9 +++++---- src/ozones/Server/lib/OZones/Zones.rb | 8 ++++++++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/ozones/Client/bin/onezone b/src/ozones/Client/bin/onezone index 5eae35012e..ccef51e094 100755 --- a/src/ozones/Client/bin/onezone +++ b/src/ozones/Client/bin/onezone @@ -65,7 +65,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do show_desc = <<-EOT.unindent Show information of a particular Zone - Available resources: host, vm, image, vnet, vmtemplate, user + Available resources: host, vm, image, vnet, vmtemplate, + user, cluster, datastore Examples: onezone show 4 onezone show 4 host @@ -95,6 +96,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do aux_helper = OneTemplateHelper.new when "user" aux_helper = OneUserHelper.new + when "cluster" + aux_helper = OneClusterHelper.new + when "datastore" + aux_helper = OneDatastoreHelper.new else puts "\n:!: Pool #{args[1]} doesn't exist or is not supported\n\n" next 0 @@ -102,7 +107,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do pool_hash_data = helper.get_resource_pool("zone", args[0], args[1], options) - if pool_hash_data[0] != 0 puts "\nError retrieving information for pool #{args[1]}. Reason: " + pool_hash_data[1] + "\n\n" next 0 @@ -123,6 +127,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do pool_hash_data[1].each{|hash| hash.replace(Hash.transform_keys_to_strings(hash))} end + puts + str_h1="%-61s" + CLIHelper.print_header(str_h1 % ["ZONE VIEW - #{args[1]}"],false) + table = aux_helper.format_pool(options) table.show(pool_hash_data[1]) diff --git a/src/ozones/Client/lib/cli/ozones_helper/zones_helper.rb b/src/ozones/Client/lib/cli/ozones_helper/zones_helper.rb index a4bd18b220..71d85c7610 100644 --- a/src/ozones/Client/lib/cli/ozones_helper/zones_helper.rb +++ b/src/ozones/Client/lib/cli/ozones_helper/zones_helper.rb @@ -5,7 +5,8 @@ require 'cli/one_helper/oneimage_helper' require 'cli/one_helper/onevnet_helper' require 'cli/one_helper/onetemplate_helper' require 'cli/one_helper/oneuser_helper' - +require 'cli/one_helper/onecluster_helper' +require 'cli/one_helper/onedatastore_helper' class ZonesHelper < OZonesHelper::OZHelper def initialize(kind, user=nil, pass=nil, endpoint_str=nil, @@ -50,14 +51,14 @@ class ZonesHelper < OZonesHelper::OZHelper return [0, zone] end - CLIHelper.print_header(str_h1 % ["VDCS INFORMATION"]) + CLIHelper.print_header(str_h1 % ["VDCS INFORMATION"], false) st=CLIHelper::ShowTable.new(nil) do - column :ID, "Identifier for VDC", :size=>4 do |d,e| + column :ID, "Identifier for VDC", :size=>5 do |d,e| d[:ID] end - column :NAME, "Name of the VDC", :right, :size=>15 do |d,e| + column :NAME, "Name of the VDC", :left, :size=>15 do |d,e| d[:NAME] end diff --git a/src/ozones/Server/lib/OZones/Zones.rb b/src/ozones/Server/lib/OZones/Zones.rb index 6e9aae9db7..4ec6fac7bd 100644 --- a/src/ozones/Server/lib/OZones/Zones.rb +++ b/src/ozones/Server/lib/OZones/Zones.rb @@ -189,6 +189,10 @@ module OZones OpenNebulaJSON::VirtualNetworkPoolJSON.new(@client) when "template","vmtemplate" then OpenNebulaJSON::TemplatePoolJSON.new(@client) + when "cluster" then + OpenNebulaJSON::ClusterPoolJSON.new(@client) + when "datastore" then + OpenNebulaJSON::DatastorePoolJSON.new(@client) else error = OZones::Error.new("Error: Pool #{pool_kind} not " \ "supported for zone view") @@ -214,6 +218,10 @@ module OZones OZones::AggregatedVirtualNetworks.new when "template","vmtemplate" then OZones::AggregatedTemplates.new + when "cluster" then + OZones::AggregatedCluster.new + when "datastore" then + OZones::AggregatedDatastore.new else error = OZones::Error.new("Error: Pool #{pool_kind} not" \ " supported for aggregated zone view")