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

Feature #1285: rearrange one* list column widths

(cherry picked from commit 75b79c99c87798cf256f629f62f7e8730701fd7c)
This commit is contained in:
Carlos Martín 2012-07-04 16:19:47 +02:00
parent 299a96bb7c
commit 186e1d2e95
19 changed files with 103 additions and 95 deletions

View File

@ -1,11 +1,11 @@
---
:ID:
:desc: ONE identifier for the Cluster
:size: 4
:size: 5
:NAME:
:desc: Name of the Cluster
:size: 15
:size: 25
:left: true
:HOSTS:

View File

@ -5,27 +5,26 @@
:NAME:
:desc: Name of the Datastore
:size: 15
:size: 25
:left: true
:CLUSTER:
:desc: Name of the Cluster
:size: 8
:size: 15
:left: true
:IMAGES:
:desc: Number of Images
:size: 6
:left: true
:TYPE:
:desc: Datastore driver
:size: 6
:size: 8
:left: true
:TM:
:desc: Transfer driver
:size: 6
:size: 8
:left: true
:default:

View File

@ -5,12 +5,12 @@
:NAME:
:desc: Name of the Group
:size: 15
:size: 25
:left: true
:VMS:
:desc: Number of VMS
:size: 8
:size: 6
:MEMORY:
:desc: Total memory allocated to user VMs

View File

@ -5,45 +5,46 @@
:NAME:
:desc: Name of the Host
:size: 12
:size: 15
:left: true
:CLUSTER:
:desc: Name of the Cluster
:size: 8
:size: 9
:left: true
:RVM:
:desc: Number of Virtual Machines running
:size: 6
:size: 3
:TCPU:
:desc: Total CPU percentage
:size: 6
:size: 4
:FCPU:
:desc: Free CPU percentage
:size: 6
:size: 4
:ACPU:
:desc: Available cpu percentage (not reserved by VMs)
:size: 6
:size: 4
:TMEM:
:desc: Total Memory
:size: 6
:size: 7
:FMEM:
:desc: Free Memory
:size: 6
:size: 7
:AMEM:
:desc: Available Memory (not reserved by VMs)
:size: 6
:size: 7
:STAT:
:desc: Host status
:size: 7
:size: 6
:left: true
:default:
- :ID

View File

@ -5,17 +5,17 @@
:USER:
:desc: Username of the Virtual Machine owner
:size: 8
:size: 10
:left: true
:GROUP:
:desc: Group of the Virtual Machine
:size: 8
:size: 10
:left: true
:NAME:
:desc: Name of the Image
:size: 12
:size: 15
:left: true
:DATASTORE:
@ -30,10 +30,11 @@
:TYPE:
:desc: Type of the Image
:size: 4
:left: true
:REGTIME:
:desc: Registration time of the Image
:size: 16
:size: 15
:PERSISTENT:
:desc: Whether the Image is persistent or not
@ -42,10 +43,11 @@
:STAT:
:desc: State of the Image
:size: 4
:left: true
:RVMS:
:desc: Number of VMs currently running from this Image
:size: 5
:size: 4
:default:
- :ID

View File

@ -5,22 +5,22 @@
:NAME:
:desc: Name of the Template
:size: 15
:size: 27
:left: true
:USER:
:desc: Username of the Template owner
:size: 8
:size: 15
:left: true
:GROUP:
:desc: Group of the Template
:size: 8
:size: 15
:left: true
:REGTIME:
:desc: Registration time of the Template
:size: 20
:size: 15
:default:
- :ID

View File

@ -5,22 +5,22 @@
:NAME:
:desc: Name of the User
:size: 15
:size: 18
:left: true
:GROUP:
:desc: Group of the User
:size: 8
:size: 15
:left: true
:AUTH:
:desc: Auth driver of the User
:size: 8
:size: 15
:left: true
:VMS:
:desc: Number of VMS
:size: 8
:size: 6
:MEMORY:
:desc: Total memory allocated to user VMs

View File

@ -5,7 +5,7 @@
:NAME:
:desc: Name of the Virtual Machine
:size: 12
:size: 15
:left: true
:USER:
@ -24,7 +24,7 @@
:UCPU:
:desc: CPU percentage used by the VM
:size: 3
:size: 4
:UMEM:
:desc: Memory used by the VM
@ -32,11 +32,12 @@
:HOST:
:desc: Host where the VM is running
:size: 15
:size: 10
:left: true
:TIME:
:desc: Time since the VM was submitted
:size: 11
:size: 10
:default:
- :ID

View File

@ -5,12 +5,12 @@
:USER:
:desc: Username of the Virtual Network owner
:size: 8
:size: 12
:left: true
:GROUP:
:desc: Group of the Virtual Network
:size: 8
:size: 12
:left: true
:NAME:
@ -20,7 +20,7 @@
:CLUSTER:
:desc: Name of the Cluster
:size: 8
:size: 10
:left: true
:TYPE:
@ -29,15 +29,16 @@
:SIZE:
:desc: Size of the Virtual Network
:size: 6
:size: 5
:BRIDGE:
:desc: Bridge associated to the Virtual Network
:size: 6
:size: 8
:left: true
:LEASES:
:desc: Number of this Virtual Networks given leases
:size: 7
:size: 6
:default:
- :ID

View File

@ -369,13 +369,17 @@ EOT
end
end
def OpenNebulaHelper.period_to_str(time)
def OpenNebulaHelper.period_to_str(time, print_seconds=true)
seconds=time.to_i
minutes, seconds=seconds.divmod(60)
hours, minutes=minutes.divmod(60)
days, hours=hours.divmod(24)
"%4dd %02d:%02d:%02d" % [days, hours, minutes, seconds]
if print_seconds
"%3dd %02d:%02d:%02d" % [days, hours, minutes, seconds]
else
"%3dd %02d:%02d" % [days, hours, minutes]
end
end
BinarySufix = ["K", "M", "G", "T" ]

View File

@ -49,23 +49,23 @@ class OneClusterHelper < OpenNebulaHelper::OneHelper
config_file = self.class.table_conf
table = CLIHelper::ShowTable.new(config_file, self) do
column :ID, "ONE identifier for the Cluster", :size=>4 do |d|
column :ID, "ONE identifier for the Cluster", :size=>5 do |d|
d["ID"]
end
column :NAME, "Name of the Cluster", :left, :size=>15 do |d|
column :NAME, "Name of the Cluster", :left, :size=>25 do |d|
d["NAME"]
end
column :HOSTS, "Number of Hosts", :left, :size=>5 do |d|
column :HOSTS, "Number of Hosts", :size=>5 do |d|
d["HOSTS"]["ID"] ? d["HOSTS"]["ID"].size : 0
end
column :VNETS, "Number of Networks", :left, :size=>5 do |d|
column :VNETS, "Number of Networks", :size=>5 do |d|
d["VNETS"]["ID"] ? d["VNETS"]["ID"].size : 0
end
column :DATASTORES, "Number of Datastores", :left, :size=>10 do |d|
column :DATASTORES, "Number of Datastores", :size=>10 do |d|
d["DATASTORES"]["ID"] ? d["DATASTORES"]["ID"].size : 0
end

View File

@ -52,15 +52,15 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
d["ID"]
end
column :NAME, "Name of the Datastore", :left, :size=>12 do |d|
column :NAME, "Name of the Datastore", :left, :size=>25 do |d|
d["NAME"]
end
column :CLUSTER, "Name of the Cluster", :left, :size=>8 do |d|
column :CLUSTER, "Name of the Cluster", :left, :size=>15 do |d|
OpenNebulaHelper.cluster_str(d["CLUSTER"])
end
column :IMAGES, "Number of Images", :left, :size=>6 do |d|
column :IMAGES, "Number of Images", :size=>6 do |d|
if d["IMAGES"]["ID"].nil?
"0"
else
@ -68,15 +68,15 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
end
end
column :TYPE, "Datastore driver", :left, :size=>6 do |d|
column :TYPE, "Datastore driver", :left, :size=>8 do |d|
d["DS_MAD"]
end
column :TM, "Transfer driver", :left, :size=>6 do |d|
column :TM, "Transfer driver", :left, :size=>8 do |d|
d["TM_MAD"]
end
default :ID, :CLUSTER, :NAME, :IMAGES, :TYPE, :TM
default :ID, :NAME, :CLUSTER, :IMAGES, :TYPE, :TM
end
table

View File

@ -53,11 +53,11 @@ class OneGroupHelper < OpenNebulaHelper::OneHelper
d["ID"]
end
column :NAME, "Name of the Group", :left, :size=>15 do |d|
column :NAME, "Name of the Group", :left, :size=>25 do |d|
d["NAME"]
end
column :VMS, "Total number of VMS", :size=>8 do |d|
column :VMS, "Total number of VMS", :size=>6 do |d|
if d.has_key?('VM_QUOTA') and d['VM_QUOTA'].has_key?('VM')
d['VM_QUOTA']['VM']['VMS_USED']
else

View File

@ -40,54 +40,54 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
d["ID"]
end
column :NAME, "Name of the Host", :left, :size=>12 do |d|
column :NAME, "Name of the Host", :left, :size=>15 do |d|
d["NAME"]
end
column :CLUSTER, "Name of the Cluster", :left, :size=>8 do |d|
column :CLUSTER, "Name of the Cluster", :left, :size=>9 do |d|
OpenNebulaHelper.cluster_str(d["CLUSTER"])
end
column :RVM, "Number of Virtual Machines running", :size=>6 do |d|
column :RVM, "Number of Virtual Machines running", :size=>3 do |d|
d["HOST_SHARE"]["RUNNING_VMS"]
end
column :TCPU, "Total CPU percentage", :size=>6 do |d|
column :TCPU, "Total CPU percentage", :size=>4 do |d|
d["HOST_SHARE"]["MAX_CPU"]
end
column :FCPU, "Free CPU percentage", :size=>6 do |d|
column :FCPU, "Free CPU percentage", :size=>4 do |d|
d["HOST_SHARE"]["MAX_CPU"].to_i-
d["HOST_SHARE"]["USED_CPU"].to_i
end
column :ACPU, "Available cpu percentage (not reserved by VMs)",
:size=>6 do |d|
:size=>4 do |d|
max_cpu=d["HOST_SHARE"]["MAX_CPU"].to_i
max_cpu=100 if max_cpu==0
max_cpu-d["HOST_SHARE"]["CPU_USAGE"].to_i
end
column :TMEM, "Total Memory", :size=>6 do |d|
column :TMEM, "Total Memory", :size=>7 do |d|
OpenNebulaHelper.unit_to_str(
d["HOST_SHARE"]["MAX_MEM"].to_i,
options)
end
column :FMEM, "Free Memory", :size=>6 do |d|
column :FMEM, "Free Memory", :size=>7 do |d|
OpenNebulaHelper.unit_to_str(
d["HOST_SHARE"]["FREE_MEM"].to_i,
options)
end
column :AMEM, "Available Memory (not reserved by VMs)",
:size=>6 do |d|
:size=>7 do |d|
acpu=d["HOST_SHARE"]["MAX_MEM"].to_i-
d["HOST_SHARE"]["MEM_USAGE"].to_i
OpenNebulaHelper.unit_to_str(acpu,options)
end
column :STAT, "Host status", :size=>7 do |d|
column :STAT, "Host status", :left, :size=>6 do |d|
OneHostHelper.state_to_str(d["STATE"])
end

View File

@ -45,30 +45,30 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
d["ID"]
end
column :USER, "Username of the Virtual Machine owner", :left,
:size=>8 do |d|
column :USER, "Username of the Image owner", :left,
:size=>10 do |d|
helper.user_name(d, options)
end
column :GROUP, "Group of the Virtual Machine", :left,
:size=>8 do |d|
column :GROUP, "Group of the Image", :left,
:size=>10 do |d|
helper.group_name(d, options)
end
column :NAME, "Name of the Image", :left, :size=>12 do |d|
column :NAME, "Name of the Image", :left, :size=>15 do |d|
d["NAME"]
end
column :DATASTORE, "Name of the Image", :left, :size=>10 do |d|
column :DATASTORE, "Name of the Datastore", :left, :size=>10 do |d|
d["DATASTORE"]
end
column :TYPE, "Type of the Image", :size=>4 do |d,e|
column :TYPE, "Type of the Image", :left, :size=>4 do |d,e|
OneImageHelper.type_to_str(d["TYPE"])
end
column :REGTIME, "Registration time of the Image",
:size=>20 do |d|
:size=>15 do |d|
OpenNebulaHelper.time_to_str(d["REGTIME"])
end
@ -77,12 +77,12 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
OpenNebulaHelper.boolean_to_str(d["PERSISTENT"])
end
column :STAT, "State of the Image", :size=>4 do |d|
column :STAT, "State of the Image", :left, :size=>4 do |d|
OneImageHelper.state_to_str(d["STATE"])
end
column :RVMS, "Number of VMs currently running from this Image",
:size=>5 do |d|
:size=>4 do |d|
d['RUNNING_VMS']
end

View File

@ -53,21 +53,21 @@ EOT
d["ID"]
end
column :NAME, "Name of the Template", :left, :size=>15 do |d|
column :NAME, "Name of the Template", :left, :size=>27 do |d|
d["NAME"]
end
column :USER, "Username of the Template owner", :left,
:size=>8 do |d|
:size=>15 do |d|
helper.user_name(d, options)
end
column :GROUP, "Group of the Template", :left, :size=>8 do |d|
column :GROUP, "Group of the Template", :left, :size=>15 do |d|
helper.group_name(d, options)
end
column :REGTIME, "Registration time of the Template",
:size=>20 do |d|
:size=>15 do |d|
OpenNebulaHelper.time_to_str(d["REGTIME"])
end

View File

@ -152,19 +152,19 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
d["ID"]
end
column :NAME, "Name of the User", :left, :size=>15 do |d|
column :NAME, "Name of the User", :left, :size=>18 do |d|
d["NAME"]
end
column :GROUP, "Group of the User", :left, :size=>8 do |d|
column :GROUP, "Group of the User", :left, :size=>15 do |d|
helper.group_name(d, options)
end
column :AUTH, "Auth driver of the User", :left, :size=>8 do |d|
column :AUTH, "Auth driver of the User", :left, :size=>15 do |d|
d["AUTH_DRIVER"]
end
column :VMS, "Number of VMS", :size=>8 do |d|
column :VMS, "Number of VMS", :size=>6 do |d|
if d.has_key?('VM_QUOTA') and d['VM_QUOTA'].has_key?('VM')
d['VM_QUOTA']['VM']['VMS_USED']
else

View File

@ -111,7 +111,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
OneVMHelper.state_to_str(d["STATE"], d["LCM_STATE"])
end
column :UCPU, "CPU percentage used by the VM", :size=>3 do |d|
column :UCPU, "CPU percentage used by the VM", :size=>4 do |d|
d["CPU"]
end
@ -119,7 +119,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
OpenNebulaHelper.unit_to_str(d["MEMORY"].to_i, options)
end
column :HOST, "Host where the VM is running", :size=>15 do |d|
column :HOST, "Host where the VM is running", :left, :size=>10 do |d|
if d['HISTORY_RECORDS'] && d['HISTORY_RECORDS']['HISTORY']
state_str = VirtualMachine::VM_STATE[d['STATE'].to_i]
if %w{ACTIVE SUSPENDED}.include? state_str
@ -128,11 +128,11 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
end
end
column :TIME, "Time since the VM was submitted", :size=>11 do |d|
column :TIME, "Time since the VM was submitted", :size=>10 do |d|
stime = d["STIME"].to_i
etime = d["ETIME"]=="0" ? Time.now.to_i : d["ETIME"].to_i
dtime = etime-stime
OpenNebulaHelper.period_to_str(dtime)
OpenNebulaHelper.period_to_str(dtime, false)
end
default :ID, :USER, :GROUP, :NAME, :STAT, :UCPU, :UMEM, :HOST,

View File

@ -40,12 +40,12 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
end
column :USER, "Username of the Virtual Network owner", :left,
:size=>8 do |d|
:size=>12 do |d|
helper.user_name(d, options)
end
column :GROUP, "Group of the Virtual Network", :left,
:size=>8 do |d|
:size=>12 do |d|
helper.group_name(d, options)
end
@ -54,7 +54,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
d["NAME"]
end
column :CLUSTER, "Name of the Cluster", :left, :size=>8 do |d|
column :CLUSTER, "Name of the Cluster", :left, :size=>10 do |d|
OpenNebulaHelper.cluster_str(d["CLUSTER"])
end
@ -66,8 +66,8 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
d["SIZE"]
end
column :BRIDGE, "Bridge associated to the Virtual Network",
:size=>6 do |d|
column :BRIDGE, "Bridge associated to the Virtual Network", :left,
:size=>8 do |d|
d["BRIDGE"]
end
@ -76,7 +76,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
d["TOTAL_LEASES"]
end
default :ID, :USER, :GROUP, :NAME, :TYPE, :BRIDGE, :LEASES
default :ID, :USER, :GROUP, :NAME, :CLUSTER, :TYPE, :BRIDGE, :LEASES
end
table