opennebula-cli 6.4.3 → 6.5.80.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/bin/oneacct +1 -1
  3. data/bin/oneacl +1 -1
  4. data/bin/onecluster +1 -1
  5. data/bin/onedatastore +1 -1
  6. data/bin/oneflow +1 -1
  7. data/bin/oneflow-template +1 -1
  8. data/bin/onegroup +1 -1
  9. data/bin/onehook +1 -1
  10. data/bin/onehost +1 -1
  11. data/bin/oneimage +52 -3
  12. data/bin/oneirb +1 -1
  13. data/bin/onelog +1 -1
  14. data/bin/onemarket +1 -1
  15. data/bin/onemarketapp +1 -1
  16. data/bin/onesecgroup +1 -1
  17. data/bin/oneshowback +1 -1
  18. data/bin/onetemplate +1 -1
  19. data/bin/oneuser +2 -2
  20. data/bin/onevcenter +1 -1
  21. data/bin/onevdc +1 -1
  22. data/bin/onevm +137 -147
  23. data/bin/onevmgroup +1 -1
  24. data/bin/onevnet +16 -4
  25. data/bin/onevntemplate +1 -1
  26. data/bin/onevrouter +1 -1
  27. data/bin/onezone +1 -1
  28. data/lib/cli_helper.rb +1 -1
  29. data/lib/command_parser.rb +1 -1
  30. data/lib/one_helper/oneacct_helper.rb +1 -1
  31. data/lib/one_helper/oneacl_helper.rb +1 -1
  32. data/lib/one_helper/onecluster_helper.rb +1 -1
  33. data/lib/one_helper/onedatastore_helper.rb +1 -1
  34. data/lib/one_helper/oneflow_helper.rb +1 -1
  35. data/lib/one_helper/oneflowtemplate_helper.rb +1 -1
  36. data/lib/one_helper/onegroup_helper.rb +1 -1
  37. data/lib/one_helper/onehook_helper.rb +1 -1
  38. data/lib/one_helper/onehost_helper.rb +13 -56
  39. data/lib/one_helper/oneimage_helper.rb +70 -9
  40. data/lib/one_helper/onemarket_helper.rb +1 -1
  41. data/lib/one_helper/onemarketapp_helper.rb +1 -1
  42. data/lib/one_helper/onequota_helper.rb +1 -1
  43. data/lib/one_helper/onesecgroup_helper.rb +1 -1
  44. data/lib/one_helper/onetemplate_helper.rb +1 -1
  45. data/lib/one_helper/oneuser_helper.rb +1 -1
  46. data/lib/one_helper/onevcenter_helper.rb +1 -1
  47. data/lib/one_helper/onevdc_helper.rb +1 -1
  48. data/lib/one_helper/onevm_helper.rb +67 -51
  49. data/lib/one_helper/onevmgroup_helper.rb +1 -1
  50. data/lib/one_helper/onevnet_helper.rb +36 -2
  51. data/lib/one_helper/onevntemplate_helper.rb +1 -1
  52. data/lib/one_helper/onevrouter_helper.rb +1 -1
  53. data/lib/one_helper/onezone_helper.rb +1 -1
  54. data/lib/one_helper.rb +3 -3
  55. data/share/schemas/xsd/acct.xsd +28 -0
  56. data/share/schemas/xsd/hook_message_state.xsd +5 -1
  57. data/share/schemas/xsd/host.xsd +3 -23
  58. data/share/schemas/xsd/image.xsd +18 -0
  59. data/share/schemas/xsd/opennebula_configuration.xsd +2 -0
  60. data/share/schemas/xsd/vm.xsd +30 -0
  61. data/share/schemas/xsd/vnet.xsd +28 -0
  62. data/share/schemas/xsd/vnet_pool.xsd +28 -0
  63. metadata +6 -6
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -14,6 +14,7 @@
14
14
  # limitations under the License. #
15
15
  #--------------------------------------------------------------------------- #
16
16
 
17
+ require 'HostSyncManager'
17
18
  require 'one_helper'
18
19
  require 'one_helper/onevm_helper'
19
20
  require 'rubygems'
@@ -268,12 +269,11 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
268
269
 
269
270
  cluster_id = options[:cluster]
270
271
 
271
- # Get remote_dir (implies oneadmin group)
272
272
  rc = OpenNebula::System.new(@client).get_configuration
273
273
  return -1, rc.message if OpenNebula.is_error?(rc)
274
274
 
275
275
  conf = rc
276
- remote_dir = conf['SCRIPTS_REMOTE_DIR']
276
+ sync_manager = HostSyncManager.new(conf)
277
277
 
278
278
  # Verify the existence of REMOTES_LOCATION
279
279
  if !File.directory? REMOTES_LOCATION
@@ -363,21 +363,13 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
363
363
 
364
364
  print_update_info(total - size, total, host['NAME'])
365
365
 
366
- if options[:ssh]
367
- sync_cmd = "ssh #{host['NAME']}" \
368
- " rm -rf '#{remote_dir}' 2>/dev/null;" \
369
- " mkdir -p '#{remote_dir}' 2>/dev/null &&" \
370
- " scp -rp #{REMOTES_LOCATION}/*" \
371
- " #{host['NAME']}:#{remote_dir} 2> /dev/null"
372
- else
373
- sync_cmd = "rsync -Laz --delete #{REMOTES_LOCATION}/" \
374
- " #{host['NAME']}:#{remote_dir}/"
375
- end
376
-
377
366
  retries = 3
378
367
 
379
368
  begin
380
- `#{sync_cmd} 2>/dev/null`
369
+ copy_method = options[:ssh] ? :ssh : :rsync
370
+ rc = sync_manager.update_remotes(host['NAME'],
371
+ nil,
372
+ copy_method)
381
373
  rescue IOError
382
374
  # Workaround for broken Ruby 2.5
383
375
  # https://github.com/OpenNebula/one/issues/3229
@@ -387,7 +379,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
387
379
  end
388
380
  end
389
381
 
390
- if $CHILD_STATUS.nil? || !$CHILD_STATUS.success?
382
+ if rc != 0
391
383
  error_lock.synchronize do
392
384
  host_errors << host['NAME']
393
385
  end
@@ -692,14 +684,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
692
684
  end
693
685
 
694
686
  if numa_nodes && !numa_nodes.empty?
695
- begin
696
- monitoring_numa =
697
- host.to_hash['HOST']['MONITORING']['NUMA_NODE']
698
- rescue StandardError
699
- monitoring_numa = nil
700
- end
701
-
702
- print_numa_nodes(numa_nodes, monitoring_numa)
687
+ print_numa_nodes(numa_nodes)
703
688
  end
704
689
 
705
690
  puts
@@ -784,34 +769,14 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
784
769
  table.show(pcis)
785
770
  end
786
771
 
787
- def print_numa_nodes(numa_nodes, monitoring)
772
+ def print_numa_nodes(numa_nodes)
788
773
  numa_nodes = get_numa_data(numa_nodes)
789
774
 
790
- merge_numa_monitoring(numa_nodes, monitoring)
791
-
792
775
  print_numa_cores(numa_nodes)
793
776
  print_numa_memory(numa_nodes)
794
777
  print_numa_hugepages(numa_nodes)
795
778
  end
796
779
 
797
- def merge_numa_monitoring(numa_nodes, monitoring)
798
- return if monitoring.nil?
799
-
800
- monitoring = [monitoring] if monitoring.class == Hash
801
-
802
- numa_nodes.each do |node|
803
- mon_node = monitoring.find {|x| x['NODE_ID'] == node['NODE_ID'] }
804
-
805
- node['MEMORY']['FREE'] = mon_node['MEMORY']['FREE']
806
- node['MEMORY']['USED'] = mon_node['MEMORY']['USED']
807
-
808
- node['HUGEPAGE'].each do |hp|
809
- mon_hp = mon_node['HUGEPAGE'].find {|x| x['SIZE'] == hp['SIZE'] }
810
- hp['FREE'] = mon_hp['FREE']
811
- end
812
- end
813
- end
814
-
815
780
  def get_numa_data(numa_nodes)
816
781
  numa_nodes = [numa_nodes] if numa_nodes.class == Hash
817
782
 
@@ -921,11 +886,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
921
886
  end
922
887
 
923
888
  column :USED_REAL, 'Used memory', :size => 20, :left => true do |d|
924
- if d['MEMORY']['USED'].nil?
925
- '-'
926
- else
927
- OpenNebulaHelper.unit_to_str(d['MEMORY']['USED'].to_i, {})
928
- end
889
+ OpenNebulaHelper.unit_to_str(d['MEMORY']['USED'].to_i, {})
929
890
  end
930
891
 
931
892
  column :USED_ALLOCATED, 'U memory',
@@ -934,11 +895,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
934
895
  end
935
896
 
936
897
  column :FREE, 'Free memory', :size => 8, :left => true do |d|
937
- if d['MEMORY']['FREE'].nil?
938
- '-'
939
- else
940
- OpenNebulaHelper.unit_to_str(d['MEMORY']['FREE'].to_i, {})
941
- end
898
+ OpenNebulaHelper.unit_to_str(d['MEMORY']['FREE'].to_i, {})
942
899
  end
943
900
 
944
901
  default :NODE_ID, :TOTAL, :USED_REAL, :USED_ALLOCATED, :FREE
@@ -976,7 +933,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
976
933
  end
977
934
 
978
935
  column :FREE, 'Free pages', :size => 8, :left => true do |d|
979
- d['HUGEPAGE']['FREE'] || '-'
936
+ d['HUGEPAGE']['FREE']
980
937
  end
981
938
 
982
939
  column :USED, 'allocated pages', :size => 8, :left => true do |d|
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -348,18 +348,36 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
348
348
  CLIHelper.print_header(str_h1 % 'IMAGE TEMPLATE', false)
349
349
  puts image.template_str
350
350
 
351
- puts
352
- CLIHelper.print_header('VIRTUAL MACHINES', false)
353
- puts
354
-
355
351
  vms=image.retrieve_elements('VMS/ID')
356
352
 
357
353
  return unless vms
358
354
 
359
- vms.map! {|e| e.to_i }
360
- onevm_helper=OneVMHelper.new
361
- onevm_helper.client=@client
362
- onevm_helper.list_pool({ :ids=>vms, :no_pager => true }, false)
355
+ if image.type_str.casecmp('backup').zero?
356
+ CLIHelper.print_header(str_h1 % 'BACKUP INFORMATION', false)
357
+ puts format(str, 'VM', vms[0])
358
+
359
+ if image.has_elements?('/IMAGE/BACKUP_INCREMENTS/INCREMENT')
360
+ puts format(str, 'TYPE', 'INCREMENTAL')
361
+
362
+ puts
363
+
364
+ CLIHelper.print_header('BACKUP INCREMENTS', false)
365
+ format_backup_increments(image)
366
+ else
367
+ puts format(str, 'TYPE', 'FULL')
368
+ end
369
+ else
370
+ puts
371
+ CLIHelper.print_header('VIRTUAL MACHINES', false)
372
+ puts
373
+
374
+ vms.map! {|e| e.to_i }
375
+ onevm_helper=OneVMHelper.new
376
+ onevm_helper.client=@client
377
+ onevm_helper.list_pool({ :ids=>vms, :no_pager => true },
378
+ false)
379
+
380
+ end
363
381
  end
364
382
 
365
383
  def format_snapshots(image)
@@ -412,6 +430,49 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
412
430
  table.show(image_snapshots)
413
431
  end
414
432
 
433
+ def format_backup_increments(image)
434
+ table=CLIHelper::ShowTable.new(nil, self) do
435
+ column :ID, 'Increment ID', :size=>3 do |d|
436
+ d['ID']
437
+ end
438
+
439
+ column :PID, 'Parent increment ID', :size=>3 do |d|
440
+ d['PARENT_ID']
441
+ end
442
+
443
+ column :TYPE, 'T', :size=>1 do |d|
444
+ d['TYPE'][0]
445
+ end
446
+
447
+ column :SIZE, '', :left, :size=>8 do |d|
448
+ if d['SIZE']
449
+ OpenNebulaHelper.unit_to_str(
450
+ d['SIZE'].to_i,
451
+ {},
452
+ 'M'
453
+ )
454
+ else
455
+ '-'
456
+ end
457
+ end
458
+
459
+ column :DATE, 'Creation date', :size=>15 do |d|
460
+ OpenNebulaHelper.time_to_str(d['DATE'])
461
+ end
462
+
463
+ column :SOURCE, 'Backup source', :left, :size=>37 do |d|
464
+ d['SOURCE']
465
+ end
466
+
467
+ default :ID, :PID, :TYPE, :SIZE, :DATE, :SOURCE
468
+ end
469
+
470
+ ihash = image.to_hash
471
+ increments = [ihash['IMAGE']['BACKUP_INCREMENTS']['INCREMENT']].flatten
472
+
473
+ table.show(increments)
474
+ end
475
+
415
476
  class << self
416
477
 
417
478
  def create_image_variables(options, name)
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -117,7 +117,21 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
117
117
  :large => '--schedule TIME',
118
118
  :description => 'Schedules this action to be executed after' \
119
119
  'the given time. For example: onevm resume 0 --schedule "09/23 14:15"',
120
- :format => Time
120
+ :format => String,
121
+ :proc => lambda {|o, options|
122
+ if o[0] == '+'
123
+ options[:schedule] = o
124
+ elsif o == 'now'
125
+ options[:schedule] = Time.now.to_i
126
+ else
127
+ begin
128
+ options[:schedule] = Time.parse(o).to_i
129
+ rescue StandardError
130
+ STDERR.puts "Error parsing time spec: #{o}"
131
+ exit(-1)
132
+ end
133
+ end
134
+ }
121
135
  }
122
136
 
123
137
  WEEKLY = {
@@ -408,10 +422,13 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
408
422
  # Verbose by default
409
423
  options[:verbose] = true
410
424
 
411
- perform_actions(
412
- ids, options,
413
- "#{action} scheduled at #{options[:schedule]}"
414
- ) do |vm|
425
+ message = if options[:schedule].class == Integer
426
+ "#{action} scheduled at #{Time.at(options[:schedule])}"
427
+ else
428
+ "#{action} scheduled after #{options[:schedule]}s from start"
429
+ end
430
+
431
+ perform_actions( ids, options, message) do |vm|
415
432
 
416
433
  str_periodic = ''
417
434
 
@@ -440,20 +457,11 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
440
457
  str_periodic << ', END_TYPE = 0'
441
458
  end
442
459
 
443
- sched = options[:schedule]
444
-
445
- # If the action is set to be executed from VM start to an specific
446
- # amount of time later, we should preserve the + symbol
447
- if ((sched.is_a? String) && !sched.include?('+')) ||
448
- !(sched.is_a? String)
449
- sched = sched.to_i
450
- end
451
-
452
460
  tmp_str = "SCHED_ACTION = ["
453
461
  tmp_str << "ACTION = #{action}, "
454
462
  tmp_str << "WARNING = #{warning}," if warning
455
463
  tmp_str << "ARGS = \"#{options[:args]}\"," if options[:args]
456
- tmp_str << "TIME = #{sched}"
464
+ tmp_str << "TIME = #{options[:schedule]}"
457
465
  tmp_str << str_periodic << ']'
458
466
 
459
467
  vm.sched_action_add(tmp_str)
@@ -1342,42 +1350,31 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1342
1350
  end
1343
1351
  str_end unless d.nil?
1344
1352
  end
1345
-
1346
- column :DONE, '', :adjust => true do |d|
1347
- OpenNebulaHelper.time_to_str(d['DONE'], false) \
1348
- unless d.nil?
1349
- end
1350
-
1351
- column :MESSAGE, '', :size => 35 do |d|
1352
- d['MESSAGE'] ? d['MESSAGE'] : '-'
1353
- end
1354
-
1355
- column :CHARTER, '', :left, :adjust, :size => 15 do |d|
1356
- t1 = Time.now
1357
- t2 = d['TIME'].to_i
1358
- t2 += vm['STIME'].to_i unless d['TIME'] =~ /^[0-9].*/
1359
-
1360
- t2 = Time.at(t2)
1361
-
1362
- days = ((t2 - t1) / (24 * 3600)).round(2)
1363
- hours = ((t2 - t1) / 3600).round(2)
1364
- minutes = ((t2 - t1) / 60).round(2)
1365
-
1366
- if days > 1
1367
- show = "In #{days} days"
1368
- elsif days <= 1 && hours > 1
1369
- show = "In #{hours} hours"
1370
- elsif minutes > 0
1371
- show = "In #{minutes} minutes"
1353
+ column :STATUS, '', :left, :size => 50 do |d|
1354
+ if d['DONE'] && !d['REPEAT']
1355
+ "Done on #{OpenNebulaHelper.time_to_str(d['DONE'], false)}"
1356
+ elsif d['MESSAGE']
1357
+ "Error! #{d['MESSAGE']}"
1372
1358
  else
1373
- show = 'Already done'
1374
- end
1375
-
1376
- wrn = d['WARNING']
1377
- if !wrn.nil? && (t1 - vm['STIME'].to_i).to_i > wrn.to_i
1378
- "#{show} *"
1379
- else
1380
- show
1359
+ t1 = Time.now
1360
+ t2 = d['TIME'].to_i
1361
+ t2 += vm['STIME'].to_i unless d['TIME'] =~ /^[0-9].*/
1362
+
1363
+ t2 = Time.at(t2)
1364
+
1365
+ days = ((t2 - t1) / (24 * 3600)).round(2)
1366
+ hours = ((t2 - t1) / 3600).round(2)
1367
+ minutes = ((t2 - t1) / 60).round(2)
1368
+
1369
+ if days > 1
1370
+ "Next in #{days} days"
1371
+ elsif days <= 1 && hours > 1
1372
+ "Next in #{hours} hours"
1373
+ elsif minutes > 0
1374
+ "Next in #{minutes} minutes"
1375
+ else
1376
+ "Overdue!"
1377
+ end
1381
1378
  end
1382
1379
  end
1383
1380
  end.show([vm_hash['VM']['TEMPLATE']['SCHED_ACTION']].flatten,
@@ -1388,6 +1385,8 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1388
1385
  vm.delete_element('/VM/TEMPLATE/SCHED_ACTION')
1389
1386
  end
1390
1387
 
1388
+ print_backups(vm, vm_hash)
1389
+
1391
1390
  if vm.has_elements?('/VM/USER_TEMPLATE')
1392
1391
  puts
1393
1392
 
@@ -1421,6 +1420,23 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1421
1420
  puts vm.template_str
1422
1421
  end
1423
1422
 
1423
+ def print_backups(vm, vm_hash)
1424
+ if vm.has_elements?('/VM/BACKUPS/BACKUP_CONFIG')
1425
+ puts
1426
+ CLIHelper.print_header('%-80s' % 'BACKUP CONFIGURATION', false)
1427
+ puts vm.template_like_str('BACKUPS/BACKUP_CONFIG')
1428
+ end
1429
+
1430
+ if vm.has_elements?('/VM/BACKUPS/BACKUP_IDS')
1431
+ puts
1432
+ CLIHelper.print_header('%-80s' % 'VM BACKUPS', false)
1433
+
1434
+ ids = [vm_hash['VM']['BACKUPS']['BACKUP_IDS']['ID']].flatten
1435
+
1436
+ puts format('IMAGE IDS: %s', ids.join(','))
1437
+ end
1438
+ end
1439
+
1424
1440
  def print_numa_nodes(numa_nodes)
1425
1441
  puts
1426
1442
  CLIHelper.print_header('NUMA NODES', false)
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -186,8 +186,32 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
186
186
  d['USED_LEASES']
187
187
  end
188
188
 
189
+ column :UPDATED, 'Number of VMs with updated VN attributes', :size=>4 do |d|
190
+ if d['UPDATED_VMS']['ID'].nil?
191
+ '0'
192
+ else
193
+ [d['UPDATED_VMS']['ID']].flatten.size
194
+ end
195
+ end
196
+
197
+ column :OUTDATED, 'Number of VMs with outdated VN attributes', :size=>4 do |d|
198
+ if d['OUTDATED_VMS']['ID'].nil?
199
+ '0'
200
+ else
201
+ [d['OUTDATED_VMS']['ID']].flatten.size
202
+ end
203
+ end
204
+
205
+ column :ERROR, 'Number of VMs that failed to update VN attributes', :size=>4 do |d|
206
+ if d['ERROR_VMS']['ID'].nil?
207
+ '0'
208
+ else
209
+ [d['ERROR_VMS']['ID']].flatten.size
210
+ end
211
+ end
212
+
189
213
  default :ID, :USER, :GROUP, :NAME, :CLUSTERS, :BRIDGE, :STATE,
190
- :LEASES
214
+ :LEASES, :OUTDATED, :ERROR
191
215
  end
192
216
  end
193
217
 
@@ -474,6 +498,16 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
474
498
  puts format('%-15s', id)
475
499
  end
476
500
 
501
+ puts
502
+
503
+ CLIHelper.print_header(str_h1 % 'VIRTUAL MACHINES', false)
504
+
505
+ updated, outdated, error = vn.vm_ids
506
+
507
+ puts format(str, 'UPDATED', updated.join(','))
508
+ puts format(str, 'OUTDATED', outdated.join(','))
509
+ puts format(str, 'ERROR', error.join(','))
510
+
477
511
  return unless options[:show_ar]
478
512
 
479
513
  ar_list.each do |ar_id|
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
data/lib/one_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -30,7 +30,7 @@ include OpenNebula
30
30
  module OpenNebulaHelper
31
31
  ONE_VERSION=<<-EOT
32
32
  OpenNebula #{OpenNebula::VERSION}
33
- Copyright 2002-2023, OpenNebula Project, OpenNebula Systems
33
+ Copyright 2002-2022, OpenNebula Project, OpenNebula Systems
34
34
  EOT
35
35
 
36
36
  if ONE_LOCATION
@@ -424,7 +424,7 @@ EOT
424
424
  FORCE={
425
425
  :name => 'force',
426
426
  :large => '--force',
427
- :description => 'Overwrite the file'
427
+ :description => 'Ignore errors (if possible)'
428
428
  }
429
429
 
430
430
  EXTENDED={
@@ -170,6 +170,34 @@
170
170
  </xs:sequence>
171
171
  </xs:complexType>
172
172
  </xs:element>
173
+ <xs:element name="BACKUPS">
174
+ <xs:complexType>
175
+ <xs:sequence>
176
+ <xs:element name="BACKUP_CONFIG" minOccurs="1" maxOccurs="1">
177
+ <xs:complexType>
178
+ <xs:sequence>
179
+ <xs:element name="BACKUP_VOLATILE" type="xs:string" minOccurs="0" maxOccurs="1"/>
180
+ <xs:element name="FS_FREEZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
181
+ <xs:element name="INCREMENTAL_BACKUP_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
182
+ <xs:element name="KEEP_LAST" type="xs:string" minOccurs="0" maxOccurs="1"/>
183
+ <xs:element name="LAST_BACKUP_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
184
+ <xs:element name="LAST_BACKUP_SIZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
185
+ <xs:element name="LAST_DATASTORE_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
186
+ <xs:element name="LAST_INCREMENT_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
187
+ <xs:element name="MODE" type="xs:string" minOccurs="0" maxOccurs="1"/>
188
+ </xs:sequence>
189
+ </xs:complexType>
190
+ </xs:element>
191
+ <xs:element name="BACKUP_IDS" minOccurs="1" maxOccurs="1">
192
+ <xs:complexType>
193
+ <xs:sequence>
194
+ <xs:element name="ID" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
195
+ </xs:sequence>
196
+ </xs:complexType>
197
+ </xs:element>
198
+ </xs:sequence>
199
+ </xs:complexType>
200
+ </xs:element>
173
201
  </xs:sequence>
174
202
  </xs:complexType>
175
203
  </xs:element>
@@ -10,15 +10,19 @@
10
10
  <xs:restriction base="xs:string">
11
11
  <xs:enumeration value="VM"/>
12
12
  <xs:enumeration value="HOST"/>
13
+ <xs:enumeration value="IMAGE"/>
14
+ <xs:enumeration value="VNET"/>
13
15
  </xs:restriction>
14
16
  </xs:simpleType>
15
17
  </xs:element>
16
18
  <xs:element name="STATE" type="xs:string"/>
17
19
  <xs:element name="LCM_STATE" type="xs:string" maxOccurs="1" minOccurs="0"/>
18
20
  <xs:element name="REMOTE_HOST" type="xs:string" maxOccurs="1" minOccurs="0"/>
19
- <!-- The template of the resource (VM or Host) is included here -->
21
+ <!-- The template of the resource (VM, Host, Image or VNet) is included here -->
20
22
  <xs:element ref="HOST" maxOccurs="1" minOccurs="0"/>
21
23
  <xs:element ref="VM" maxOccurs="1" minOccurs="0"/>
24
+ <xs:element ref="IMAGE" maxOccurs="1" minOccurs="0"/>
25
+ <xs:element ref="VNET" maxOccurs="1" minOccurs="0"/>
22
26
  </xs:sequence>
23
27
  </xs:complexType>
24
28
  </xs:element>