opennebula-cli 6.10.2 → 6.99.85.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 (78) hide show
  1. checksums.yaml +4 -4
  2. data/bin/oneacct +5 -18
  3. data/bin/oneacl +2 -18
  4. data/bin/onebackupjob +2 -18
  5. data/bin/onecluster +36 -18
  6. data/bin/onedatastore +2 -18
  7. data/bin/oneflow +2 -18
  8. data/bin/oneflow-template +8 -24
  9. data/bin/onegroup +2 -18
  10. data/bin/onehook +2 -18
  11. data/bin/onehost +4 -48
  12. data/bin/oneimage +2 -18
  13. data/bin/oneirb +2 -61
  14. data/bin/onelog +3 -22
  15. data/bin/onemarket +2 -18
  16. data/bin/onemarketapp +2 -30
  17. data/bin/onesecgroup +2 -18
  18. data/bin/oneshowback +2 -18
  19. data/bin/onetemplate +2 -19
  20. data/bin/oneuser +2 -18
  21. data/bin/onevdc +2 -18
  22. data/bin/onevm +21 -19
  23. data/bin/onevmgroup +2 -18
  24. data/bin/onevnet +2 -18
  25. data/bin/onevntemplate +2 -18
  26. data/bin/onevrouter +13 -20
  27. data/bin/onezone +2 -18
  28. data/lib/cli_helper.rb +1 -1
  29. data/lib/command_parser.rb +1 -1
  30. data/lib/one_helper/oneacct_helper.rb +10 -2
  31. data/lib/one_helper/oneacl_helper.rb +1 -1
  32. data/lib/one_helper/onebackupjob_helper.rb +1 -1
  33. data/lib/one_helper/onecluster_helper.rb +49 -1
  34. data/lib/one_helper/onedatastore_helper.rb +1 -1
  35. data/lib/one_helper/oneflow_helper.rb +1 -1
  36. data/lib/one_helper/oneflowtemplate_helper.rb +17 -17
  37. data/lib/one_helper/onegroup_helper.rb +4 -55
  38. data/lib/one_helper/onehook_helper.rb +1 -1
  39. data/lib/one_helper/onehost_helper.rb +29 -87
  40. data/lib/one_helper/oneimage_helper.rb +2 -19
  41. data/lib/one_helper/onemarket_helper.rb +1 -1
  42. data/lib/one_helper/onemarketapp_helper.rb +13 -3
  43. data/lib/one_helper/onequota_helper.rb +35 -8
  44. data/lib/one_helper/onesecgroup_helper.rb +1 -1
  45. data/lib/one_helper/onetemplate_helper.rb +1 -8
  46. data/lib/one_helper/oneuser_helper.rb +41 -75
  47. data/lib/one_helper/onevdc_helper.rb +1 -1
  48. data/lib/one_helper/onevm_helper.rb +119 -102
  49. data/lib/one_helper/onevmgroup_helper.rb +1 -1
  50. data/lib/one_helper/onevnet_helper.rb +1 -1
  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 +10 -23
  54. data/lib/one_helper.rb +34 -156
  55. data/share/schemas/xsd/acct.xsd +2 -0
  56. data/share/schemas/xsd/cluster.xsd +21 -0
  57. data/share/schemas/xsd/datastore.xsd +1 -13
  58. data/share/schemas/xsd/group.xsd +11 -122
  59. data/share/schemas/xsd/group_pool.xsd +8 -120
  60. data/share/schemas/xsd/host.xsd +19 -21
  61. data/share/schemas/xsd/image.xsd +0 -1
  62. data/share/schemas/xsd/monitoring_data.xsd +0 -8
  63. data/share/schemas/xsd/opennebula_configuration.xsd +23 -1
  64. data/share/schemas/xsd/plan.xsd +29 -0
  65. data/share/schemas/xsd/requirements.xsd +45 -0
  66. data/share/schemas/xsd/scheduler_driver_action.xsd +24 -0
  67. data/share/schemas/xsd/shared.xsd +67 -0
  68. data/share/schemas/xsd/user.xsd +10 -122
  69. data/share/schemas/xsd/user_pool.xsd +8 -120
  70. data/share/schemas/xsd/vm.xsd +37 -28
  71. data/share/schemas/xsd/vm_pool.xsd +0 -12
  72. data/share/schemas/xsd/vm_pool_extended.xsd +12 -0
  73. data/share/schemas/xsd/vmtemplate.xsd +0 -3
  74. data/share/schemas/xsd/vnet.xsd +0 -5
  75. data/share/schemas/xsd/vnet_pool_extended.xsd +12 -0
  76. metadata +11 -9
  77. data/bin/onevcenter +0 -471
  78. data/lib/one_helper/onevcenter_helper.rb +0 -523
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2024, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2025, 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 #
@@ -280,7 +280,7 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
280
280
  d["ID"]
281
281
  end
282
282
 
283
- column :NAME, "Name of the User", :left, :size=>15 do |d|
283
+ column :NAME, "Name of the User", :left, :size=>5 do |d|
284
284
  d["NAME"]
285
285
  end
286
286
 
@@ -302,30 +302,19 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
302
302
 
303
303
  column :VMS , "Number of VMS", :size=>9 do |d|
304
304
  begin
305
- q = quotas[d['ID']]
306
-
307
- if q['VM_QUOTA']['VM'].nil? && d["ID"].to_i != 0
308
- q['VM_QUOTA']['VM'] = {
309
- "VMS" => OneQuotaHelper::LIMIT_DEFAULT,
310
- "VMS_USED" => "0",
311
- "CPU" => OneQuotaHelper::LIMIT_DEFAULT,
312
- "CPU_USED" => "0",
313
- "MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
314
- "MEMORY_USED" => "0",
315
- "RUNNING_VMS" => OneQuotaHelper::LIMIT_DEFAULT,
316
- "RUNNING_VMS_USED" => "0",
317
- "RUNNING_CPU" => OneQuotaHelper::LIMIT_DEFAULT,
318
- "RUNNING_CPU_USED" => "0",
319
- "RUNNING_MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
320
- "RUNNING_MEMORY_USED" => "0",
321
- "SYSTEM_DISK_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
322
- "SYSTEM_DISK_SIZE_USED" => "0"
323
- }
324
-
325
- quotas[d['ID']] = q
305
+ q = quotas[d['ID']]['VM_QUOTA']['VM']
306
+
307
+ if q.nil? && d["ID"].to_i != 0
308
+ q = OneQuotaHelper::DEFAULT_VM_QUOTA
309
+ end
310
+
311
+ # In case of multiple quotas, use the global quota or the first
312
+ if q.is_a?(Array)
313
+ global_quota = q.find{|hash| hash['CLUSTER_IDS'].nil? || hash['CLUSTER_IDS'].empty? }
314
+ q = global_quota || q[0]
326
315
  end
327
316
 
328
- limit = q['VM_QUOTA']['VM']["VMS"]
317
+ limit = q["VMS"]
329
318
 
330
319
  if limit == OneQuotaHelper::LIMIT_DEFAULT
331
320
  limit = pool_default_quotas("VM_QUOTA/VM/VMS")
@@ -335,9 +324,9 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
335
324
  end
336
325
 
337
326
  if limit == OneQuotaHelper::LIMIT_UNLIMITED
338
- "%3d / -" % [q['VM_QUOTA']['VM']["VMS_USED"]]
327
+ "%3d / -" % [q["VMS_USED"]]
339
328
  else
340
- "%3d / %3d" % [q['VM_QUOTA']['VM']["VMS_USED"], limit]
329
+ "%3d / %3d" % [q["VMS_USED"], limit]
341
330
  end
342
331
 
343
332
  rescue NoMethodError
@@ -347,30 +336,19 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
347
336
 
348
337
  column :MEMORY, "Total memory allocated to user VMs", :size=>17 do |d|
349
338
  begin
350
- q = quotas[d['ID']]
351
-
352
- if q['VM_QUOTA']['VM'].nil? && d["ID"].to_i != 0
353
- q['VM_QUOTA']['VM'] = {
354
- "VMS" => OneQuotaHelper::LIMIT_DEFAULT,
355
- "VMS_USED" => "0",
356
- "CPU" => OneQuotaHelper::LIMIT_DEFAULT,
357
- "CPU_USED" => "0",
358
- "MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
359
- "MEMORY_USED" => "0",
360
- "RUNNING_VMS" => OneQuotaHelper::LIMIT_DEFAULT,
361
- "RUNNING_VMS_USED" => "0",
362
- "RUNNING_CPU" => OneQuotaHelper::LIMIT_DEFAULT,
363
- "RUNNING_CPU_USED" => "0",
364
- "RUNNING_MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
365
- "RUNNING_MEMORY_USED" => "0",
366
- "SYSTEM_DISK_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
367
- "SYSTEM_DISK_SIZE_USED" => "0"
368
- }
369
-
370
- quotas[d['ID']] = q
339
+ q = quotas[d['ID']]['VM_QUOTA']['VM']
340
+
341
+ if q.nil? && d["ID"].to_i != 0
342
+ q = OneQuotaHelper::DEFAULT_VM_QUOTA
343
+ end
344
+
345
+ # In case of multiple quotas, use the global quota or the first
346
+ if q.is_a?(Array)
347
+ global_quota = q.find{|hash| hash['CLUSTER_IDS'].nil? || hash['CLUSTER_IDS'].empty? }
348
+ q = global_quota || q[0]
371
349
  end
372
350
 
373
- limit = q['VM_QUOTA']['VM']["MEMORY"]
351
+ limit = q["MEMORY"]
374
352
 
375
353
  if limit == OneQuotaHelper::LIMIT_DEFAULT
376
354
  limit = pool_default_quotas("VM_QUOTA/VM/MEMORY")
@@ -381,10 +359,10 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
381
359
 
382
360
  if limit == OneQuotaHelper::LIMIT_UNLIMITED
383
361
  "%7s / -" % [
384
- OpenNebulaHelper.unit_to_str(q['VM_QUOTA']['VM']["MEMORY_USED"].to_i,{},"M")]
362
+ OpenNebulaHelper.unit_to_str(q["MEMORY_USED"].to_i,{},"M")]
385
363
  else
386
364
  "%7s / %7s" % [
387
- OpenNebulaHelper.unit_to_str(q['VM_QUOTA']['VM']["MEMORY_USED"].to_i,{},"M"),
365
+ OpenNebulaHelper.unit_to_str(q["MEMORY_USED"].to_i,{},"M"),
388
366
  OpenNebulaHelper.unit_to_str(limit.to_i,{},"M")]
389
367
  end
390
368
 
@@ -395,30 +373,19 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
395
373
 
396
374
  column :CPU, "Total CPU allocated to user VMs", :size=>11 do |d|
397
375
  begin
398
- q = quotas[d['ID']]
399
-
400
- if q['VM_QUOTA']['VM'].nil? && d["ID"].to_i != 0
401
- q['VM_QUOTA']['VM'] = {
402
- "VMS" => OneQuotaHelper::LIMIT_DEFAULT,
403
- "VMS_USED" => "0",
404
- "CPU" => OneQuotaHelper::LIMIT_DEFAULT,
405
- "CPU_USED" => "0",
406
- "MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
407
- "MEMORY_USED" => "0",
408
- "RUNNING_VMS" => OneQuotaHelper::LIMIT_DEFAULT,
409
- "RUNNING_VMS_USED" => "0",
410
- "RUNNING_CPU" => OneQuotaHelper::LIMIT_DEFAULT,
411
- "RUNNING_CPU_USED" => "0",
412
- "RUNNING_MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
413
- "RUNNING_MEMORY_USED" => "0",
414
- "SYSTEM_DISK_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
415
- "SYSTEM_DISK_SIZE_USED" => "0"
416
- }
417
-
418
- quotas[d['ID']] = q
376
+ q = quotas[d['ID']]['VM_QUOTA']['VM']
377
+
378
+ if q.nil? && d["ID"].to_i != 0
379
+ q = OneQuotaHelper::DEFAULT_VM_QUOTA
419
380
  end
420
381
 
421
- limit = q['VM_QUOTA']['VM']["CPU"]
382
+ # In case of multiple quotas, use the global quota or the first
383
+ if q.is_a?(Array)
384
+ global_quota = q.find{|hash| hash['CLUSTER_IDS'].nil? || hash['CLUSTER_IDS'].empty? }
385
+ q = global_quota || q[0]
386
+ end
387
+
388
+ limit = q["CPU"]
422
389
 
423
390
  if limit == OneQuotaHelper::LIMIT_DEFAULT
424
391
  limit = pool_default_quotas("VM_QUOTA/VM/CPU")
@@ -428,9 +395,9 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
428
395
  end
429
396
 
430
397
  if limit == OneQuotaHelper::LIMIT_UNLIMITED
431
- "%3.1f / -" % [q['VM_QUOTA']['VM']["CPU_USED"]]
398
+ "%3.1f / -" % [q["CPU_USED"]]
432
399
  else
433
- "%3.1f / %3.1f" % [q['VM_QUOTA']['VM']["CPU_USED"], limit]
400
+ "%3.1f / %3.1f" % [q["CPU_USED"], limit]
434
401
  end
435
402
 
436
403
  rescue NoMethodError
@@ -616,5 +583,4 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
616
583
  helper = OneQuotaHelper.new(@client)
617
584
  helper.format_quota(user_hash['USER'], default_quotas, user.id)
618
585
  end
619
-
620
586
  end
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2024, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2025, 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-2024, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2025, 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 #
@@ -210,14 +210,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
210
210
  end
211
211
  end
212
212
 
213
- VirtualMachine::EXTERNAL_IP_ATTRS.each do |attr|
214
- external_ip = vm['MONITORING'][attr]
215
-
216
- if !external_ip.nil? && !ips.include?(external_ip)
217
- ips.push(external_ip)
218
- end
219
- end
220
-
221
213
  return '--' if ips.empty?
222
214
 
223
215
  ips.join(',')
@@ -684,8 +676,20 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
684
676
  end
685
677
 
686
678
  def format_resource(vm, options = {})
679
+ max_value = 80
680
+
687
681
  str_h1 = '%-80s'
688
- str = '%-20s: %-20s'
682
+ str = "%-20s: %-#{max_value}s"
683
+
684
+ trunc = lambda do |tvalue, max = max_value|
685
+ return '' unless tvalue
686
+
687
+ if tvalue.length > max
688
+ tvalue[0, max - 3] + '...'
689
+ else
690
+ tvalue
691
+ end
692
+ end
689
693
 
690
694
  cluster = nil
691
695
 
@@ -743,45 +747,95 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
743
747
 
744
748
  puts
745
749
 
746
- CLIHelper.print_header(str_h1 % 'VIRTUAL MACHINE MONITORING', false)
747
-
748
750
  vm_monitoring = vm_hash['VM']['MONITORING']
749
751
 
750
- # Find out if it is a hybrid VM to avoid showing local IPs
751
- is_hybrid = false
752
- vm_monitoring.each do |key, _value|
753
- if VirtualMachine::EXTERNAL_IP_ATTRS.include? key
754
- is_hybrid = true
752
+ unit_lambda = ->(v) { OpenNebulaHelper.unit_to_str(v.to_i, {}) }
753
+ unitM_lambda = ->(v) { OpenNebulaHelper.unit_to_str(v.to_i / 1024, {}) }
754
+
755
+ order_attrs = {
756
+ 'CPU' => nil,
757
+ 'MEMORY' => unit_lambda,
758
+ 'NETTX' => unitM_lambda,
759
+ 'NETTX_BW' => unitM_lambda,
760
+ 'NETRX' => unitM_lambda,
761
+ 'NETRX_BW' => unitM_lambda,
762
+ 'DISKRDBYTES' => unit_lambda,
763
+ 'DISKRDBYTES_BW' => unit_lambda,
764
+ 'DISKRDIOPS' => nil,
765
+ 'DISKRDIOPS_BW' => nil,
766
+ 'DISKWRBYTES' => unit_lambda,
767
+ 'DISKWRBYTES_BW' => unit_lambda,
768
+ 'DISKWRIOPS_BW' => nil,
769
+ 'DISKWRIOPS' => nil
770
+ }
771
+
772
+ vm_monitoring_sort = []
773
+ order_attrs.each do |key, format|
774
+ val = vm_monitoring.delete(key)
775
+
776
+ if !val
777
+ vm_monitoring_sort << { 'NAME' => key,
778
+ 'VALUE' => '-',
779
+ 'FORECAST' => '-',
780
+ 'FORECAST_FAR' => '-' }
781
+ next
755
782
  end
756
- end
757
783
 
758
- order_attrs = ['CPU', 'MEMORY', 'NETTX', 'NETRX']
784
+ val = format.call(val) if format
759
785
 
760
- vm_monitoring_sort = []
761
- order_attrs.each do |key|
762
- if (val = vm_monitoring.delete(key))
763
- vm_monitoring_sort << [key, val]
786
+ forecast = []
787
+
788
+ ["#{key}_FORECAST", "#{key}_FORECAST_FAR"].each do |fk|
789
+ fv = vm_monitoring.delete(fk)
790
+ fv = format.call(fv) if format && fv
791
+
792
+ fv ||= '-'
793
+
794
+ forecast << fv
764
795
  end
796
+
797
+ vm_monitoring_sort << { 'NAME' => key,
798
+ 'VALUE' => val,
799
+ 'FORECAST' => forecast[0],
800
+ 'FORECAST_FAR' => forecast[1] }
765
801
  end
766
802
 
767
- vm_monitoring_sort.sort_by {|a| a[0] }
803
+ vm_monitoring_sort.sort_by {|a| a['NAME'] }
768
804
 
769
- filter_attrs = ['STATE', 'DISK_SIZE', 'SNAPSHOT_SIZE']
770
- vm_monitoring.each do |key, val|
771
- if !filter_attrs.include?(key)
772
- vm_monitoring_sort << [key, val]
773
- end
805
+ tstamp = begin
806
+ Time.at(Integer(vm_monitoring.delete('TIMESTAMP'))).ctime
807
+ rescue StandardError
808
+ '-'
774
809
  end
775
810
 
776
- vm_monitoring_sort.each do |k, v|
777
- if k == 'MEMORY'
778
- puts format(str, k, OpenNebulaHelper.unit_to_str(v.to_i, {}))
779
- elsif k =~ /NET.X/
780
- puts format(str, k,
781
- OpenNebulaHelper.unit_to_str(v.to_i / 1024, {}))
782
- else
783
- puts format(str, k, v)
811
+ CLIHelper.print_header(str_h1 % "VIRTUAL MACHINE MONITORING [#{tstamp}]", false)
812
+ CLIHelper::ShowTable.new(nil, self) do
813
+ column :METRIC, '', :left, :size => 20 do |d|
814
+ d['NAME']
815
+ end
816
+
817
+ column :VALUE, '', :left, :size => 15 do |d|
818
+ d['VALUE']
784
819
  end
820
+
821
+ column :FORECAST, '', :left, :size => 15 do |d|
822
+ d['FORECAST'] || ''
823
+ end
824
+
825
+ column :FORECAST_FAR, '', :left, :size => 15 do |d|
826
+ d['FORECAST_FAR'] || ''
827
+ end
828
+
829
+ default :METRIC, :VALUE, :FORECAST, :FORECAST_FAR
830
+ end.show(vm_monitoring_sort, {})
831
+
832
+ puts
833
+
834
+ filter_attrs = ['STATE', 'DISK_SIZE', 'SNAPSHOT_SIZE', 'ID', 'TIMESTAMP']
835
+ vm_monitoring.each do |key, val|
836
+ next if filter_attrs.include?(key)
837
+
838
+ puts format(str, trunc.call(key, 20), trunc.call(val))
785
839
  end
786
840
 
787
841
  puts
@@ -803,8 +857,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
803
857
  vm_disks = [vm_hash['VM']['TEMPLATE']['DISK']].flatten
804
858
  end
805
859
 
806
- if vm.has_elements?('/VM/TEMPLATE/CONTEXT') \
807
- && vm['/VM/HISTORY_RECORDS/HISTORY[1]/VM_MAD'] != 'vcenter'
860
+ if vm.has_elements?('/VM/TEMPLATE/CONTEXT')
808
861
  context_disk = vm_hash['VM']['TEMPLATE']['CONTEXT']
809
862
 
810
863
  context_disk['IMAGE'] = 'CONTEXT'
@@ -841,7 +894,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
841
894
  d['TARGET']
842
895
  end
843
896
 
844
- # rubocop:disable Metrics/LineLength
845
897
  column :IMAGE, '', :left, :size => 35 do |d|
846
898
  d['IMAGE'] || case d['TYPE'].upcase
847
899
  when 'FS'
@@ -854,7 +906,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
854
906
 
855
907
  end
856
908
  end
857
- # rubocop:enable Metrics/LineLength
858
909
 
859
910
  column :SIZE, '', :left, :size => 9 do |d|
860
911
  if d['SIZE']
@@ -930,26 +981,9 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
930
981
  sg_nics.compact!
931
982
  end
932
983
 
933
- # This variable holds the extra IP's got from monitoring. Right
934
- # now it adds GUEST_IP and GUEST_IP_ADDRESSES from vcenter
935
- # monitoring. If other variables hold IPs just add them to this
936
- # array. Duplicate IPs are not shown.
937
- extra_ips = []
938
-
939
- if (val = vm['/VM/MONITORING/GUEST_IP']) && (val && !val.empty?)
940
- extra_ips << val
941
- end
942
-
943
- if (val = vm['/VM/MONITORING/GUEST_IP_ADDRESSES']) && (val && !val.empty?)
944
- extra_ips += val.split(',')
945
- end
946
-
947
- extra_ips.uniq!
948
-
949
984
  ['NIC', 'NIC_ALIAS'].each do |type|
950
985
  next unless vm.has_elements?("/VM/TEMPLATE/#{type}") ||
951
- vm.has_elements?('/VM/TEMPLATE/PCI[NIC_ID>-1]') ||
952
- !extra_ips.empty?
986
+ vm.has_elements?('/VM/TEMPLATE/PCI[NIC_ID>-1]')
953
987
 
954
988
  puts
955
989
  CLIHelper.print_header(
@@ -961,8 +995,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
961
995
  'MAC' => '-',
962
996
  'BRIDGE' => '-' }
963
997
 
964
- shown_ips = []
965
-
966
998
  array_id = 0
967
999
  vm_nics = [vm_hash['VM']['TEMPLATE'][type]]
968
1000
 
@@ -985,8 +1017,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
985
1017
  ['EXTERNAL_IP', 'IP6_LINK', 'IP6_ULA', 'IP6_GLOBAL', 'IP6'].each do |attr|
986
1018
  next unless nic.key?(attr)
987
1019
 
988
- shown_ips << nic[attr]
989
-
990
1020
  ipstr = { 'IP' => nic.delete(attr),
991
1021
  'CLI_DONE' => true,
992
1022
  'DOUBLE_ENTRY' => true }
@@ -999,8 +1029,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
999
1029
  'VROUTER_IP6_GLOBAL'].each do |attr|
1000
1030
  next unless nic.key?(attr)
1001
1031
 
1002
- shown_ips << nic[attr]
1003
-
1004
1032
  ipstr = { 'IP' => nic.delete(attr) + ' (VRouter)',
1005
1033
  'CLI_DONE' => true,
1006
1034
  'DOUBLE_ENTRY' => true }
@@ -1009,25 +1037,10 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1009
1037
  array_id += 1
1010
1038
  end
1011
1039
 
1012
- shown_ips << nic['IP'] if nic.key?('IP')
1013
- shown_ips << nic['EXTERNAL_IP'] if nic.key?('EXTERNAL_IP')
1014
-
1015
1040
  nic.merge!(nic_default) {|_k, v1, _v2| v1 }
1016
1041
  array_id += 1
1017
1042
  end
1018
1043
 
1019
- extra_ips -= shown_ips
1020
-
1021
- # Add extra IPs to the VM NICS table
1022
- extra_ips.each do |ip|
1023
- vm_nics << {
1024
- 'NIC_ID' => '-',
1025
- 'IP' => ip,
1026
- 'NETWORK' => 'Additional IP',
1027
- 'BRIDGE' => '-'
1028
- }
1029
- end
1030
-
1031
1044
  CLIHelper::ShowTable.new(nil, self) do
1032
1045
  column :ID, '', :size => 3 do |d|
1033
1046
  if d['DOUBLE_ENTRY']
@@ -1105,7 +1118,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1105
1118
  vm.delete_element('/VM/TEMPLATE/NIC') while vm.has_elements?('/VM/TEMPLATE/NIC')
1106
1119
  end
1107
1120
 
1108
- if vm.has_elements?('/VM/TEMPLATE/SECURITY_GROUP_RULE') && !is_hybrid
1121
+ if vm.has_elements?('/VM/TEMPLATE/SECURITY_GROUP_RULE')
1109
1122
  puts
1110
1123
  CLIHelper.print_header(str_h1 % 'SECURITY', false)
1111
1124
  puts
@@ -1126,8 +1139,9 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1126
1139
 
1127
1140
  puts
1128
1141
 
1129
- # rubocop:disable Metrics/LineLength
1142
+ # rubocop:disable Layout/LineLength
1130
1143
  CLIHelper.print_header(str_h1 % 'SECURITY GROUP TYPE PROTOCOL NETWORK RANGE ', false)
1144
+ # rubocop:enable Layout/LineLength
1131
1145
 
1132
1146
  CLIHelper::ShowTable.new(nil, self) do
1133
1147
  column :ID, '', :size => 4 do |d|
@@ -1179,7 +1193,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1179
1193
  end.show(
1180
1194
  [vm_hash['VM']['TEMPLATE']['SECURITY_GROUP_RULE']].flatten, {}
1181
1195
  )
1182
- # rubocop:enable Metrics/LineLength
1183
1196
 
1184
1197
  if !options[:all]
1185
1198
  while vm.has_elements?('/VM/TEMPLATE/SECURITY_GROUP_RULE')
@@ -1192,23 +1205,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1192
1205
  puts
1193
1206
  CLIHelper.print_header(str_h1 % 'SNAPSHOTS', false)
1194
1207
 
1195
- CLIHelper::ShowTable.new(nil, self) do
1196
- column :ID, '', :size => 4 do |d|
1197
- d['SNAPSHOT_ID'] unless d.nil?
1198
- end
1199
-
1200
- column :TIME, '', :size => 12 do |d|
1201
- OpenNebulaHelper.time_to_str(d['TIME'], false) unless d.nil?
1202
- end
1203
-
1204
- column :NAME, '', :left, :size => 46 do |d|
1205
- d['NAME'] unless d.nil?
1206
- end
1207
-
1208
- column :HYPERVISOR_ID, '', :left, :size => 15 do |d|
1209
- d['HYPERVISOR_ID'] unless d.nil?
1210
- end
1211
- end.show([vm_hash['VM']['TEMPLATE']['SNAPSHOT']].flatten, {})
1208
+ format_template_snapshots(vm)
1212
1209
 
1213
1210
  vm.delete_element('/VM/TEMPLATE/SNAPSHOT')
1214
1211
  end
@@ -1289,7 +1286,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1289
1286
  CLIHelper.print_header('NUMA NODES', false)
1290
1287
  puts
1291
1288
 
1292
- # rubocop:disable Metrics/LineLength
1293
1289
  table = CLIHelper::ShowTable.new(nil, self) do
1294
1290
  column :ID, 'Node ID', :size => 4, :left => false do |d|
1295
1291
  d['NODE_ID']
@@ -1309,7 +1305,6 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1309
1305
 
1310
1306
  default :ID, :CPUS_IDS, :MEMORY, :TOTAL_CPUS
1311
1307
  end
1312
- # rubocop:enable Metrics/LineLength
1313
1308
 
1314
1309
  table.show(numa_nodes)
1315
1310
  end
@@ -1501,6 +1496,28 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1501
1496
  table.show(snapshots)
1502
1497
  end
1503
1498
 
1499
+ def format_template_snapshots(vm)
1500
+ table = CLIHelper::ShowTable.new(nil, self) do
1501
+ column :ID, '', :size => 4 do |d|
1502
+ d['SNAPSHOT_ID'] unless d.nil?
1503
+ end
1504
+
1505
+ column :TIME, '', :size => 12 do |d|
1506
+ OpenNebulaHelper.time_to_str(d['TIME'], false) unless d.nil?
1507
+ end
1508
+
1509
+ column :NAME, '', :left, :size => 46 do |d|
1510
+ d['NAME'] unless d.nil?
1511
+ end
1512
+
1513
+ column :HYPERVISOR_ID, '', :left, :size => 15 do |d|
1514
+ d['HYPERVISOR_ID'] unless d.nil?
1515
+ end
1516
+ end
1517
+ vm_hash = vm.to_hash
1518
+ table.show([vm_hash['VM']['TEMPLATE']['SNAPSHOT']].flatten, {})
1519
+ end
1520
+
1504
1521
  end
1505
1522
 
1506
1523
  # rubocop:enable Naming/UncommunicativeMethodParamName
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2024, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2025, 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-2024, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2025, 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-2024, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2025, 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-2024, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2025, 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-2024, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2025, 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 #
@@ -28,36 +28,19 @@ class Replicator
28
28
  FED_ATTRS = %w[MODE ZONE_ID SERVER_ID MASTER_ONED]
29
29
 
30
30
  FILES = [
31
- { :name => 'az_driver.conf',
32
- :service => 'opennebula' },
33
- { :name => 'az_driver.default',
34
- :service => 'opennebula' },
35
- { :name => 'ec2_driver.conf',
36
- :service => 'opennebula' },
37
- { :name => 'ec2_driver.default',
38
- :service => 'opennebula' },
39
31
  { :name => 'monitord.conf',
40
32
  :service => 'opennebula' },
41
33
  { :name => 'oneflow-server.conf',
42
34
  :service => 'opennebula-flow' },
43
35
  { :name => 'onegate-server.conf',
44
- :service => 'opennebula-gate' },
45
- { :name => 'sched.conf',
46
- :service => 'opennebula' },
47
- { :name => 'sunstone-logos.yaml',
48
- :service => 'opennebula-sunstone' },
49
- { :name => 'sunstone-server.conf',
50
- :service => 'opennebula-sunstone' },
51
- { :name => 'vcenter_driver.default',
52
- :service => 'opennebula' }
36
+ :service => 'opennebula-gate' }
53
37
  ]
54
38
 
55
39
  FOLDERS = [
56
- { :name => 'sunstone-views', :service => 'opennebula-sunstone' },
57
40
  { :name => 'auth', :service => 'opennebula' },
58
41
  { :name => 'hm', :service => 'opennebula' },
59
- { :name => 'sunstone-views', :service => 'opennebula' },
60
- { :name => 'vmm_exec', :service => 'opennebula' }
42
+ { :name => 'vmm_exec', :service => 'opennebula' },
43
+ { :name => 'schedulers', :service => 'opennebula' }
61
44
  ]
62
45
 
63
46
  # Class constructor
@@ -100,7 +83,6 @@ class Replicator
100
83
 
101
84
  # Set OpenNebula services to not restart
102
85
  @opennebula_services = { 'opennebula' => false,
103
- 'opennebula-sunstone' => false,
104
86
  'opennebula-gate' => false,
105
87
  'opennebula-flow' => false }
106
88
  end
@@ -166,6 +148,11 @@ class Replicator
166
148
  def copy_and_check(file, service)
167
149
  puts "Checking #{file}"
168
150
 
151
+ if !File.exist?("/etc/one/#{file}")
152
+ STDERR.puts "File #{file} not found"
153
+ exit(-1)
154
+ end
155
+
169
156
  temp_file = Tempfile.new("#{file}-temp")
170
157
 
171
158
  scp("/etc/one/#{file}", temp_file.path)
@@ -178,7 +165,7 @@ class Replicator
178
165
  @opennebula_services[service] = true
179
166
  end
180
167
  ensure
181
- temp_file.unlink
168
+ temp_file.unlink if temp_file
182
169
  end
183
170
 
184
171
  # Copy folders