Class: OneClusterHelper
Overview
OneCluster CLI command helper
Constant Summary
collapse
- CLUSTER =
{
:name => 'cluster',
:short => '-c id|name',
:large => '--cluster id|name',
:description => 'Selects the cluster',
:format => String,
:proc => lambda {|o, _options|
OpenNebulaHelper.rname_to_id(o, 'CLUSTER')
}
}
Instance Attribute Summary
#client
Class Method Summary
collapse
Instance Method Summary
collapse
#check_orphan, client, #create_resource, #filterflag_to_i, filterflag_to_i_desc, get_client, get_password, #group_name, #initialize, #list_pool, #list_pool_format, #list_pool_table, #list_pool_top, #list_pool_xml, #list_to_id, list_to_id_desc, name_to_id, #perform_action, #perform_actions, #print_page, #retrieve_resource, #set_client, set_endpoint, set_password, set_user, #show_resource, #start_pager, #stop_pager, table_conf, #to_id, to_id_desc, #user_name
Class Method Details
.conf_file ⇒ Object
37
38
39
|
# File 'lib/one_helper/onecluster_helper.rb', line 37
def self.conf_file
'onecluster.yaml'
end
|
.rname ⇒ Object
33
34
35
|
# File 'lib/one_helper/onecluster_helper.rb', line 33
def self.rname
'CLUSTER'
end
|
Instance Method Details
#element_size(ehash, ename) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/one_helper/onecluster_helper.rb', line 41
def element_size(ehash, ename)
ids = ehash[ename]['ID']
if ids.nil?
0
elsif ids.class == String
1
else
ids.size
end
end
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/one_helper/onecluster_helper.rb', line 53
def format_pool(_options)
config_file = self.class.table_conf
CLIHelper::ShowTable.new(config_file, self) do
column :ID, 'ONE identifier for the Cluster', :size=>5 do |d|
d['ID']
end
column :NAME, 'Name of the Cluster', :left, :size=>25 do |d|
d['NAME']
end
column :HOSTS, 'Number of Hosts', :size=>5 do |d|
@ext.element_size(d, 'HOSTS') rescue 0
end
column :VNETS, 'Number of Networks', :size=>5 do |d|
@ext.element_size(d, 'VNETS') rescue 0
end
column :DATASTORES, 'Number of Datastores', :size=>10 do |d|
@ext.element_size(d, 'DATASTORES') rescue 0
end
default :ID, :NAME, :HOSTS, :VNETS, :DATASTORES
end
end
|