opennebula-cli 6.4.7 → 6.5.80.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/bin/oneacct +2 -2
  3. data/bin/oneacl +1 -1
  4. data/bin/onecluster +1 -1
  5. data/bin/onedatastore +1 -1
  6. data/bin/oneflow +2 -3
  7. data/bin/oneflow-template +2 -2
  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 +2 -2
  18. data/bin/onetemplate +1 -1
  19. data/bin/oneuser +4 -4
  20. data/bin/onevcenter +2 -2
  21. data/bin/onevdc +1 -1
  22. data/bin/onevm +146 -161
  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 +6 -2
  28. data/lib/cli_helper.rb +20 -20
  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 +2 -2
  35. data/lib/one_helper/oneflowtemplate_helper.rb +2 -2
  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 +15 -60
  39. data/lib/one_helper/oneimage_helper.rb +73 -12
  40. data/lib/one_helper/onemarket_helper.rb +1 -1
  41. data/lib/one_helper/onemarketapp_helper.rb +3 -3
  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 -2
  45. data/lib/one_helper/oneuser_helper.rb +1 -1
  46. data/lib/one_helper/onevcenter_helper.rb +7 -7
  47. data/lib/one_helper/onevdc_helper.rb +1 -1
  48. data/lib/one_helper/onevm_helper.rb +68 -57
  49. data/lib/one_helper/onevmgroup_helper.rb +1 -1
  50. data/lib/one_helper/onevnet_helper.rb +37 -3
  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 +7 -8
  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 +5 -38
  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 +26 -26
data/bin/onevm CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
5
5
  # #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
7
7
  # not use this file except in compliance with the License. You may obtain #
@@ -195,32 +195,6 @@ CommandParser::CmdParser.new(ARGV) do
195
195
  :description => 'lock all actions'
196
196
  }
197
197
 
198
- LOGGER = {
199
- :name => 'logger',
200
- :large => '--logger logger',
201
- :format => String,
202
- :description => 'Set logger to STDOUT or FILE'
203
- }
204
-
205
- KEEP = {
206
- :name => 'keep',
207
- :large => '--keep-backup',
208
- :description => 'Keep previous backup when creating a new one'
209
- }
210
-
211
- ONESHOT = {
212
- :name => 'oneshot',
213
- :large => '--oneshot',
214
- :description => 'Take an snapshot of the VM without saving backup info'
215
- }
216
-
217
- MARKET = {
218
- :name => 'market',
219
- :large => '--market market_id',
220
- :format => Integer,
221
- :description => 'Market to save oneshot'
222
- }
223
-
224
198
  NIC_ID = {
225
199
  :name => 'nic_id',
226
200
  :large => '--nic-id nic_id',
@@ -249,8 +223,42 @@ CommandParser::CmdParser.new(ARGV) do
249
223
  :description => 'VNC client to use'
250
224
  }
251
225
 
226
+ PCI = {
227
+ :name => 'pci',
228
+ :large => '--pci short_address',
229
+ :format => String,
230
+ :description => 'Select PCI device by its short address'
231
+ }
232
+
233
+ PCI_DEVICE = {
234
+ :name => 'pci_device',
235
+ :large => '--pci_device device ID',
236
+ :format => String,
237
+ :description => 'Select PCI device by its device ID'
238
+ }
239
+
240
+ PCI_VENDOR = {
241
+ :name => 'pci_vendor',
242
+ :large => '--pci_vendor vendor ID',
243
+ :format => String,
244
+ :description => 'Select PCI device by its vendor ID'
245
+ }
246
+
247
+ PCI_CLASS = {
248
+ :name => 'pci_class',
249
+ :large => '--pci_class class ID',
250
+ :format => String,
251
+ :description => 'Select PCI device by its class ID'
252
+ }
253
+
254
+ RESET_BACKUP = {
255
+ :name => 'reset',
256
+ :large => '--reset',
257
+ :description => 'Creates a new backup image, from a new full backup (only for incremental)'
258
+ }
259
+
252
260
  OpenNebulaHelper::TEMPLATE_OPTIONS_VM.delete_if do |v|
253
- ['as_gid', 'as_uid'].include?(v[:name])
261
+ %w[as_gid as_uid].include?(v[:name])
254
262
  end
255
263
 
256
264
  ########################################################################
@@ -713,7 +721,7 @@ CommandParser::CmdParser.new(ARGV) do
713
721
  end
714
722
 
715
723
  resume_desc = <<-EOT.unindent
716
- Resumes the execution of a saved VM
724
+ Resumes the execution of the a saved VM
717
725
 
718
726
  States: STOPPED, SUSPENDED, UNDEPLOYED, POWEROFF, UNKNOWN
719
727
  EOT
@@ -747,7 +755,7 @@ CommandParser::CmdParser.new(ARGV) do
747
755
  States for success/failure recovers: Any ACTIVE state.
748
756
  States for a retry recover: Any *FAILURE state
749
757
  States for delete: Any
750
- States for recreate: Any but DONE/POWEROFF/SUSPENDED
758
+ States for delete-recreate: Any but STOP/UNDEPLOYED
751
759
  States for delete-db: Any
752
760
  EOT
753
761
 
@@ -853,8 +861,11 @@ CommandParser::CmdParser.new(ARGV) do
853
861
  end
854
862
 
855
863
  nic_attach_desc = <<-EOT.unindent
856
- Attaches a NIC to a running VM. When using --file add only one
857
- NIC instance.
864
+ Attaches a NIC to a VM. When using --file add only one NIC instance.
865
+
866
+ To hotplug a PCI device and use it as a NIC interface in the VM select
867
+ it with --pci (short_address) or --pci_device (device ID),
868
+ --pci_class (class ID) and/or --pci_vendor (vendor ID).
858
869
 
859
870
  To attach a nic alias, use --file or --alias option.
860
871
 
@@ -866,7 +877,11 @@ CommandParser::CmdParser.new(ARGV) do
866
877
  OneVMHelper::NETWORK,
867
878
  OneVMHelper::IP,
868
879
  OneVMHelper::ALIAS,
869
- OneVMHelper::NIC_NAME] do
880
+ OneVMHelper::NIC_NAME,
881
+ PCI,
882
+ PCI_CLASS,
883
+ PCI_VENDOR,
884
+ PCI_DEVICE] do
870
885
  if options[:file].nil? && options[:network].nil?
871
886
  STDERR.puts 'Provide a template file or a network:'
872
887
  STDERR.puts "\t--file <file>"
@@ -878,36 +893,36 @@ CommandParser::CmdParser.new(ARGV) do
878
893
  template = File.read(options[:file])
879
894
  else
880
895
  network_id = options[:network]
881
- ip = options[:ip]
882
- nic_alias = options[:alias]
883
- nic_name = options[:nic_name]
884
-
885
- if ip
886
- if !nic_alias && !nic_name
887
- template = "NIC = [ NETWORK_ID = #{network_id}, \
888
- IP = #{ip} ]"
889
- elsif !nic_alias && nic_name
890
- template = "NIC = [ NETWORK_ID = #{network_id},
891
- IP = #{ip},
892
- NAME = #{nic_name} ]"
893
- else
894
- template = "NIC_ALIAS = \
895
- [ NETWORK_ID = #{network_id},\
896
- IP = #{ip},\
897
- PARENT = #{nic_alias} ]"
898
- end
896
+ ip = options[:ip]
897
+ nic_alias = options[:alias]
898
+ nic_name = options[:nic_name]
899
+
900
+ is_pci = [:pci, :pci_device, :pci_vendor, :pci_class].any? do |o|
901
+ !options[o].nil?
902
+ end
903
+
904
+ if is_pci
905
+ pcia = options[:pci]
906
+ pcid = options[:pci_device]
907
+ pcic = options[:pci_class]
908
+ pciv = options[:pci_vendor]
909
+
910
+ template = 'PCI = [ TYPE = NIC'
911
+ template << ", NETWORK_ID = #{network_id}"
912
+ template << ", SHORT_ADDRESS = \"#{pcia}\"" if pcia
913
+ template << ", DEVICE = \"#{pcid}\"" if pcid
914
+ template << ", CLASS = \"#{pcic}\"" if pcic
915
+ template << ", VENDOR = \"#{pciv}\"" if pciv
916
+ elsif nic_alias
917
+ template = "NIC_ALIAS = [ PARENT = #{nic_alias}"
918
+ template << ", NETWORK_ID = #{network_id}"
899
919
  else
900
- if !nic_alias && !nic_name
901
- template = "NIC = [ NETWORK_ID = #{network_id} ]"
902
- elsif !nic_alias && nic_name
903
- template = "NIC = [ NETWORK_ID = #{network_id},
904
- NAME = #{nic_name} ]"
905
- else
906
- template = "NIC_ALIAS = \
907
- [ NETWORK_ID = #{network_id},\
908
- PARENT = #{nic_alias} ]"
909
- end
920
+ template = "NIC = [ NETWORK_ID = #{network_id}"
910
921
  end
922
+
923
+ template << ", IP = #{ip}" if ip
924
+ template << ", NAME = #{nic_name}" if nic_name
925
+ template << ']'
911
926
  end
912
927
 
913
928
  helper.perform_action(args[0], options, 'Attaching NIC') do |vm|
@@ -929,6 +944,40 @@ CommandParser::CmdParser.new(ARGV) do
929
944
  end
930
945
  end
931
946
 
947
+ nic_update_desc = <<-EOT.unindent
948
+ Updates a NIC for a VM. In case the VM is running, trigger NIC update on the host.
949
+
950
+ States: Almost all, except BOOT*, MIGRATE and HOTPLUG-NIC
951
+ EOT
952
+
953
+ command :"nic-update", nic_update_desc, :vmid, :nicid,
954
+ [:file, nil], :options => OpenNebulaHelper::APPEND do
955
+ vm_id = args[0].to_i
956
+ nic_id = args[1].to_i
957
+ file = args[2]
958
+ helper.perform_action(vm_id, options, 'Updating VM NIC') do |obj|
959
+ if options[:append]
960
+ str = OpenNebulaHelper
961
+ .append_template(vm_id, obj, file,
962
+ "TEMPLATE/NIC[NIC_ID=#{nic_id}]")
963
+ else
964
+ str = OpenNebulaHelper
965
+ .update_template(vm_id, obj, file,
966
+ "TEMPLATE/NIC[NIC_ID=#{nic_id}]")
967
+ end
968
+
969
+ # Ensure the updated attributes are in NIC section
970
+ unless str.gsub(' ', '').match(/NIC=\[/)
971
+ str = "NIC=[\n#{str.split("\n").join(",\n")}]"
972
+ end
973
+
974
+ helper.set_client(options)
975
+ obj = helper.retrieve_resource(obj.id)
976
+
977
+ obj.nic_update(nic_id, str, options[:append])
978
+ end
979
+ end
980
+
932
981
  sg_attach_desc = <<-EOT.unindent
933
982
  Attaches a Security Group to a VM.
934
983
 
@@ -1252,10 +1301,6 @@ CommandParser::CmdParser.new(ARGV) do
1252
1301
 
1253
1302
  if options[:xml]
1254
1303
  puts pool.to_xml
1255
- elsif options[:json]
1256
- puts JSON.pretty_generate(pool.to_hash)
1257
- elsif options[:yaml]
1258
- puts pool.to_hash.to_yaml
1259
1304
  else
1260
1305
  table.show(pool.to_hash, options)
1261
1306
  end
@@ -1285,7 +1330,8 @@ CommandParser::CmdParser.new(ARGV) do
1285
1330
  end
1286
1331
 
1287
1332
  resize_desc = <<-EOT.unindent
1288
- Resizes the capacity of a Virtual Machine
1333
+ Resizes the capacity of a Virtual Machine (offline, the VM cannot be
1334
+ RUNNING)
1289
1335
 
1290
1336
  EOT
1291
1337
 
@@ -1343,8 +1389,8 @@ CommandParser::CmdParser.new(ARGV) do
1343
1389
  updateconf_desc = <<-EOT.unindent
1344
1390
  Updates the configuration of a VM. Valid states are: running, pending,
1345
1391
  failure, poweroff, undeploy, hold or cloning.
1346
- In running state only changes in CONTEXT take effect immediately,
1347
- other values may need a VM restart.
1392
+ In running state only changes in CONTEXT and BACKUP_CONFIG take effect
1393
+ immediately, other values may need a VM restart.
1348
1394
 
1349
1395
  This command accepts a template file or opens an editor, the full list of
1350
1396
  configuration attributes are:
@@ -1355,6 +1401,7 @@ CommandParser::CmdParser.new(ARGV) do
1355
1401
  GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
1356
1402
  RAW = ["DATA", "DATA_VMX", "TYPE", "VALIDATE"]
1357
1403
  CPU_MODEL = ["MODEL"]
1404
+ BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE"]
1358
1405
  CONTEXT (any value, **variable substitution will be made**)
1359
1406
  EOT
1360
1407
 
@@ -1379,10 +1426,15 @@ CommandParser::CmdParser.new(ARGV) do
1379
1426
  exit(-1)
1380
1427
  end
1381
1428
 
1429
+ backup = vm.template_like_str('BACKUPS', true,
1430
+ 'BACKUP_CONFIG')
1382
1431
  template = vm.template_like_str('TEMPLATE', true,
1383
1432
  'OS | FEATURES | INPUT | '\
1384
1433
  'GRAPHICS | RAW | CONTEXT | '\
1385
1434
  'CPU_MODEL')
1435
+
1436
+ template << "\n" << backup
1437
+
1386
1438
  template = OpenNebulaHelper.editor_input(template)
1387
1439
  end
1388
1440
 
@@ -1455,12 +1507,10 @@ CommandParser::CmdParser.new(ARGV) do
1455
1507
  charters.each do |action, time|
1456
1508
  sched = "+#{time[:time].to_i + acc_t + diff_stime}"
1457
1509
 
1458
- rc = helper.schedule_actions([args[0]].flatten,
1459
- { :schedule => sched },
1460
- action.to_s,
1461
- time[:warning][:time] + acc_w)
1462
-
1463
- exit(-1) if rc < 0
1510
+ helper.schedule_actions([args[0]].flatten,
1511
+ { :schedule => sched },
1512
+ action.to_s,
1513
+ time[:warning][:time] + acc_w)
1464
1514
 
1465
1515
  acc_t += time[:time].to_i
1466
1516
  acc_w += time[:warning][:time].to_i
@@ -1502,108 +1552,43 @@ CommandParser::CmdParser.new(ARGV) do
1502
1552
  end
1503
1553
 
1504
1554
  backup_vm_desc = <<-EOT.unindent
1505
- Creates a VM backup and stores it in the marketplace
1555
+ Creates a VM backup on the given datastore
1556
+
1557
+ States: RUNNING, POWEROFF
1506
1558
  EOT
1507
1559
 
1508
1560
  command :backup,
1509
1561
  backup_vm_desc,
1510
1562
  :vmid,
1511
- :options => [LOGGER, KEEP, ONESHOT, MARKET] do
1512
- require 'logger'
1513
-
1514
- if options.key?(:oneshot) && !options.key?(:market)
1515
- STDERR.puts 'ERROR: no market given'
1516
- exit(-1)
1517
- end
1518
-
1519
- helper.perform_action(args[0], options, 'Backup') do |vm|
1520
- vm.extend(OpenNebula::VirtualMachineExt)
1521
-
1522
- # Read user options
1523
- if options[:verbose]
1524
- log_to = STDOUT
1525
- elsif !options[:logger].nil?
1526
- log_to = options[:logger]
1527
- end
1528
-
1529
- keep = options.key?(:keep)
1530
-
1531
- if log_to
1532
- logger = Logger.new(log_to)
1533
- format = '%Y-%m-%d %H:%M:%S'
1534
-
1535
- logger.formatter = proc do |severity, datetime, _p, msg|
1536
- "#{datetime.strftime(format)} " \
1537
- "#{severity.ljust(5)} : #{msg}\n"
1538
- end
1539
- end
1540
-
1541
- binfo = {}
1542
- binfo[:market] = options[:market]
1543
-
1544
- if options.key?(:oneshot)
1545
- binfo[:name] = "VM #{vm.id} BACKUP - " \
1546
- "#{Time.now.strftime('%Y%m%d_%k%M')}"
1547
- binfo[:freq] = 1
1548
- binfo[:last] = Time.now.to_i - 100
1549
- end
1550
-
1551
- begin
1552
- rc = vm.backup(keep, logger, binfo)
1553
-
1554
- if OpenNebula.is_error?(rc)
1555
- STDERR.puts rc.message
1556
- exit(-1)
1557
- else
1558
- 0
1559
- end
1560
- rescue StandardError => e
1561
- STDERR.puts e
1562
- exit(-1)
1563
- end
1564
- end
1565
- end
1566
-
1567
- restore_vm_desc = <<-EOT.unindent
1568
- Restores a VM from a previous backup
1569
- EOT
1570
-
1571
- command :restore,
1572
- restore_vm_desc,
1573
- :vmid,
1574
- :options => [OneDatastoreHelper::DATASTORE, LOGGER] do
1575
- require 'logger'
1576
-
1577
- unless options[:datastore]
1578
- STDERR.puts 'ERROR: no datastore given'
1563
+ :options => [RESET_BACKUP,
1564
+ OneDatastoreHelper::DATASTORE,
1565
+ OneVMHelper::SCHEDULE,
1566
+ OneVMHelper::WEEKLY,
1567
+ OneVMHelper::MONTHLY,
1568
+ OneVMHelper::YEARLY,
1569
+ OneVMHelper::HOURLY,
1570
+ OneVMHelper::END_TIME] do
1571
+ if options[:datastore].nil?
1572
+ STDERR.puts 'Datastore to save the backup is mandatory: '
1573
+ STDERR.puts "\t -d datastore_id | name"
1579
1574
  exit(-1)
1580
1575
  end
1581
1576
 
1582
- helper.perform_action(args[0], options, 'Restore') do |vm|
1583
- vm.extend(OpenNebula::VirtualMachineExt)
1577
+ reset = options[:reset] == true
1584
1578
 
1585
- # If logger is specified use it, if not use STDOUT
1586
- options[:logger].nil? ? log_to = STDOUT : log_to = options[:logger]
1587
- logger = Logger.new(log_to)
1588
- format = '%Y-%m-%d %H:%M:%S'
1579
+ if !options[:schedule].nil?
1580
+ options[:args] = options[:datastore]
1589
1581
 
1590
- logger.formatter = proc do |severity, datetime, _p, msg|
1591
- "#{datetime.strftime(format)} #{severity.ljust(5)} : #{msg}\n"
1592
- end
1582
+ helper.schedule_actions([args[0]], options, @comm_name)
1583
+ else
1593
1584
 
1594
- begin
1595
- rc = vm.restore(options[:datastore], logger)
1585
+ helper.perform_action(args[0], options, 'Backup') do |vm|
1586
+ rc = vm.backup(options[:datastore], reset)
1596
1587
 
1597
1588
  if OpenNebula.is_error?(rc)
1598
- STDERR.puts rc.message
1589
+ STDERR.puts "Error creating VM backup: #{rc.message}"
1599
1590
  exit(-1)
1600
- else
1601
- puts "ID: #{rc}"
1602
- 0
1603
1591
  end
1604
- rescue StandardError => e
1605
- STDERR.puts e
1606
- exit(-1)
1607
1592
  end
1608
1593
  end
1609
1594
  end
data/bin/onevmgroup CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
5
5
  # #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
7
7
  # not use this file except in compliance with the License. You may obtain #
data/bin/onevnet CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
5
5
  # #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
7
7
  # not use this file except in compliance with the License. You may obtain #
@@ -114,6 +114,13 @@ CommandParser::CmdParser.new(ARGV) do
114
114
  :description => 'No recover action possible, delete the Virtual Network'
115
115
  }
116
116
 
117
+ RETRY = {
118
+ :name => 'retry',
119
+ :large => '--retry',
120
+ :description => 'Recover a Virtual Network by retrying the last ' \
121
+ 'failed action'
122
+ }
123
+
117
124
  ########################################################################
118
125
  # Global Options
119
126
  ########################################################################
@@ -363,6 +370,8 @@ CommandParser::CmdParser.new(ARGV) do
363
370
  update_desc = <<-EOT.unindent
364
371
  Update the template contents. If a path is not provided the editor will
365
372
  be launched to modify the current content.
373
+
374
+ Note: Triggers Virtual Machine updates for used leases.
366
375
  EOT
367
376
 
368
377
  command :update, update_desc, :vnetid, [:file, nil],
@@ -456,19 +465,22 @@ CommandParser::CmdParser.new(ARGV) do
456
465
  YOU NEED TO MANUALLY CHECK THE VN STATUS, to decide if the
457
466
  operation was successful or not, or if it can be retried.
458
467
 
459
- States for success/failure recovers: LOCK_CREATE, LOCK_DELETE state.
460
- States for a retry recover: LOCK_CREATE, LOCK_DELETE state
468
+ States for success recovers: LOCK_CREATE, LOCK_DELETE, UPDATE_FAILURE state.
469
+ States for failure recovers: LOCK_CREATE, LOCK_DELETE state.
470
+ States for a retry recover: UPDATE_FAILURE
461
471
  States for delete: Any but READY
462
472
  EOT
463
473
 
464
474
  command :recover, recover_desc, [:range, :vmid_list],
465
- :options => [SUCCESS, FAILURE, DELETE] do
475
+ :options => [SUCCESS, FAILURE, DELETE, RETRY] do
466
476
  if !options[:success].nil?
467
477
  result = 1
468
478
  elsif !options[:failure].nil?
469
479
  result = 0
470
480
  elsif !options[:delete].nil?
471
481
  result = 2
482
+ elsif !options[:retry].nil?
483
+ result = 3
472
484
  else
473
485
  error_message = <<-EOT.unindent
474
486
  Need to specify the result of the pending action.
data/bin/onevntemplate CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
5
5
  # #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
7
7
  # not use this file except in compliance with the License. You may obtain #
data/bin/onevrouter CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
5
5
  # #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
7
7
  # not use this file except in compliance with the License. You may obtain #
data/bin/onezone CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
5
5
  # #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
7
7
  # not use this file except in compliance with the License. You may obtain #
@@ -246,11 +246,15 @@ CommandParser::CmdParser.new(ARGV) do
246
246
 
247
247
  command :serversync, sync_desc, :server, :options => [DATABASE] do
248
248
  begin
249
+ # Suppress augeas require warning message
250
+ $VERBOSE = nil
251
+
252
+ gem 'augeas', '~> 0.6'
249
253
  require 'augeas'
250
254
  rescue Gem::LoadError
251
255
  STDERR.puts(
252
256
  'Augeas gem is not installed, run `gem install ' \
253
- 'opennebula-augeas` to install it'
257
+ 'augeas -v \'0.6\'` to install it'
254
258
  )
255
259
  exit(-1)
256
260
  end
data/lib/cli_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 #
@@ -20,7 +20,7 @@ require 'csv'
20
20
  module CLIHelper
21
21
 
22
22
  # Available operators for filtering operations
23
- FILTER_OPS = ['=', '!=', '<', '<=', '>', '>=', '~']
23
+ FILTER_OPS = %w[= != < <= > >= ~]
24
24
 
25
25
  # CLI general options
26
26
  LIST = {
@@ -182,23 +182,23 @@ module CLIHelper
182
182
  ANSI_YELLOW = "\33[33m"
183
183
 
184
184
  # CLI states
185
- OK_STATES = ['runn', 'rdy', 'on', 'SUCCESS', 'RUNNING']
186
- BAD_STATES = ['fail',
187
- 'err',
188
- 'error',
189
- 'ERROR',
190
- 'FAILED_DEPLOYING',
191
- 'FAILED_DEPLOYING_NETS',
192
- 'FAILED_UNDEPLOYING',
193
- 'FAILED_UNDEPLOYING_NETS',
194
- 'FAILED_SCALING']
195
- REGULAR_STATES = ['PENDING',
196
- 'DEPLOYING',
197
- 'DEPLOYING_NETS',
198
- 'UNDEPLOYING',
199
- 'UNDEPLOYING_NETS',
200
- 'CONFIGURING',
201
- 'WARNING']
185
+ OK_STATES = %w[runn rdy on SUCCESS RUNNING]
186
+ BAD_STATES = %w[fail
187
+ err
188
+ error
189
+ ERROR
190
+ FAILED_DEPLOYING
191
+ FAILED_DEPLOYING_NETS
192
+ FAILED_UNDEPLOYING
193
+ FAILED_UNDEPLOYING_NETS
194
+ FAILED_SCALING]
195
+ REGULAR_STATES = %w[PENDING
196
+ DEPLOYING
197
+ DEPLOYING_NETS
198
+ UNDEPLOYING
199
+ UNDEPLOYING_NETS
200
+ CONFIGURING
201
+ WARNING]
202
202
 
203
203
  # Set state color
204
204
  #
@@ -809,7 +809,7 @@ module CLIHelper
809
809
  # @param options [Hash] Object with CLI user options
810
810
  def update_columns(options)
811
811
  begin
812
- if @conf && File.exist?(@conf)
812
+ if @conf
813
813
  config = YAML.load_file(@conf)
814
814
  else
815
815
  config = {}
@@ -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 #