opennebula-cli 6.0.1 → 6.1.90.pre

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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/bin/oneacct +13 -2
  3. data/bin/oneacl +13 -2
  4. data/bin/onecluster +13 -2
  5. data/bin/onedatastore +13 -2
  6. data/bin/oneflow +115 -11
  7. data/bin/oneflow-template +17 -7
  8. data/bin/onegroup +13 -2
  9. data/bin/onehook +17 -6
  10. data/bin/onehost +13 -2
  11. data/bin/oneimage +19 -8
  12. data/bin/onemarket +33 -2
  13. data/bin/onemarketapp +21 -10
  14. data/bin/onesecgroup +13 -2
  15. data/bin/oneshowback +13 -2
  16. data/bin/onetemplate +28 -8
  17. data/bin/oneuser +13 -2
  18. data/bin/onevcenter +29 -9
  19. data/bin/onevdc +13 -2
  20. data/bin/onevm +141 -36
  21. data/bin/onevmgroup +17 -6
  22. data/bin/onevnet +17 -6
  23. data/bin/onevntemplate +17 -6
  24. data/bin/onevrouter +17 -6
  25. data/bin/onezone +34 -3
  26. data/lib/one_helper/oneacct_helper.rb +5 -1
  27. data/lib/one_helper/onecluster_helper.rb +75 -42
  28. data/lib/one_helper/onemarket_helper.rb +12 -1
  29. data/lib/one_helper/onevcenter_helper.rb +2 -2
  30. data/lib/one_helper/onevm_helper.rb +118 -36
  31. data/lib/one_helper/onevnet_helper.rb +173 -151
  32. data/lib/one_helper/onezone_helper.rb +25 -5
  33. data/lib/one_helper.rb +119 -131
  34. data/share/schemas/xsd/api_info.xsd +2 -2
  35. data/share/schemas/xsd/hook_message_api.xsd +1 -1
  36. data/share/schemas/xsd/hook_message_state.xsd +1 -1
  37. data/share/schemas/xsd/host.xsd +21 -1
  38. data/share/schemas/xsd/marketplace.xsd +1 -0
  39. data/share/schemas/xsd/monitoring_data.xsd +23 -11
  40. data/share/schemas/xsd/opennebula_configuration.xsd +1 -0
  41. data/share/schemas/xsd/showback.xsd +1 -0
  42. data/share/schemas/xsd/vm.xsd +64 -10
  43. data/share/schemas/xsd/vm_pool.xsd +3 -26
  44. data/share/schemas/xsd/vnet.xsd +6 -1
  45. data/share/schemas/xsd/zone.xsd +1 -0
  46. data/share/schemas/xsd/zone_pool.xsd +2 -1
  47. metadata +6 -6
data/bin/oneshowback CHANGED
@@ -26,14 +26,25 @@ else
26
26
  GEMS_LOCATION = ONE_LOCATION + '/share/gems'
27
27
  end
28
28
 
29
+ # %%RUBYGEMS_SETUP_BEGIN%%
29
30
  if File.directory?(GEMS_LOCATION)
30
31
  real_gems_path = File.realpath(GEMS_LOCATION)
31
32
  if !defined?(Gem) || Gem.path != [real_gems_path]
32
33
  $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
33
- require 'rubygems'
34
- Gem.use_paths(real_gems_path)
34
+
35
+ # Suppress warnings from Rubygems
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
35
45
  end
36
46
  end
47
+ # %%RUBYGEMS_SETUP_END%%
37
48
 
38
49
  $LOAD_PATH << RUBY_LIB_LOCATION
39
50
  $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
data/bin/onetemplate CHANGED
@@ -26,14 +26,25 @@ else
26
26
  GEMS_LOCATION = ONE_LOCATION + '/share/gems'
27
27
  end
28
28
 
29
+ # %%RUBYGEMS_SETUP_BEGIN%%
29
30
  if File.directory?(GEMS_LOCATION)
30
31
  real_gems_path = File.realpath(GEMS_LOCATION)
31
32
  if !defined?(Gem) || Gem.path != [real_gems_path]
32
33
  $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
33
- require 'rubygems'
34
- Gem.use_paths(real_gems_path)
34
+
35
+ # Suppress warnings from Rubygems
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
35
45
  end
36
46
  end
47
+ # %%RUBYGEMS_SETUP_END%%
37
48
 
38
49
  $LOAD_PATH << RUBY_LIB_LOCATION
39
50
  $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
@@ -214,8 +225,17 @@ CommandParser::CmdParser.new(ARGV) do
214
225
  Creates a new VM instance from the given Template. This VM can be
215
226
  managed with the 'onevm' command.
216
227
 
217
- The source Template can be modified adding or replacing attributes with
218
- the optional file argument, or with the options.
228
+ The source Template can be modified by replacing existing attributes; or
229
+ adding new DISK or NIC elements. The new attributes can be specified with the
230
+ command options or the file argument.
231
+
232
+ Example:
233
+
234
+ - Instantiate a template and add a new NIC
235
+ onetemplate instantiate 23 --nic private_net
236
+
237
+ - Instantiate a template and replace CONTEXT with a new one
238
+ onetemplate instantiate 23 --startscript /path/to/my/start_script
219
239
  EOT
220
240
 
221
241
  command :instantiate, instantiate_desc, :templateid, [:file, nil],
@@ -395,9 +415,9 @@ CommandParser::CmdParser.new(ARGV) do
395
415
  [Admin]: locks only Admin actions.
396
416
  EOT
397
417
 
398
- command :lock, lock_desc, :templateid,
418
+ command :lock, lock_desc, [:range, :templateid_list],
399
419
  :options => [USE, MANAGE, ADMIN, ALL] do
400
- helper.perform_action(args[0], options, 'Template locked') do |t|
420
+ helper.perform_actions(args[0], options, 'Template locked') do |t|
401
421
  if !options[:use].nil?
402
422
  level = 1
403
423
  elsif !options[:manage].nil?
@@ -418,8 +438,8 @@ CommandParser::CmdParser.new(ARGV) do
418
438
  Valid states are: All.
419
439
  EOT
420
440
 
421
- command :unlock, unlock_desc, :templateid do
422
- helper.perform_action(args[0], options, 'Template unlocked') do |t|
441
+ command :unlock, unlock_desc, [:range, :templateid_list] do
442
+ helper.perform_actions(args[0], options, 'Template unlocked') do |t|
423
443
  t.unlock
424
444
  end
425
445
  end
data/bin/oneuser CHANGED
@@ -26,14 +26,25 @@ else
26
26
  GEMS_LOCATION = ONE_LOCATION + '/share/gems'
27
27
  end
28
28
 
29
+ # %%RUBYGEMS_SETUP_BEGIN%%
29
30
  if File.directory?(GEMS_LOCATION)
30
31
  real_gems_path = File.realpath(GEMS_LOCATION)
31
32
  if !defined?(Gem) || Gem.path != [real_gems_path]
32
33
  $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
33
- require 'rubygems'
34
- Gem.use_paths(real_gems_path)
34
+
35
+ # Suppress warnings from Rubygems
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
35
45
  end
36
46
  end
47
+ # %%RUBYGEMS_SETUP_END%%
37
48
 
38
49
  $LOAD_PATH << RUBY_LIB_LOCATION
39
50
  $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
data/bin/onevcenter CHANGED
@@ -28,14 +28,25 @@ else
28
28
  REMOTES_LOCATION = ONE_LOCATION + '/var/remotes/'
29
29
  end
30
30
 
31
+ # %%RUBYGEMS_SETUP_BEGIN%%
31
32
  if File.directory?(GEMS_LOCATION)
32
33
  real_gems_path = File.realpath(GEMS_LOCATION)
33
34
  if !defined?(Gem) || Gem.path != [real_gems_path]
34
35
  $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
35
- require 'rubygems'
36
- Gem.use_paths(real_gems_path)
36
+
37
+ # Suppress warnings from Rubygems
38
+ # https://github.com/OpenNebula/one/issues/5379
39
+ begin
40
+ verb = $VERBOSE
41
+ $VERBOSE = nil
42
+ require 'rubygems'
43
+ Gem.use_paths(real_gems_path)
44
+ ensure
45
+ $VERBOSE = verb
46
+ end
37
47
  end
38
48
  end
49
+ # %%RUBYGEMS_SETUP_END%%
39
50
 
40
51
  $LOAD_PATH << RUBY_LIB_LOCATION
41
52
  $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
@@ -154,7 +165,8 @@ CommandParser::CmdParser.new(ARGV) do
154
165
 
155
166
  command :list,
156
167
  list_desc,
157
- :options => [OBJECT, HOST, DATASTORE, VCENTER, USER, PASS] do
168
+ :options => [OBJECT, HOST, DATASTORE, VCENTER, USER, PASS,
169
+ CLIHelper::CSV_OPT] do
158
170
  begin
159
171
  args = helper.parse_opts(options)
160
172
  args[:filter] = true
@@ -167,7 +179,8 @@ CommandParser::CmdParser.new(ARGV) do
167
179
 
168
180
  helper.list_object(options, list)
169
181
  rescue StandardError => e
170
- puts e.message
182
+ STDERR.puts e.message
183
+ exit 1
171
184
  end
172
185
 
173
186
  exit 0
@@ -198,7 +211,8 @@ CommandParser::CmdParser.new(ARGV) do
198
211
 
199
212
  helper.list_object(options, list)
200
213
  rescue StandardError => e
201
- puts e.message
214
+ STDERR.puts e.message
215
+ exit 1
202
216
  end
203
217
 
204
218
  exit 0
@@ -245,7 +259,8 @@ CommandParser::CmdParser.new(ARGV) do
245
259
 
246
260
  importer.stdout
247
261
  rescue StandardError => e
248
- puts e.message
262
+ STDERR.puts e.message
263
+ exit 1
249
264
  end
250
265
 
251
266
  exit 0
@@ -261,7 +276,7 @@ CommandParser::CmdParser.new(ARGV) do
261
276
  vi_client,
262
277
  options[:object])
263
278
 
264
- if options[:object] == "networks" && !args.first.nil?
279
+ if options[:object] == 'networks' && !args.first.nil?
265
280
  indexes = args.first
266
281
  else
267
282
  importer.retrieve_resources(helper.parse_opts(options))
@@ -272,7 +287,8 @@ CommandParser::CmdParser.new(ARGV) do
272
287
 
273
288
  importer.stdout
274
289
  rescue StandardError => e
275
- puts e.message
290
+ STDERR.puts e.message
291
+ exit 1
276
292
  end
277
293
 
278
294
  exit 0
@@ -294,7 +310,11 @@ CommandParser::CmdParser.new(ARGV) do
294
310
  :options => [VCENTER, USER, PASS, USE_DEFAULTS, PORT] do
295
311
  con_ops = helper.connection_options('Hosts', options)
296
312
 
297
- VCenterDriver::VcImporter.import_clusters(con_ops, options)
313
+ begin
314
+ VCenterDriver::VcImporter.import_clusters(con_ops, options)
315
+ rescue StandardError
316
+ exit 1
317
+ end
298
318
 
299
319
  exit 0
300
320
  end
data/bin/onevdc CHANGED
@@ -26,14 +26,25 @@ else
26
26
  GEMS_LOCATION = ONE_LOCATION + '/share/gems'
27
27
  end
28
28
 
29
+ # %%RUBYGEMS_SETUP_BEGIN%%
29
30
  if File.directory?(GEMS_LOCATION)
30
31
  real_gems_path = File.realpath(GEMS_LOCATION)
31
32
  if !defined?(Gem) || Gem.path != [real_gems_path]
32
33
  $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
33
- require 'rubygems'
34
- Gem.use_paths(real_gems_path)
34
+
35
+ # Suppress warnings from Rubygems
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
35
45
  end
36
46
  end
47
+ # %%RUBYGEMS_SETUP_END%%
37
48
 
38
49
  $LOAD_PATH << RUBY_LIB_LOCATION
39
50
  $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
data/bin/onevm CHANGED
@@ -26,14 +26,25 @@ else
26
26
  GEMS_LOCATION = ONE_LOCATION + '/share/gems'
27
27
  end
28
28
 
29
+ # %%RUBYGEMS_SETUP_BEGIN%%
29
30
  if File.directory?(GEMS_LOCATION)
30
31
  real_gems_path = File.realpath(GEMS_LOCATION)
31
32
  if !defined?(Gem) || Gem.path != [real_gems_path]
32
33
  $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
33
- require 'rubygems'
34
- Gem.use_paths(real_gems_path)
34
+
35
+ # Suppress warnings from Rubygems
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
35
45
  end
36
46
  end
47
+ # %%RUBYGEMS_SETUP_END%%
37
48
 
38
49
  $LOAD_PATH << RUBY_LIB_LOCATION
39
50
  $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
@@ -207,6 +218,27 @@ CommandParser::CmdParser.new(ARGV) do
207
218
  :description => 'Market to save oneshot'
208
219
  }
209
220
 
221
+ NIC_ID = {
222
+ :name => 'nic_id',
223
+ :large => '--nic-id nic_id',
224
+ :format => String,
225
+ :description => 'NIC to use when SSH'
226
+ }
227
+
228
+ CMD = {
229
+ :name => 'cmd',
230
+ :large => '--cmd cmd',
231
+ :format => String,
232
+ :description => 'CMD to run when SSH'
233
+ }
234
+
235
+ SSH_OPTS = {
236
+ :name => 'ssh_opts',
237
+ :large => '--ssh-options options',
238
+ :format => String,
239
+ :description => 'SSH options to use'
240
+ }
241
+
210
242
  ########################################################################
211
243
  # Global Options
212
244
  ########################################################################
@@ -1273,7 +1305,8 @@ CommandParser::CmdParser.new(ARGV) do
1273
1305
  CONTEXT (any value, **variable substitution will be made**)
1274
1306
  EOT
1275
1307
 
1276
- command :updateconf, updateconf_desc, :vmid, [:file, nil] do
1308
+ command :updateconf, updateconf_desc, :vmid, [:file, nil],
1309
+ :options => OpenNebulaHelper::APPEND do
1277
1310
  template = ''
1278
1311
 
1279
1312
  begin
@@ -1300,7 +1333,7 @@ CommandParser::CmdParser.new(ARGV) do
1300
1333
  template = OpenNebulaHelper.editor_input(template)
1301
1334
  end
1302
1335
 
1303
- vm.updateconf(template)
1336
+ vm.updateconf(template, options[:append])
1304
1337
  end
1305
1338
  end
1306
1339
 
@@ -1310,9 +1343,9 @@ CommandParser::CmdParser.new(ARGV) do
1310
1343
  Valid states are: All.
1311
1344
  EOT
1312
1345
 
1313
- command :lock, lock_desc, :vmid,
1346
+ command :lock, lock_desc, [:range, :vmid_list],
1314
1347
  :options => [USE, MANAGE, ADMIN, ALL] do
1315
- helper.perform_action(args[0], options, 'VM locked') do |vm|
1348
+ helper.perform_actions(args[0], options, 'VM locked') do |vm|
1316
1349
  if !options[:use].nil?
1317
1350
  level = 1
1318
1351
  elsif !options[:manage].nil?
@@ -1333,8 +1366,8 @@ CommandParser::CmdParser.new(ARGV) do
1333
1366
  Valid states are: All.
1334
1367
  EOT
1335
1368
 
1336
- command :unlock, unlock_desc, :vmid do
1337
- helper.perform_action(args[0], options, 'VM unlocked') do |vm|
1369
+ command :unlock, unlock_desc, [:range, :vmid_list] do
1370
+ helper.perform_actions(args[0], options, 'VM unlocked') do |vm|
1338
1371
  vm.unlock
1339
1372
  end
1340
1373
  end
@@ -1347,7 +1380,7 @@ CommandParser::CmdParser.new(ARGV) do
1347
1380
  You can configure the actions in /etc/one/cli/onevm.yaml
1348
1381
  EOT
1349
1382
 
1350
- command :'create-chart', create_chart_desc, [:range, :vmid_list] do
1383
+ command :'create-chart', create_chart_desc, :vmid do
1351
1384
  charters = helper.get_charters
1352
1385
 
1353
1386
  if charters.nil?
@@ -1361,7 +1394,7 @@ CommandParser::CmdParser.new(ARGV) do
1361
1394
  charters.each do |action, time|
1362
1395
  sched = "+#{time[:time].to_i + acc_t}"
1363
1396
 
1364
- helper.schedule_actions(args[0],
1397
+ helper.schedule_actions([args[0]].flatten,
1365
1398
  { :schedule => sched },
1366
1399
  action.to_s,
1367
1400
  time[:warning][:time] + acc_w)
@@ -1379,22 +1412,7 @@ CommandParser::CmdParser.new(ARGV) do
1379
1412
 
1380
1413
  command :'delete-chart', delete_chart_desc, :vmid, :sched_id do
1381
1414
  helper.perform_action(args[0], {}, 'Charter deleted') do |vm|
1382
- rc = vm.info
1383
-
1384
- if OpenNebula.is_error?(rc)
1385
- STDERR.puts "Error #{rc.message}"
1386
- exit(-1)
1387
- end
1388
-
1389
- xpath = "USER_TEMPLATE/SCHED_ACTION[ID=#{args[1]}]"
1390
-
1391
- unless vm.retrieve_elements(xpath)
1392
- STDERR.puts "Sched action #{args[1]} not found"
1393
- exit(-1)
1394
- end
1395
-
1396
- vm.delete_element(xpath)
1397
- rc = vm.update(vm.user_template_str)
1415
+ rc = vm.sched_action_delete(args[1])
1398
1416
 
1399
1417
  if OpenNebula.is_error?(rc)
1400
1418
  STDERR.puts "Error deleting: #{rc.message}"
@@ -1437,25 +1455,33 @@ CommandParser::CmdParser.new(ARGV) do
1437
1455
  helper.perform_action(args[0], options, 'Backup') do |vm|
1438
1456
  vm.extend(OpenNebula::VirtualMachineExt)
1439
1457
 
1440
- # If logger is specified use it, if not use STDOUT
1441
- options[:logger].nil? ? log_to = STDOUT : log_to = options[:logger]
1442
-
1443
1458
  # Read user options
1444
- keep = options.key?(:keep)
1445
- logger = Logger.new(log_to)
1446
- format = '%Y-%m-%d %H:%M:%S'
1459
+ if options[:verbose]
1460
+ log_to = STDOUT
1461
+ elsif !options[:logger].nil?
1462
+ log_to = options[:logger]
1463
+ end
1447
1464
 
1448
- logger.formatter = proc do |severity, datetime, _p, msg|
1449
- "#{datetime.strftime(format)} #{severity.ljust(5)} : #{msg}\n"
1465
+ keep = options.key?(:keep)
1466
+
1467
+ if log_to
1468
+ logger = Logger.new(log_to)
1469
+ format = '%Y-%m-%d %H:%M:%S'
1470
+
1471
+ logger.formatter = proc do |severity, datetime, _p, msg|
1472
+ "#{datetime.strftime(format)} " \
1473
+ "#{severity.ljust(5)} : #{msg}\n"
1474
+ end
1450
1475
  end
1451
1476
 
1477
+ binfo = {}
1478
+ binfo[:market] = options[:market]
1479
+
1452
1480
  if options.key?(:oneshot)
1453
- binfo = {}
1454
1481
  binfo[:name] = "VM #{vm.id} BACKUP - " \
1455
1482
  "#{Time.now.strftime('%Y%m%d_%k%M')}"
1456
1483
  binfo[:freq] = 1
1457
1484
  binfo[:last] = Time.now.to_i - 100
1458
- binfo[:market] = options[:market]
1459
1485
  end
1460
1486
 
1461
1487
  begin
@@ -1518,6 +1544,85 @@ CommandParser::CmdParser.new(ARGV) do
1518
1544
  end
1519
1545
  end
1520
1546
 
1547
+ ssh_desc = <<-EOT.unindent
1548
+ SSH into VM
1549
+
1550
+ Options example:
1551
+
1552
+ '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
1553
+ EOT
1554
+
1555
+ command :ssh,
1556
+ ssh_desc,
1557
+ :vmid,
1558
+ [:login, nil],
1559
+ :options => [NIC_ID, CMD, SSH_OPTS] do
1560
+ helper.ssh(args, options)
1561
+ end
1562
+
1563
+ port_desc = <<-EOT.unindent
1564
+ Get port forwarding from a NIC, e.g:
1565
+
1566
+ 1.2.3.4@4000 -> 1, means that to connect to VM port 1, you need to
1567
+ connect to IP 1.2.3.4 in port 4000
1568
+ EOT
1569
+
1570
+ command :'port-forward',
1571
+ port_desc,
1572
+ :vmid,
1573
+ [:port, nil],
1574
+ :options => NIC_ID do
1575
+ helper.perform_action(args[0], options, 'Port Forward') do |vm|
1576
+ rc = vm.info
1577
+
1578
+ if OpenNebula.is_error?(rc)
1579
+ STDERR.puts rc.message
1580
+ exit(-1)
1581
+ end
1582
+
1583
+ if options[:nic_id]
1584
+ nic = vm.retrieve_xmlelements(
1585
+ "//TEMPLATE/NIC[NIC_ID=\"#{options[:nic_id]}\"]"
1586
+ )[0]
1587
+ else
1588
+ nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[SSH="YES"]')[0]
1589
+ end
1590
+
1591
+ nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[1]')[0] if nic.nil?
1592
+
1593
+ if nic.nil?
1594
+ STDERR.puts 'No NIC found'
1595
+ exit(-1)
1596
+ end
1597
+
1598
+ if nic['EXTERNAL_PORT_RANGE'].nil?
1599
+ STDERR.puts 'No PORT_RANGE found'
1600
+ exit(-1)
1601
+ end
1602
+
1603
+ ip = vm.to_hash['VM']['HISTORY_RECORDS']['HISTORY'][-1]['HOSTNAME']
1604
+
1605
+ e_range = nic['EXTERNAL_PORT_RANGE'].split(':')
1606
+ e_start_p = Integer(e_range[0])
1607
+ e_end_p = Integer(e_range[1])
1608
+
1609
+ i_range = nic['INTERNAL_PORT_RANGE'].split('-')
1610
+ i_start_p = Integer(i_range[0])
1611
+ i_end_p = Integer(i_range[1].split('/')[0])
1612
+
1613
+ if args[1].nil?
1614
+ start_r = Array(e_start_p..e_end_p)
1615
+ end_r = Array(i_start_p..i_end_p)
1616
+
1617
+ start_r.zip(end_r) do |p1, p2|
1618
+ puts "#{ip}@#{p1} -> #{p2}"
1619
+ end
1620
+ else
1621
+ puts "#{ip}@#{e_start_p + Integer(args[1]) - 1} -> #{args[1]}"
1622
+ end
1623
+ end
1624
+ end
1625
+
1521
1626
  # Deprecated commands
1522
1627
 
1523
1628
  deprecated_command(:shutdown, 'terminate')
data/bin/onevmgroup CHANGED
@@ -26,14 +26,25 @@ else
26
26
  GEMS_LOCATION = ONE_LOCATION + '/share/gems'
27
27
  end
28
28
 
29
+ # %%RUBYGEMS_SETUP_BEGIN%%
29
30
  if File.directory?(GEMS_LOCATION)
30
31
  real_gems_path = File.realpath(GEMS_LOCATION)
31
32
  if !defined?(Gem) || Gem.path != [real_gems_path]
32
33
  $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
33
- require 'rubygems'
34
- Gem.use_paths(real_gems_path)
34
+
35
+ # Suppress warnings from Rubygems
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
35
45
  end
36
46
  end
47
+ # %%RUBYGEMS_SETUP_END%%
37
48
 
38
49
  $LOAD_PATH << RUBY_LIB_LOCATION
39
50
  $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
@@ -231,9 +242,9 @@ CommandParser::CmdParser.new(ARGV) do
231
242
  [Admin]: locks only Admin actions.
232
243
  EOT
233
244
 
234
- command :lock, lock_desc, :vmgroupid,
245
+ command :lock, lock_desc, [:range, :vmgroupid_list],
235
246
  :options => [USE, MANAGE, ADMIN, ALL] do
236
- helper.perform_action(args[0], options, 'VMGroup locked') do |vmg|
247
+ helper.perform_actions(args[0], options, 'VMGroup locked') do |vmg|
237
248
  if !options[:use].nil?
238
249
  level = 1
239
250
  elsif !options[:manage].nil?
@@ -254,8 +265,8 @@ CommandParser::CmdParser.new(ARGV) do
254
265
  Valid states are: All.
255
266
  EOT
256
267
 
257
- command :unlock, unlock_desc, :vmgroupid do
258
- helper.perform_action(args[0], options, 'VMGroup unlocked') do |vmg|
268
+ command :unlock, unlock_desc, [:range, :vmgroupid_list] do
269
+ helper.perform_actions(args[0], options, 'VMGroup unlocked') do |vmg|
259
270
  vmg.unlock
260
271
  end
261
272
  end
data/bin/onevnet CHANGED
@@ -26,14 +26,25 @@ else
26
26
  GEMS_LOCATION = ONE_LOCATION + '/share/gems'
27
27
  end
28
28
 
29
+ # %%RUBYGEMS_SETUP_BEGIN%%
29
30
  if File.directory?(GEMS_LOCATION)
30
31
  real_gems_path = File.realpath(GEMS_LOCATION)
31
32
  if !defined?(Gem) || Gem.path != [real_gems_path]
32
33
  $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
33
- require 'rubygems'
34
- Gem.use_paths(real_gems_path)
34
+
35
+ # Suppress warnings from Rubygems
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
35
45
  end
36
46
  end
47
+ # %%RUBYGEMS_SETUP_END%%
37
48
 
38
49
  $LOAD_PATH << RUBY_LIB_LOCATION
39
50
  $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
@@ -379,9 +390,9 @@ CommandParser::CmdParser.new(ARGV) do
379
390
  [Admin]: locks only Admin actions.
380
391
  EOT
381
392
 
382
- command :lock, lock_desc, :vnetid,
393
+ command :lock, lock_desc, [:range, :vnetid_list],
383
394
  :options => [USE, MANAGE, ADMIN, ALL] do
384
- helper.perform_action(args[0], options, 'VNet locked') do |vnet|
395
+ helper.perform_actions(args[0], options, 'VNet locked') do |vnet|
385
396
  if !options[:use].nil?
386
397
  level = 1
387
398
  elsif !options[:manage].nil?
@@ -402,8 +413,8 @@ CommandParser::CmdParser.new(ARGV) do
402
413
  Valid states are: All.
403
414
  EOT
404
415
 
405
- command :unlock, unlock_desc, :vnetid do
406
- helper.perform_action(args[0], options, 'VNet unlocked') do |vnet|
416
+ command :unlock, unlock_desc, [:range, :vnetid_list] do
417
+ helper.perform_actions(args[0], options, 'VNet unlocked') do |vnet|
407
418
  vnet.unlock
408
419
  end
409
420
  end
data/bin/onevntemplate CHANGED
@@ -26,14 +26,25 @@ else
26
26
  GEMS_LOCATION = ONE_LOCATION + '/share/gems'
27
27
  end
28
28
 
29
+ # %%RUBYGEMS_SETUP_BEGIN%%
29
30
  if File.directory?(GEMS_LOCATION)
30
31
  real_gems_path = File.realpath(GEMS_LOCATION)
31
32
  if !defined?(Gem) || Gem.path != [real_gems_path]
32
33
  $LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
33
- require 'rubygems'
34
- Gem.use_paths(real_gems_path)
34
+
35
+ # Suppress warnings from Rubygems
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
35
45
  end
36
46
  end
47
+ # %%RUBYGEMS_SETUP_END%%
37
48
 
38
49
  $LOAD_PATH << RUBY_LIB_LOCATION
39
50
  $LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
@@ -339,9 +350,9 @@ CommandParser::CmdParser.new(ARGV) do
339
350
  [Admin]: locks only Admin actions.
340
351
  EOT
341
352
 
342
- command :lock, lock_desc, :templateid,
353
+ command :lock, lock_desc, [:range, :templateid_list],
343
354
  :options => [USE, MANAGE, ADMIN, ALL] do
344
- helper.perform_action(args[0], options, 'VN Template locked') do |t|
355
+ helper.perform_actions(args[0], options, 'VN Template locked') do |t|
345
356
  if !options[:use].nil?
346
357
  level = 1
347
358
  elsif !options[:manage].nil?
@@ -362,8 +373,8 @@ CommandParser::CmdParser.new(ARGV) do
362
373
  Valid states are: All.
363
374
  EOT
364
375
 
365
- command :unlock, unlock_desc, :templateid do
366
- helper.perform_action(args[0], options, 'VN Template unlocked') do |t|
376
+ command :unlock, unlock_desc, [:range, :templateid_list] do
377
+ helper.perform_actions(args[0], options, 'VN Template unlocked') do |t|
367
378
  t.unlock
368
379
  end
369
380
  end