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

feature #1112: Aggregated pool views in Ozones server

This commit is contained in:
Ruben S. Montero 2012-03-17 00:30:55 +01:00
parent 544b8aa52c
commit 414e0dbeaa
3 changed files with 23 additions and 6 deletions

View File

@ -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])

View File

@ -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

View File

@ -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")