opennebula-cli 6.0.0.3 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/oneacct +2 -13
- data/bin/oneacl +2 -13
- data/bin/onecluster +2 -13
- data/bin/onedatastore +2 -13
- data/bin/oneflow +2 -13
- data/bin/oneflow-template +2 -13
- data/bin/onegroup +2 -13
- data/bin/onehook +6 -17
- data/bin/onehost +2 -13
- data/bin/oneimage +6 -17
- data/bin/onemarket +2 -13
- data/bin/onemarketapp +10 -21
- data/bin/onesecgroup +2 -13
- data/bin/oneshowback +2 -13
- data/bin/onetemplate +8 -28
- data/bin/oneuser +2 -13
- data/bin/onevcenter +3 -14
- data/bin/onevdc +2 -13
- data/bin/onevm +18 -180
- data/bin/onevmgroup +6 -17
- data/bin/onevnet +6 -17
- data/bin/onevntemplate +6 -17
- data/bin/onevrouter +6 -17
- data/bin/onezone +3 -14
- data/lib/one_helper/onecluster_helper.rb +42 -75
- data/lib/one_helper/onevm_helper.rb +0 -20
- data/lib/one_helper/onevnet_helper.rb +151 -173
- data/lib/one_helper/onezone_helper.rb +4 -12
- data/lib/one_helper.rb +2 -2
- data/share/schemas/xsd/opennebula_configuration.xsd +0 -1
- data/share/schemas/xsd/vnet.xsd +0 -2
- metadata +32 -32
@@ -16,71 +16,73 @@
|
|
16
16
|
|
17
17
|
require 'one_helper'
|
18
18
|
|
19
|
-
# OneCluster CLI command helper
|
20
19
|
class OneClusterHelper < OpenNebulaHelper::OneHelper
|
21
20
|
|
22
21
|
CLUSTER = {
|
23
|
-
:name =>
|
24
|
-
:short =>
|
25
|
-
:large =>
|
26
|
-
:description =>
|
22
|
+
:name => "cluster",
|
23
|
+
:short => "-c id|name",
|
24
|
+
:large => "--cluster id|name" ,
|
25
|
+
:description => "Selects the cluster",
|
27
26
|
:format => String,
|
28
|
-
:proc => lambda {|o,
|
29
|
-
OpenNebulaHelper.rname_to_id(o,
|
27
|
+
:proc => lambda { |o, options|
|
28
|
+
OpenNebulaHelper.rname_to_id(o, "CLUSTER")
|
30
29
|
}
|
31
30
|
}
|
32
31
|
|
33
32
|
def self.rname
|
34
|
-
|
33
|
+
"CLUSTER"
|
35
34
|
end
|
36
35
|
|
37
36
|
def self.conf_file
|
38
|
-
|
37
|
+
"onecluster.yaml"
|
39
38
|
end
|
40
39
|
|
41
40
|
def element_size(ehash, ename)
|
42
|
-
ids = ehash[ename][
|
41
|
+
ids = ehash[ename]["ID"]
|
43
42
|
|
44
43
|
if ids.nil?
|
45
|
-
0
|
44
|
+
return 0
|
46
45
|
elsif ids.class == String
|
47
|
-
1
|
46
|
+
return 1
|
48
47
|
else
|
49
|
-
ids.size
|
48
|
+
return ids.size
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
53
|
-
|
52
|
+
|
53
|
+
def format_pool(options)
|
54
54
|
config_file = self.class.table_conf
|
55
55
|
|
56
|
-
CLIHelper::ShowTable.new(config_file, self) do
|
57
|
-
column :ID,
|
58
|
-
d[
|
56
|
+
table = CLIHelper::ShowTable.new(config_file, self) do
|
57
|
+
column :ID, "ONE identifier for the Cluster", :size=>5 do |d|
|
58
|
+
d["ID"]
|
59
59
|
end
|
60
60
|
|
61
|
-
column :NAME,
|
62
|
-
d[
|
61
|
+
column :NAME, "Name of the Cluster", :left, :size=>25 do |d|
|
62
|
+
d["NAME"]
|
63
63
|
end
|
64
64
|
|
65
|
-
column :HOSTS,
|
66
|
-
@ext.element_size(d,
|
65
|
+
column :HOSTS, "Number of Hosts", :size=>5 do |d|
|
66
|
+
@ext.element_size(d,"HOSTS") rescue 0
|
67
67
|
end
|
68
68
|
|
69
|
-
column :VNETS,
|
70
|
-
@ext.element_size(d,
|
69
|
+
column :VNETS, "Number of Networks", :size=>5 do |d|
|
70
|
+
@ext.element_size(d,"VNETS") rescue 0
|
71
71
|
end
|
72
72
|
|
73
|
-
column :DATASTORES,
|
74
|
-
@ext.element_size(d,
|
73
|
+
column :DATASTORES, "Number of Datastores", :size=>10 do |d|
|
74
|
+
@ext.element_size(d,"DATASTORES") rescue 0
|
75
75
|
end
|
76
76
|
|
77
77
|
default :ID, :NAME, :HOSTS, :VNETS, :DATASTORES
|
78
78
|
end
|
79
|
+
|
80
|
+
table
|
79
81
|
end
|
80
82
|
|
81
83
|
private
|
82
84
|
|
83
|
-
def factory(id
|
85
|
+
def factory(id=nil)
|
84
86
|
if id
|
85
87
|
OpenNebula::Cluster.new_with_id(id, @client)
|
86
88
|
else
|
@@ -89,74 +91,39 @@ class OneClusterHelper < OpenNebulaHelper::OneHelper
|
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
92
|
-
def factory_pool(
|
94
|
+
def factory_pool(user_flag=-2)
|
93
95
|
OpenNebula::ClusterPool.new(@client)
|
94
96
|
end
|
95
97
|
|
96
|
-
def format_resource(cluster,
|
97
|
-
str=
|
98
|
-
str_h1=
|
98
|
+
def format_resource(cluster, options = {})
|
99
|
+
str="%-18s: %-20s"
|
100
|
+
str_h1="%-80s"
|
99
101
|
|
100
102
|
CLIHelper.print_header(str_h1 % "CLUSTER #{cluster['ID']} INFORMATION")
|
101
|
-
puts
|
102
|
-
puts
|
103
|
-
|
103
|
+
puts str % ["ID", cluster.id.to_s]
|
104
|
+
puts str % ["NAME", cluster.name]
|
104
105
|
puts
|
105
|
-
CLIHelper.print_header(str_h1 % 'CLUSTER RESOURCES', false)
|
106
|
-
cluster.info!
|
107
|
-
|
108
|
-
hosts = cluster.to_hash['CLUSTER']['HOSTS']['ID']
|
109
|
-
|
110
|
-
if hosts
|
111
|
-
total_cpu = 0
|
112
|
-
used_cpu = 0
|
113
|
-
total_ram = 0
|
114
|
-
used_ram = 0
|
115
|
-
|
116
|
-
[hosts].flatten.each do |h|
|
117
|
-
h = OpenNebula::Host.new_with_id(h, @client)
|
118
|
-
|
119
|
-
h.info!
|
120
|
-
|
121
|
-
h = h.to_hash
|
122
|
-
h = h['HOST']['HOST_SHARE']
|
123
106
|
|
124
|
-
|
125
|
-
used_cpu += h['CPU_USAGE'].to_i / 100
|
126
|
-
total_ram += h['TOTAL_MEM'].to_i / 1024 / 1024
|
127
|
-
used_ram += h['MEM_USAGE'].to_i / 1024 / 1024
|
128
|
-
end
|
129
|
-
|
130
|
-
puts "TOTAL CPUs: #{total_cpu}"
|
131
|
-
puts "OCCUPIED CPUs: #{used_cpu}"
|
132
|
-
puts "AVAILABLE CPUs: #{total_cpu - used_cpu}"
|
133
|
-
puts
|
134
|
-
puts "TOTAL RAM: #{total_ram}"
|
135
|
-
puts "OCCUPIED RAM: #{used_ram}"
|
136
|
-
puts "AVAILABLE RAM: #{total_ram - used_ram}"
|
137
|
-
end
|
138
|
-
|
139
|
-
puts
|
140
|
-
CLIHelper.print_header(str_h1 % 'CLUSTER TEMPLATE', false)
|
107
|
+
CLIHelper.print_header(str_h1 % "CLUSTER TEMPLATE", false)
|
141
108
|
puts cluster.template_str
|
142
109
|
|
143
110
|
puts
|
144
|
-
|
111
|
+
|
112
|
+
CLIHelper.print_header("%-15s" % ["HOSTS"])
|
145
113
|
cluster.host_ids.each do |id|
|
146
|
-
puts
|
114
|
+
puts "%-15s" % [id]
|
147
115
|
end
|
148
116
|
|
149
117
|
puts
|
150
|
-
CLIHelper.print_header(
|
118
|
+
CLIHelper.print_header("%-15s" % ["VNETS"])
|
151
119
|
cluster.vnet_ids.each do |id|
|
152
|
-
puts
|
120
|
+
puts "%-15s" % [id]
|
153
121
|
end
|
154
122
|
|
155
123
|
puts
|
156
|
-
CLIHelper.print_header(
|
124
|
+
CLIHelper.print_header("%-15s" % ["DATASTORES"])
|
157
125
|
cluster.datastore_ids.each do |id|
|
158
|
-
puts
|
126
|
+
puts "%-15s" % [id]
|
159
127
|
end
|
160
128
|
end
|
161
|
-
|
162
129
|
end
|
@@ -1086,26 +1086,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
1086
1086
|
end
|
1087
1087
|
end
|
1088
1088
|
|
1089
|
-
if vm_hash['VM']['TEMPLATE']['NIC']
|
1090
|
-
nic = [vm_hash['VM']['TEMPLATE']['NIC']]
|
1091
|
-
nic = nic.flatten
|
1092
|
-
nic = nic.select {|v| !v['EXTERNAL_PORT_RANGE'].nil? }[0]
|
1093
|
-
|
1094
|
-
if nic
|
1095
|
-
ip = vm_hash['VM']['HISTORY_RECORDS']['HISTORY']
|
1096
|
-
ip = [ip].flatten[-1]['HOSTNAME']
|
1097
|
-
port = Integer(nic['EXTERNAL_PORT_RANGE'].split(':')[0]) + 21
|
1098
|
-
|
1099
|
-
puts
|
1100
|
-
CLIHelper.print_header(str_h1 % 'PORT FORWARD', false)
|
1101
|
-
|
1102
|
-
puts "[#{nic['EXTERNAL_PORT_RANGE']}]:" \
|
1103
|
-
"[#{nic['INTERNAL_PORT_RANGE'].split('/')[0]}]"
|
1104
|
-
|
1105
|
-
puts "SSH on #{ip} at port #{port}"
|
1106
|
-
end
|
1107
|
-
end
|
1108
|
-
|
1109
1089
|
if !options[:all]
|
1110
1090
|
while vm.has_elements?('/VM/TEMPLATE/NIC')
|
1111
1091
|
vm.delete_element('/VM/TEMPLATE/NIC')
|