opennebula-cli 6.0.0.2 → 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.rb +2 -2
- 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/share/schemas/xsd/opennebula_configuration.xsd +0 -1
- data/share/schemas/xsd/vnet.xsd +0 -2
- metadata +6 -6
data/bin/onevmgroup
CHANGED
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -242,9 +231,9 @@ CommandParser::CmdParser.new(ARGV) do
|
|
242
231
|
[Admin]: locks only Admin actions.
|
243
232
|
EOT
|
244
233
|
|
245
|
-
command :lock, lock_desc,
|
234
|
+
command :lock, lock_desc, :vmgroupid,
|
246
235
|
:options => [USE, MANAGE, ADMIN, ALL] do
|
247
|
-
helper.
|
236
|
+
helper.perform_action(args[0], options, 'VMGroup locked') do |vmg|
|
248
237
|
if !options[:use].nil?
|
249
238
|
level = 1
|
250
239
|
elsif !options[:manage].nil?
|
@@ -265,8 +254,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
265
254
|
Valid states are: All.
|
266
255
|
EOT
|
267
256
|
|
268
|
-
command :unlock, unlock_desc,
|
269
|
-
helper.
|
257
|
+
command :unlock, unlock_desc, :vmgroupid do
|
258
|
+
helper.perform_action(args[0], options, 'VMGroup unlocked') do |vmg|
|
270
259
|
vmg.unlock
|
271
260
|
end
|
272
261
|
end
|
data/bin/onevnet
CHANGED
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -390,9 +379,9 @@ CommandParser::CmdParser.new(ARGV) do
|
|
390
379
|
[Admin]: locks only Admin actions.
|
391
380
|
EOT
|
392
381
|
|
393
|
-
command :lock, lock_desc,
|
382
|
+
command :lock, lock_desc, :vnetid,
|
394
383
|
:options => [USE, MANAGE, ADMIN, ALL] do
|
395
|
-
helper.
|
384
|
+
helper.perform_action(args[0], options, 'VNet locked') do |vnet|
|
396
385
|
if !options[:use].nil?
|
397
386
|
level = 1
|
398
387
|
elsif !options[:manage].nil?
|
@@ -413,8 +402,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
413
402
|
Valid states are: All.
|
414
403
|
EOT
|
415
404
|
|
416
|
-
command :unlock, unlock_desc,
|
417
|
-
helper.
|
405
|
+
command :unlock, unlock_desc, :vnetid do
|
406
|
+
helper.perform_action(args[0], options, 'VNet unlocked') do |vnet|
|
418
407
|
vnet.unlock
|
419
408
|
end
|
420
409
|
end
|
data/bin/onevntemplate
CHANGED
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -350,9 +339,9 @@ CommandParser::CmdParser.new(ARGV) do
|
|
350
339
|
[Admin]: locks only Admin actions.
|
351
340
|
EOT
|
352
341
|
|
353
|
-
command :lock, lock_desc,
|
342
|
+
command :lock, lock_desc, :templateid,
|
354
343
|
:options => [USE, MANAGE, ADMIN, ALL] do
|
355
|
-
helper.
|
344
|
+
helper.perform_action(args[0], options, 'VN Template locked') do |t|
|
356
345
|
if !options[:use].nil?
|
357
346
|
level = 1
|
358
347
|
elsif !options[:manage].nil?
|
@@ -373,8 +362,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
373
362
|
Valid states are: All.
|
374
363
|
EOT
|
375
364
|
|
376
|
-
command :unlock, unlock_desc,
|
377
|
-
helper.
|
365
|
+
command :unlock, unlock_desc, :templateid do
|
366
|
+
helper.perform_action(args[0], options, 'VN Template unlocked') do |t|
|
378
367
|
t.unlock
|
379
368
|
end
|
380
369
|
end
|
data/bin/onevrouter
CHANGED
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -375,9 +364,9 @@ CommandParser::CmdParser.new(ARGV) do
|
|
375
364
|
[Admin]: locks only Admin actions.
|
376
365
|
EOT
|
377
366
|
|
378
|
-
command :lock, lock_desc,
|
367
|
+
command :lock, lock_desc, :vrouterid,
|
379
368
|
:options => [USE, MANAGE, ADMIN, ALL] do
|
380
|
-
helper.
|
369
|
+
helper.perform_action(args[0], options, 'VRouter locked') do |vr|
|
381
370
|
if !options[:use].nil?
|
382
371
|
level = 1
|
383
372
|
elsif !options[:manage].nil?
|
@@ -398,8 +387,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
398
387
|
valid states are: All.
|
399
388
|
EOT
|
400
389
|
|
401
|
-
command :unlock, unlock_desc,
|
402
|
-
helper.
|
390
|
+
command :unlock, unlock_desc, :vrouterid do
|
391
|
+
helper.perform_action(args[0], options, 'VRouter unlocked') do |vr|
|
403
392
|
vr.unlock
|
404
393
|
end
|
405
394
|
end
|
data/bin/onezone
CHANGED
@@ -26,25 +26,14 @@ else
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
27
|
end
|
28
28
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
-
|
35
|
-
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
37
|
-
begin
|
38
|
-
verb = $VERBOSE
|
39
|
-
$VERBOSE = nil
|
40
|
-
require 'rubygems'
|
41
|
-
Gem.use_paths(real_gems_path)
|
42
|
-
ensure
|
43
|
-
$VERBOSE = verb
|
44
|
-
end
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
45
35
|
end
|
46
36
|
end
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
48
37
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
@@ -265,7 +254,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
265
254
|
end
|
266
255
|
|
267
256
|
server = Replicator.new('/var/lib/one/.ssh/id_rsa', args[0])
|
268
|
-
server.process_files(options
|
257
|
+
server.process_files(options.key?(:database))
|
269
258
|
|
270
259
|
0
|
271
260
|
end
|
data/lib/one_helper.rb
CHANGED
@@ -710,8 +710,8 @@ EOT
|
|
710
710
|
elements, hash = print_page(pool, options)
|
711
711
|
|
712
712
|
if options[:ids] && elements
|
713
|
-
|
714
|
-
|
713
|
+
arr = [hash[pool.pool_name][pool.element_name]].flatten
|
714
|
+
arr.reject! do |element|
|
715
715
|
!options[:ids].include?(element['ID'].to_i)
|
716
716
|
end
|
717
717
|
end
|
@@ -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')
|