opennebula-cli 4.2.0 → 4.3.80.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/onecluster +10 -0
- data/bin/onedatastore +10 -0
- data/bin/onehost +19 -8
- data/bin/oneuser +25 -1
- data/bin/onevm +10 -7
- data/lib/one_helper.rb +76 -3
- data/lib/one_helper/onecluster_helper.rb +0 -1
- data/lib/one_helper/onedatastore_helper.rb +9 -6
- data/lib/one_helper/onegroup_helper.rb +8 -3
- data/lib/one_helper/onehost_helper.rb +96 -2
- data/lib/one_helper/onequota_helper.rb +20 -5
- data/lib/one_helper/oneuser_helper.rb +3 -1
- data/lib/one_helper/onevm_helper.rb +8 -1
- metadata +7 -7
data/bin/onecluster
CHANGED
@@ -197,4 +197,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
197
197
|
obj.update(str, options[:append])
|
198
198
|
end
|
199
199
|
end
|
200
|
+
|
201
|
+
rename_desc = <<-EOT.unindent
|
202
|
+
Renames the Cluster
|
203
|
+
EOT
|
204
|
+
|
205
|
+
command :rename, rename_desc, :clusterid, :name do
|
206
|
+
helper.perform_action(args[0],options,"renamed") do |o|
|
207
|
+
o.rename(args[1])
|
208
|
+
end
|
209
|
+
end
|
200
210
|
end
|
data/bin/onedatastore
CHANGED
@@ -174,4 +174,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
174
174
|
obj.update(str, options[:append])
|
175
175
|
end
|
176
176
|
end
|
177
|
+
|
178
|
+
rename_desc = <<-EOT.unindent
|
179
|
+
Renames the Datastore
|
180
|
+
EOT
|
181
|
+
|
182
|
+
command :rename, rename_desc, :datastoreid, :name do
|
183
|
+
helper.perform_action(args[0],options,"renamed") do |o|
|
184
|
+
o.rename(args[1])
|
185
|
+
end
|
186
|
+
end
|
177
187
|
end
|
data/bin/onehost
CHANGED
@@ -20,8 +20,10 @@ ONE_LOCATION=ENV["ONE_LOCATION"]
|
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
22
|
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
|
23
|
+
REMOTES_LOCATION="/var/lib/one/remotes"
|
23
24
|
else
|
24
25
|
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
|
26
|
+
REMOTES_LOCATION=ONE_LOCATION+"/var/remotes/"
|
25
27
|
end
|
26
28
|
|
27
29
|
$: << RUBY_LIB_LOCATION
|
@@ -72,6 +74,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
72
74
|
}
|
73
75
|
|
74
76
|
CREAT_OPTIONS = [ IM, VMM, VNET, OneClusterHelper::CLUSTER ]
|
77
|
+
SYNC_OPTIONS = [ OneClusterHelper::CLUSTER ]
|
75
78
|
|
76
79
|
########################################################################
|
77
80
|
# Formatters for arguments
|
@@ -164,16 +167,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
164
167
|
sync_desc = <<-EOT.unindent
|
165
168
|
Synchronizes probes in /var/lib/one/remotes ($ONE_LOCATION/var/remotes
|
166
169
|
in self-contained installations) with Hosts.
|
167
|
-
|
170
|
+
Examples:
|
171
|
+
onehost sync
|
172
|
+
onehost sync -c myCluster
|
173
|
+
onehost sync host01,host02,host03
|
168
174
|
EOT
|
169
175
|
|
170
|
-
command :sync, sync_desc do
|
171
|
-
|
172
|
-
FileUtils.touch "#{ONE_LOCATION}/var/remotes"
|
173
|
-
else
|
174
|
-
FileUtils.touch "/var/lib/one/remotes"
|
175
|
-
end
|
176
|
-
0
|
176
|
+
command :sync, sync_desc, [:range,:hostid_list, nil], :options=>SYNC_OPTIONS do
|
177
|
+
helper.sync(args[0],options)
|
177
178
|
end
|
178
179
|
|
179
180
|
list_desc = <<-EOT.unindent
|
@@ -213,4 +214,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
213
214
|
host.flush
|
214
215
|
end
|
215
216
|
end
|
217
|
+
|
218
|
+
rename_desc = <<-EOT.unindent
|
219
|
+
Renames the Host
|
220
|
+
EOT
|
221
|
+
|
222
|
+
command :rename, rename_desc, :hostid, :name do
|
223
|
+
helper.perform_action(args[0],options,"renamed") do |o|
|
224
|
+
o.rename(args[1])
|
225
|
+
end
|
226
|
+
end
|
216
227
|
end
|
data/bin/oneuser
CHANGED
@@ -380,7 +380,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
380
380
|
end
|
381
381
|
|
382
382
|
chgrp_desc = <<-EOT.unindent
|
383
|
-
Changes the User's
|
383
|
+
Changes the User's primary group
|
384
384
|
EOT
|
385
385
|
|
386
386
|
command :chgrp, chgrp_desc, [:range, :userid_list], :groupid do
|
@@ -389,6 +389,30 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
389
389
|
end
|
390
390
|
end
|
391
391
|
|
392
|
+
addgroup_desc = <<-EOT.unindent
|
393
|
+
Adds the User to a secondary group
|
394
|
+
EOT
|
395
|
+
|
396
|
+
command :addgroup, addgroup_desc, [:range, :userid_list], :groupid do
|
397
|
+
gid = args[1]
|
398
|
+
|
399
|
+
helper.perform_actions(args[0],options,"group added") do |user|
|
400
|
+
user.addgroup( gid )
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
delgroup_desc = <<-EOT.unindent
|
405
|
+
Removes the User from a secondary group
|
406
|
+
EOT
|
407
|
+
|
408
|
+
command :delgroup, delgroup_desc, [:range, :userid_list], :groupid do
|
409
|
+
gid = args[1]
|
410
|
+
|
411
|
+
helper.perform_actions(args[0],options,"group deleted") do |user|
|
412
|
+
user.delgroup( gid )
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
392
416
|
chauth_desc = <<-EOT.unindent
|
393
417
|
Changes the User's auth driver and its password (optional)
|
394
418
|
Examples:
|
data/bin/onevm
CHANGED
@@ -111,6 +111,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
111
111
|
OpenNebulaHelper.rname_to_id(arg, "USER")
|
112
112
|
end
|
113
113
|
|
114
|
+
set :format, :datastoreid, OpenNebulaHelper.rname_to_id_desc("DATASTORE") do |arg|
|
115
|
+
OpenNebulaHelper.rname_to_id(arg, "DATASTORE")
|
116
|
+
end
|
117
|
+
|
114
118
|
set :format, :vmid, OneVMHelper.to_id_desc do |arg|
|
115
119
|
helper.to_id(arg)
|
116
120
|
end
|
@@ -318,7 +322,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
318
322
|
|
319
323
|
With --hard it unplugs the VM.
|
320
324
|
|
321
|
-
States: RUNNING
|
325
|
+
States: RUNNING, UNKNOWN (with --hard)
|
322
326
|
EOT
|
323
327
|
|
324
328
|
command :shutdown, shutdown_desc, [:range,:vmid_list],
|
@@ -413,17 +417,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
413
417
|
States: PENDING
|
414
418
|
EOT
|
415
419
|
|
416
|
-
command :deploy, deploy_desc, [:range,:vmid_list], :hostid,
|
420
|
+
command :deploy, deploy_desc, [:range,:vmid_list], :hostid, [:datastoreid,nil],
|
417
421
|
:options=>[ENFORCE] do
|
418
422
|
host_id = args[1]
|
419
423
|
verbose = "deploying in host #{host_id}"
|
420
424
|
|
425
|
+
enforce = options[:enforce].nil? ? false : options[:enforce]
|
426
|
+
ds_id = args[2].nil? ? -1 : args[2]
|
427
|
+
|
421
428
|
helper.perform_actions(args[0],options,verbose) do |vm|
|
422
|
-
|
423
|
-
vm.deploy(host_id, options[:enforce])
|
424
|
-
else
|
425
|
-
vm.deploy(host_id)
|
426
|
-
end
|
429
|
+
vm.deploy(host_id, enforce, ds_id)
|
427
430
|
end
|
428
431
|
end
|
429
432
|
|
data/lib/one_helper.rb
CHANGED
@@ -186,6 +186,37 @@ EOT
|
|
186
186
|
:large => '--vnc',
|
187
187
|
:description => 'Add VNC server to the VM'
|
188
188
|
},
|
189
|
+
{
|
190
|
+
:name => 'vnc_password',
|
191
|
+
:large => '--vnc-password password',
|
192
|
+
:format => String,
|
193
|
+
:description => 'VNC password'
|
194
|
+
},
|
195
|
+
{
|
196
|
+
:name => 'vnc_listen',
|
197
|
+
:large => '--vnc-listen ip',
|
198
|
+
:format => String,
|
199
|
+
:description => 'VNC IP where to listen for connections. '<<
|
200
|
+
'By default is 0.0.0.0 (all interfaces).'
|
201
|
+
},
|
202
|
+
{
|
203
|
+
:name => 'spice',
|
204
|
+
:large => '--spice',
|
205
|
+
:description => 'Add spice server to the VM'
|
206
|
+
},
|
207
|
+
{
|
208
|
+
:name => 'spice_password',
|
209
|
+
:large => '--spice-password password',
|
210
|
+
:format => String,
|
211
|
+
:description => 'spice password'
|
212
|
+
},
|
213
|
+
{
|
214
|
+
:name => 'spice_listen',
|
215
|
+
:large => '--spice-listen ip',
|
216
|
+
:format => String,
|
217
|
+
:description => 'spice IP where to listen for connections. '<<
|
218
|
+
'By default is 0.0.0.0 (all interfaces).'
|
219
|
+
},
|
189
220
|
{
|
190
221
|
:name => 'ssh',
|
191
222
|
:large => '--ssh [file]',
|
@@ -217,6 +248,19 @@ EOT
|
|
217
248
|
:large => '--boot device',
|
218
249
|
:description => 'Select boot device (hd|fd|cdrom|network)',
|
219
250
|
:format => String
|
251
|
+
},
|
252
|
+
{
|
253
|
+
:name => 'files_ds',
|
254
|
+
:large => '--files_ds file1,file2',
|
255
|
+
:format => Array,
|
256
|
+
:description => 'Add files to the contextualization CD from the' <<
|
257
|
+
'files datastore'
|
258
|
+
},
|
259
|
+
{
|
260
|
+
:name => 'init',
|
261
|
+
:large => '--init script1,script2',
|
262
|
+
:format => Array,
|
263
|
+
:description => 'Script or scripts to start in context'
|
220
264
|
}
|
221
265
|
]
|
222
266
|
|
@@ -743,7 +787,8 @@ EOT
|
|
743
787
|
end
|
744
788
|
|
745
789
|
def self.create_context(options)
|
746
|
-
|
790
|
+
context_options = [:ssh, :net_context, :context, :init, :files_ds]
|
791
|
+
if !(options.keys & context_options).empty?
|
747
792
|
lines=[]
|
748
793
|
|
749
794
|
if options[:ssh]
|
@@ -761,11 +806,25 @@ EOT
|
|
761
806
|
end
|
762
807
|
|
763
808
|
if options[:net_context]
|
764
|
-
|
809
|
+
lines << "NETWORK = \"YES\""
|
765
810
|
end
|
766
811
|
|
767
812
|
lines+=options[:context] if options[:context]
|
768
813
|
|
814
|
+
if options[:files_ds]
|
815
|
+
text='FILES_DS="'
|
816
|
+
text << options[:files_ds].map do |file|
|
817
|
+
%Q<$FILE[IMAGE=\\"#{file}\\"]>
|
818
|
+
end.join(' ')
|
819
|
+
text << '"'
|
820
|
+
|
821
|
+
lines << text
|
822
|
+
end
|
823
|
+
|
824
|
+
if options[:init]
|
825
|
+
lines << %Q<INIT_SCRIPTS="#{options[:init].join(' ')}">
|
826
|
+
end
|
827
|
+
|
769
828
|
if !lines.empty?
|
770
829
|
"CONTEXT=[\n"<<lines.map{|l| " "<<l }.join(",\n")<<"\n]\n"
|
771
830
|
else
|
@@ -813,7 +872,21 @@ EOT
|
|
813
872
|
end
|
814
873
|
|
815
874
|
if options[:vnc]
|
816
|
-
|
875
|
+
vnc_listen=options[:vnc_listen] || "0.0.0.0"
|
876
|
+
template<<"GRAPHICS=[ TYPE=\"vnc\", LISTEN=\"#{vnc_listen}\""
|
877
|
+
if options[:vnc_password]
|
878
|
+
template << ", PASSWD=\"#{options[:vnc_password]}\""
|
879
|
+
end
|
880
|
+
template<<' ]'<<"\n"
|
881
|
+
end
|
882
|
+
|
883
|
+
if options[:spice]
|
884
|
+
spice_listen=options[:spice_listen] || "0.0.0.0"
|
885
|
+
template<<"GRAPHICS=[ TYPE=\"spice\", LISTEN=\"#{spice_listen}\""
|
886
|
+
if options[:spice_password]
|
887
|
+
template << ", PASSWD=\"#{options[:spice_password]}\""
|
888
|
+
end
|
889
|
+
template<<' ]'<<"\n"
|
817
890
|
end
|
818
891
|
|
819
892
|
context=create_context(options)
|
@@ -102,7 +102,6 @@ class OneClusterHelper < OpenNebulaHelper::OneHelper
|
|
102
102
|
CLIHelper.print_header(str_h1 % "CLUSTER #{cluster['ID']} INFORMATION")
|
103
103
|
puts str % ["ID", cluster.id.to_s]
|
104
104
|
puts str % ["NAME", cluster.name]
|
105
|
-
puts str % ["SYSTEM DS", cluster['SYSTEM_DS']]
|
106
105
|
puts
|
107
106
|
|
108
107
|
CLIHelper.print_header(str_h1 % "CLUSTER TEMPLATE", false)
|
@@ -49,7 +49,8 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
|
|
49
49
|
end
|
50
50
|
|
51
51
|
column :SIZE, "Datastore total size", :size =>10 do |d|
|
52
|
-
|
52
|
+
shared = d['TEMPLATE']['SHARED']
|
53
|
+
if shared != nil && shared.upcase == 'NO'
|
53
54
|
"-"
|
54
55
|
else
|
55
56
|
OpenNebulaHelper.unit_to_str(d['TOTAL_MB'].to_i, {}, 'M')
|
@@ -115,8 +116,6 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
|
|
115
116
|
str="%-15s: %-20s"
|
116
117
|
str_h1="%-80s"
|
117
118
|
|
118
|
-
system = datastore.type == 1
|
119
|
-
|
120
119
|
CLIHelper.print_header(str_h1 % "DATASTORE #{datastore['ID']} INFORMATION")
|
121
120
|
puts str % ["ID", datastore.id.to_s]
|
122
121
|
puts str % ["NAME", datastore.name]
|
@@ -132,9 +131,13 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
|
|
132
131
|
puts
|
133
132
|
|
134
133
|
CLIHelper.print_header(str_h1 % "DATASTORE CAPACITY", false)
|
135
|
-
|
136
|
-
|
137
|
-
|
134
|
+
|
135
|
+
shared = datastore['TEMPLATE/SHARED']
|
136
|
+
local = shared != nil && shared.upcase == 'NO'
|
137
|
+
|
138
|
+
puts str % ["TOTAL:", local ? '-' : OpenNebulaHelper.unit_to_str(datastore['TOTAL_MB'].to_i, {},'M')]
|
139
|
+
puts str % ["USED: ", local ? '-' : OpenNebulaHelper.unit_to_str(datastore['USED_MB'].to_i, {},'M')]
|
140
|
+
puts str % ["FREE:", local ? '-' : OpenNebulaHelper.unit_to_str(datastore['FREE_MB'].to_i, {},'M')]
|
138
141
|
puts
|
139
142
|
|
140
143
|
CLIHelper.print_header(str_h1 % "PERMISSIONS",false)
|
@@ -61,10 +61,15 @@ class OneGroupHelper < OpenNebulaHelper::OneHelper
|
|
61
61
|
end
|
62
62
|
|
63
63
|
column :USERS, "Number of Users in this group", :size=>5 do |d|
|
64
|
-
|
65
|
-
|
64
|
+
ids = d["USERS"]["ID"]
|
65
|
+
|
66
|
+
case ids
|
67
|
+
when String
|
68
|
+
"1"
|
69
|
+
when Array
|
70
|
+
ids.size
|
66
71
|
else
|
67
|
-
|
72
|
+
"0"
|
68
73
|
end
|
69
74
|
end
|
70
75
|
|
@@ -29,7 +29,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
|
29
29
|
def self.state_to_str(id)
|
30
30
|
id = id.to_i
|
31
31
|
state_str = Host::HOST_STATES[id]
|
32
|
-
|
32
|
+
|
33
33
|
return Host::SHORT_HOST_STATES[state_str]
|
34
34
|
end
|
35
35
|
|
@@ -114,7 +114,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
|
114
114
|
"#{cpu_usage} / #{max_cpu} (#{ratio}%)"
|
115
115
|
else
|
116
116
|
"#{cpu_usage} / -"
|
117
|
-
end
|
117
|
+
end
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
@@ -156,6 +156,84 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
|
156
156
|
table
|
157
157
|
end
|
158
158
|
|
159
|
+
|
160
|
+
NUM_THREADS = 15
|
161
|
+
def sync(host_ids, options)
|
162
|
+
cluster_id = options[:cluster]
|
163
|
+
|
164
|
+
# Get remote_dir (implies oneadmin group)
|
165
|
+
rc = OpenNebula::System.new(@client).get_configuration
|
166
|
+
return -1, rc.message if OpenNebula.is_error?(rc)
|
167
|
+
|
168
|
+
conf = rc
|
169
|
+
remote_dir = conf['SCRIPTS_REMOTE_DIR']
|
170
|
+
|
171
|
+
# Verify the existence of REMOTES_LOCATION
|
172
|
+
if !File.directory? REMOTES_LOCATION
|
173
|
+
error_msg = "'#{REMOTES_LOCATION}' does not exist. " <<
|
174
|
+
"This command must be run in the frontend."
|
175
|
+
return -1,error_msg
|
176
|
+
end
|
177
|
+
|
178
|
+
# Touch the update file
|
179
|
+
FileUtils.touch(File.join(REMOTES_LOCATION,'.update'))
|
180
|
+
|
181
|
+
# Get the Host pool
|
182
|
+
filter_flag ||= OpenNebula::Pool::INFO_ALL
|
183
|
+
|
184
|
+
pool = factory_pool(filter_flag)
|
185
|
+
|
186
|
+
rc = pool.info
|
187
|
+
return -1, rc.message if OpenNebula.is_error?(rc)
|
188
|
+
|
189
|
+
# Assign hosts to threads
|
190
|
+
i = 0
|
191
|
+
hs_threads = Array.new
|
192
|
+
|
193
|
+
pool.each do |host|
|
194
|
+
if host_ids
|
195
|
+
next if !host_ids.include?(host['ID'].to_i)
|
196
|
+
elsif cluster_id
|
197
|
+
next if host['CLUSTER_ID'].to_i != cluster_id
|
198
|
+
end
|
199
|
+
|
200
|
+
hs_threads[i % NUM_THREADS] ||= []
|
201
|
+
hs_threads[i % NUM_THREADS] << host['NAME']
|
202
|
+
i+=1
|
203
|
+
end
|
204
|
+
|
205
|
+
# Run the jobs in threads
|
206
|
+
host_errors = Array.new
|
207
|
+
lock = Mutex.new
|
208
|
+
|
209
|
+
ts = hs_threads.map do |t|
|
210
|
+
Thread.new {
|
211
|
+
t.each do |host|
|
212
|
+
sync_cmd = "scp -rp #{REMOTES_LOCATION}/. #{host}:#{remote_dir} 2> /dev/null"
|
213
|
+
`#{sync_cmd} 2>/dev/null`
|
214
|
+
|
215
|
+
if !$?.success?
|
216
|
+
lock.synchronize {
|
217
|
+
host_errors << host
|
218
|
+
}
|
219
|
+
end
|
220
|
+
end
|
221
|
+
}
|
222
|
+
end
|
223
|
+
|
224
|
+
# Wait for threads to finish
|
225
|
+
ts.each{|t| t.join}
|
226
|
+
|
227
|
+
if host_errors.empty?
|
228
|
+
puts "All hosts updated successfully."
|
229
|
+
0
|
230
|
+
else
|
231
|
+
STDERR.puts "Failed to update the following hosts:"
|
232
|
+
host_errors.each{|h| STDERR.puts "* #{h}"}
|
233
|
+
-1
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
159
237
|
private
|
160
238
|
|
161
239
|
def factory(id=nil)
|
@@ -200,6 +278,22 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
|
200
278
|
puts str % ["RUNNING VMS", host['HOST_SHARE/RUNNING_VMS']]
|
201
279
|
puts
|
202
280
|
|
281
|
+
datastores = host.to_hash['HOST']['HOST_SHARE']['DATASTORES']['DS']
|
282
|
+
|
283
|
+
if datastores.nil?
|
284
|
+
datastores = []
|
285
|
+
else
|
286
|
+
datastores = [datastores].flatten
|
287
|
+
end
|
288
|
+
|
289
|
+
datastores.each do |datastore|
|
290
|
+
CLIHelper.print_header(str_h1 % "LOCAL SYSTEM DATASTORE ##{datastore['ID']} CAPACITY", false)
|
291
|
+
puts str % ["TOTAL:", OpenNebulaHelper.unit_to_str(datastore['TOTAL_MB'].to_i, {},'M')]
|
292
|
+
puts str % ["USED: ", OpenNebulaHelper.unit_to_str(datastore['USED_MB'].to_i, {},'M')]
|
293
|
+
puts str % ["FREE:", OpenNebulaHelper.unit_to_str(datastore['FREE_MB'].to_i, {},'M')]
|
294
|
+
puts
|
295
|
+
end
|
296
|
+
|
203
297
|
CLIHelper.print_header(str_h1 % "MONITORING INFORMATION", false)
|
204
298
|
|
205
299
|
puts host.template_str
|
@@ -31,9 +31,10 @@ class OneQuotaHelper
|
|
31
31
|
# ]
|
32
32
|
#
|
33
33
|
# VM = [
|
34
|
-
# VMS
|
35
|
-
# MEMORY
|
36
|
-
# CPU
|
34
|
+
# VMS = <Max. number of VMs>
|
35
|
+
# MEMORY = <Max. allocated memory (MB)>
|
36
|
+
# CPU = <Max. allocated CPU>
|
37
|
+
# VOLATILE_SIZE = <Max. allocated volatile disks (MB)>
|
37
38
|
# ]
|
38
39
|
#
|
39
40
|
# NETWORK = [
|
@@ -180,14 +181,14 @@ class OneQuotaHelper
|
|
180
181
|
|
181
182
|
if !vm_quotas[0].nil?
|
182
183
|
CLIHelper::ShowTable.new(nil, self) do
|
183
|
-
column :"NUMBER OF VMS", "", :right, :size=>
|
184
|
+
column :"NUMBER OF VMS", "", :right, :size=>17 do |d|
|
184
185
|
if !d.nil?
|
185
186
|
elem = 'VMS'
|
186
187
|
limit = d[elem]
|
187
188
|
limit = helper.get_default_limit(
|
188
189
|
limit, "VM_QUOTA/VM/#{elem}")
|
189
190
|
|
190
|
-
"%
|
191
|
+
"%7d / %7d" % [d["VMS_USED"], limit]
|
191
192
|
end
|
192
193
|
end
|
193
194
|
|
@@ -215,6 +216,20 @@ class OneQuotaHelper
|
|
215
216
|
"%8.2f / %8.2f" % [d["CPU_USED"], limit]
|
216
217
|
end
|
217
218
|
end
|
219
|
+
|
220
|
+
column :"VOLATILE_SIZE", "", :right, :size=>20 do |d|
|
221
|
+
if !d.nil?
|
222
|
+
elem = 'VOLATILE_SIZE'
|
223
|
+
limit = d[elem]
|
224
|
+
limit = helper.get_default_limit(
|
225
|
+
limit, "VM_QUOTA/VM/#{elem}")
|
226
|
+
|
227
|
+
"%8s / %8s" % [
|
228
|
+
OpenNebulaHelper.unit_to_str(d["VOLATILE_SIZE_USED"].to_i,{},"M"),
|
229
|
+
OpenNebulaHelper.unit_to_str(limit.to_i,{},"M")
|
230
|
+
]
|
231
|
+
end
|
232
|
+
end
|
218
233
|
end.show(vm_quotas, {})
|
219
234
|
|
220
235
|
puts
|
@@ -245,13 +245,15 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
|
|
245
245
|
def format_resource(user, options = {})
|
246
246
|
system = System.new(@client)
|
247
247
|
|
248
|
-
str="%-
|
248
|
+
str="%-16s: %-20s"
|
249
249
|
str_h1="%-80s"
|
250
250
|
|
251
251
|
CLIHelper.print_header(str_h1 % "USER #{user['ID']} INFORMATION")
|
252
252
|
puts str % ["ID", user.id.to_s]
|
253
253
|
puts str % ["NAME", user.name]
|
254
254
|
puts str % ["GROUP", user['GNAME']]
|
255
|
+
groups = user.retrieve_elements("GROUPS/ID")
|
256
|
+
puts str % ["SECONDARY GROUPS", groups.join(',') ] if groups.size > 1
|
255
257
|
puts str % ["PASSWORD", user['PASSWORD']]
|
256
258
|
puts str % ["AUTH_DRIVER", user['AUTH_DRIVER']]
|
257
259
|
|
@@ -248,6 +248,9 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
248
248
|
puts str % ["HOST",
|
249
249
|
vm['/VM/HISTORY_RECORDS/HISTORY[last()]/HOSTNAME']] if
|
250
250
|
%w{ACTIVE SUSPENDED POWEROFF}.include? vm.state_str
|
251
|
+
puts str % ["CLUSTER ID",
|
252
|
+
vm['/VM/HISTORY_RECORDS/HISTORY[last()]/CID'] ] if
|
253
|
+
%w{ACTIVE SUSPENDED POWEROFF}.include? vm.state_str
|
251
254
|
puts str % ["START TIME",
|
252
255
|
OpenNebulaHelper.time_to_str(vm['/VM/STIME'])]
|
253
256
|
puts str % ["END TIME",
|
@@ -547,6 +550,10 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
547
550
|
VirtualMachine.get_reason d["REASON"]
|
548
551
|
end
|
549
552
|
|
553
|
+
column :DS, "System Datastore", :size=>4 do |d|
|
554
|
+
d["DS_ID"]
|
555
|
+
end
|
556
|
+
|
550
557
|
column :START, "Time when the state changed", :size=>15 do |d|
|
551
558
|
OpenNebulaHelper.time_to_str(d['STIME'])
|
552
559
|
end
|
@@ -569,7 +576,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
569
576
|
OpenNebulaHelper.short_period_to_str(dtime)
|
570
577
|
end
|
571
578
|
|
572
|
-
default :SEQ, :HOST, :ACTION, :
|
579
|
+
default :SEQ, :HOST, :ACTION, :DS, :START, :TIME, :PROLOG
|
573
580
|
end
|
574
581
|
|
575
582
|
vm_hash=vm.to_hash
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opennebula-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
5
|
-
prerelease:
|
4
|
+
version: 4.3.80.beta
|
5
|
+
prerelease: 7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- OpenNebula
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07
|
12
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: opennebula
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 4.
|
21
|
+
version: 4.3.80.beta
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 4.
|
29
|
+
version: 4.3.80.beta
|
30
30
|
description: Commands used to talk to OpenNebula
|
31
31
|
email: contact@opennebula.org
|
32
32
|
executables:
|
@@ -91,9 +91,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
92
|
none: false
|
93
93
|
requirements:
|
94
|
-
- - ! '
|
94
|
+
- - ! '>'
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.3.1
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
99
|
rubygems_version: 1.8.25
|