mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-08 21:17:43 +03:00
Update onecluster_helper.rb
Added description of cluster resources
(cherry picked from commit e48be29da1
)
This commit is contained in:
parent
8e9c2f4d1f
commit
c1c4fd12a1
@ -102,13 +102,38 @@ class OneClusterHelper < OpenNebulaHelper::OneHelper
|
||||
CLIHelper.print_header(str_h1 % "CLUSTER #{cluster['ID']} INFORMATION")
|
||||
puts str % ["ID", cluster.id.to_s]
|
||||
puts str % ["NAME", cluster.name]
|
||||
|
||||
puts
|
||||
CLIHelper.print_header(str_h1 % "CLUSTER RESOURCES", false)
|
||||
cluster.info!
|
||||
total_cpu = 0
|
||||
used_cpu = 0
|
||||
total_ram = 0
|
||||
used_ram = 0
|
||||
|
||||
hosts = cluster.to_hash['CLUSTER']['HOSTS']['ID']
|
||||
hosts.each do |h|
|
||||
h = OpenNebula::Host.new_with_id(h, @client)
|
||||
h.info!
|
||||
h = h.to_hash
|
||||
total_cpu += h['HOST']['HOST_SHARE']['TOTAL_CPU'].to_i/100
|
||||
used_cpu += h['HOST']['HOST_SHARE']['CPU_USAGE'].to_i/100
|
||||
total_ram += h['HOST']['HOST_SHARE']['TOTAL_MEM'].to_i/1024/1024
|
||||
used_ram += h['HOST']['HOST_SHARE']['MEM_USAGE'].to_i/1024/1024
|
||||
end
|
||||
puts "TOTAL CPUs: "+total_cpu.to_s
|
||||
puts "OCCUPIED CPUs: "+used_cpu.to_s
|
||||
puts "AVAILABLE CPUs: "+(total_cpu - used_cpu).to_s
|
||||
puts
|
||||
puts "TOTAL RAM: "+total_ram.to_s
|
||||
puts "OCCUPIED RAM: "+used_ram.to_s
|
||||
puts "AVAILABLE RAM: "+(total_ram - used_ram).to_s
|
||||
|
||||
puts
|
||||
CLIHelper.print_header(str_h1 % "CLUSTER TEMPLATE", false)
|
||||
puts cluster.template_str
|
||||
|
||||
puts
|
||||
|
||||
puts
|
||||
CLIHelper.print_header("%-15s" % ["HOSTS"])
|
||||
cluster.host_ids.each do |id|
|
||||
puts "%-15s" % [id]
|
||||
|
Loading…
Reference in New Issue
Block a user