opennebula 6.4.5 → 6.5.80.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ActionManager.rb +1 -1
  3. data/lib/CommandManager.rb +10 -7
  4. data/lib/DriverExecHelper.rb +2 -2
  5. data/lib/OpenNebulaDriver.rb +1 -1
  6. data/lib/VirtualMachineDriver.rb +28 -14
  7. data/lib/cloud/CloudClient.rb +3 -3
  8. data/lib/datacenter.rb +25 -21
  9. data/lib/datastore.rb +4 -4
  10. data/lib/distributed_firewall.rb +1 -1
  11. data/lib/file_helper.rb +2 -2
  12. data/lib/host.rb +3 -3
  13. data/lib/logical_port.rb +1 -1
  14. data/lib/logical_switch.rb +1 -1
  15. data/lib/memoize.rb +1 -1
  16. data/lib/models/role.rb +114 -68
  17. data/lib/models/service.rb +58 -58
  18. data/lib/models.rb +1 -1
  19. data/lib/network.rb +1 -1
  20. data/lib/nsx_client.rb +1 -1
  21. data/lib/nsx_component.rb +1 -1
  22. data/lib/nsx_constants.rb +2 -2
  23. data/lib/nsx_driver.rb +1 -1
  24. data/lib/nsx_error.rb +1 -1
  25. data/lib/nsx_rule.rb +1 -1
  26. data/lib/nsxt_client.rb +1 -1
  27. data/lib/nsxt_dfw.rb +1 -1
  28. data/lib/nsxt_logical_port.rb +1 -1
  29. data/lib/nsxt_rule.rb +1 -1
  30. data/lib/nsxt_tz.rb +1 -1
  31. data/lib/nsxv_client.rb +1 -1
  32. data/lib/nsxv_dfw.rb +1 -1
  33. data/lib/nsxv_logical_port.rb +1 -1
  34. data/lib/nsxv_rule.rb +1 -1
  35. data/lib/nsxv_tz.rb +1 -1
  36. data/lib/opaque_network.rb +1 -1
  37. data/lib/opennebula/acl.rb +1 -1
  38. data/lib/opennebula/acl_pool.rb +1 -1
  39. data/lib/opennebula/client.rb +1 -1
  40. data/lib/opennebula/cluster.rb +1 -1
  41. data/lib/opennebula/cluster_pool.rb +1 -1
  42. data/lib/opennebula/datastore.rb +4 -3
  43. data/lib/opennebula/datastore_pool.rb +1 -1
  44. data/lib/opennebula/document.rb +1 -1
  45. data/lib/opennebula/document_json.rb +1 -1
  46. data/lib/opennebula/document_pool.rb +1 -1
  47. data/lib/opennebula/document_pool_json.rb +1 -1
  48. data/lib/opennebula/error.rb +1 -1
  49. data/lib/opennebula/flow/grammar.rb +1 -1
  50. data/lib/opennebula/flow/service_pool.rb +1 -1
  51. data/lib/opennebula/flow/service_template.rb +22 -22
  52. data/lib/opennebula/flow/service_template_ext.rb +1 -1
  53. data/lib/opennebula/flow/service_template_pool.rb +1 -1
  54. data/lib/opennebula/flow/validator.rb +1 -1
  55. data/lib/opennebula/flow.rb +1 -1
  56. data/lib/opennebula/group.rb +1 -1
  57. data/lib/opennebula/group_pool.rb +1 -1
  58. data/lib/opennebula/hook.rb +1 -1
  59. data/lib/opennebula/hook_log.rb +1 -1
  60. data/lib/opennebula/hook_pool.rb +1 -1
  61. data/lib/opennebula/host.rb +1 -1
  62. data/lib/opennebula/host_pool.rb +1 -1
  63. data/lib/opennebula/image.rb +33 -23
  64. data/lib/opennebula/image_pool.rb +1 -1
  65. data/lib/opennebula/ldap_auth.rb +2 -2
  66. data/lib/opennebula/ldap_auth_spec.rb +1 -1
  67. data/lib/opennebula/lockable_ext.rb +1 -1
  68. data/lib/opennebula/marketplace.rb +1 -1
  69. data/lib/opennebula/marketplace_pool.rb +1 -1
  70. data/lib/opennebula/marketplaceapp.rb +1 -1
  71. data/lib/opennebula/marketplaceapp_ext.rb +4 -4
  72. data/lib/opennebula/marketplaceapp_pool.rb +1 -1
  73. data/lib/opennebula/oneflow_client.rb +1 -1
  74. data/lib/opennebula/pool.rb +1 -1
  75. data/lib/opennebula/pool_element.rb +1 -1
  76. data/lib/opennebula/security_group.rb +1 -1
  77. data/lib/opennebula/security_group_pool.rb +1 -1
  78. data/lib/opennebula/server_cipher_auth.rb +1 -1
  79. data/lib/opennebula/server_x509_auth.rb +1 -1
  80. data/lib/opennebula/ssh_auth.rb +80 -103
  81. data/lib/opennebula/system.rb +1 -1
  82. data/lib/opennebula/template.rb +1 -1
  83. data/lib/opennebula/template_ext.rb +3 -3
  84. data/lib/opennebula/template_pool.rb +1 -1
  85. data/lib/opennebula/user.rb +1 -1
  86. data/lib/opennebula/user_pool.rb +1 -1
  87. data/lib/opennebula/utils.rb +1 -1
  88. data/lib/opennebula/vdc.rb +1 -1
  89. data/lib/opennebula/vdc_pool.rb +1 -1
  90. data/lib/opennebula/virtual_machine.rb +31 -3
  91. data/lib/opennebula/virtual_machine_ext.rb +12 -217
  92. data/lib/opennebula/virtual_machine_pool.rb +1 -1
  93. data/lib/opennebula/virtual_network.rb +33 -4
  94. data/lib/opennebula/virtual_network_pool.rb +1 -1
  95. data/lib/opennebula/virtual_router.rb +1 -1
  96. data/lib/opennebula/virtual_router_pool.rb +1 -1
  97. data/lib/opennebula/vm_group.rb +1 -1
  98. data/lib/opennebula/vm_group_pool.rb +1 -1
  99. data/lib/opennebula/vntemplate.rb +1 -1
  100. data/lib/opennebula/vntemplate_pool.rb +1 -1
  101. data/lib/opennebula/wait_ext.rb +1 -1
  102. data/lib/opennebula/x509_auth.rb +1 -1
  103. data/lib/opennebula/xml_element.rb +1 -1
  104. data/lib/opennebula/xml_pool.rb +1 -1
  105. data/lib/opennebula/xml_utils.rb +1 -1
  106. data/lib/opennebula/zone.rb +1 -1
  107. data/lib/opennebula/zone_pool.rb +1 -1
  108. data/lib/opennebula.rb +2 -2
  109. data/lib/rest_client.rb +18 -14
  110. data/lib/scripts_common.rb +1 -1
  111. data/lib/transport_zone.rb +1 -1
  112. data/lib/vcenter_driver.rb +1 -1
  113. data/lib/vcenter_importer.rb +1 -1
  114. data/lib/vi_client.rb +73 -65
  115. data/lib/vi_helper.rb +1 -1
  116. data/lib/virtual_machine.rb +3 -9
  117. data/lib/virtual_wire.rb +2 -2
  118. data/lib/vm_disk.rb +1 -1
  119. data/lib/vm_folder.rb +1 -1
  120. data/lib/vm_helper.rb +1 -1
  121. data/lib/vm_monitor.rb +1 -1
  122. data/lib/vm_nic.rb +1 -1
  123. data/lib/vm_template.rb +1 -1
  124. metadata +4 -4
@@ -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 #
@@ -56,7 +56,9 @@ module OpenNebula
56
56
  :scheddelete => "vm.scheddelete",
57
57
  :schedupdate => "vm.schedupdate",
58
58
  :attachsg => "vm.attachsg",
59
- :detachsg => "vm.detachsg"
59
+ :detachsg => "vm.detachsg",
60
+ :backup => "vm.backup",
61
+ :updatenic => "vm.updatenic"
60
62
  }
61
63
 
62
64
  VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
@@ -132,6 +134,8 @@ module OpenNebula
132
134
  HOTPLUG_RESIZE
133
135
  HOTPLUG_SAVEAS_UNDEPLOYED
134
136
  HOTPLUG_SAVEAS_STOPPED
137
+ BACKUP
138
+ BACKUP_POWEROFF
135
139
  }
136
140
 
137
141
  SHORT_VM_STATES={
@@ -216,7 +220,9 @@ module OpenNebula
216
220
  "HOTPLUG_NIC_POWEROFF" => "hotp",
217
221
  "HOTPLUG_RESIZE" => "hotp",
218
222
  "HOTPLUG_SAVEAS_UNDEPLOYED" => "hotp",
219
- "HOTPLUG_SAVEAS_STOPPED" => "hotp"
223
+ "HOTPLUG_SAVEAS_STOPPED" => "hotp",
224
+ "BACKUP" => "back",
225
+ "BACKUP_POWEROFF" => "back",
220
226
  }
221
227
 
222
228
  HISTORY_ACTION=%w{none migrate live-migrate shutdown shutdown-hard
@@ -228,6 +234,7 @@ module OpenNebula
228
234
  snapshot-resize snapshot-delete snapshot-revert disk-saveas
229
235
  disk-snapshot-revert recover retry monitor disk-snapshot-rename
230
236
  alias-attach alias-detach poweroff-migrate poweroff-hard-migrate
237
+ backup nic-update
231
238
  }
232
239
 
233
240
  EXTERNAL_IP_ATTRS = [
@@ -462,6 +469,18 @@ module OpenNebula
462
469
  return call(VM_METHODS[:detachnic], @pe_id, nic_id)
463
470
  end
464
471
 
472
+ # Updates a NIC for a running VM
473
+ #
474
+ # @param nic_id [Integer] Id of the NIC to be updated
475
+ # @param nic_template [String] Template with updated attributes
476
+ # @param append [true|false] True to append new attributes instead of
477
+ # replace the whole template
478
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
479
+ # otherwise
480
+ def nic_update(nic_id, nic_template, append = false)
481
+ return call(VM_METHODS[:updatenic], @pe_id, nic_id, nic_template, append ? 1 : 0)
482
+ end
483
+
465
484
  # Attaches a Security Groupt to a running VM
466
485
  #
467
486
  # @param nic_id [Integer] Id of the NIC, where to attach SG
@@ -779,6 +798,15 @@ module OpenNebula
779
798
  sched_template)
780
799
  end
781
800
 
801
+ # Generate a backup for the VM (backup config must be set)
802
+ #
803
+ # @param ds_id [Integer] Id of the datastore to save the backup
804
+ # @return [Integer, OpenNebula::Error] ID of the resulting BACKUP image
805
+ # in case of success, Error otherwise.
806
+ def backup(ds_id, reset = false)
807
+ return @client.call(VM_METHODS[:backup], @pe_id, ds_id, reset)
808
+ end
809
+
782
810
  ########################################################################
783
811
  # Helpers to get VirtualMachine information
784
812
  ########################################################################
@@ -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 #
@@ -47,16 +47,17 @@ module OpenNebula::VirtualMachineExt
47
47
  # @return [Integer, OpenNebula::Error] the new Template ID in case
48
48
  # of success, error otherwise
49
49
  #-------------------------------------------------------------------
50
- REMOVE_VNET_ATTRS = ['AR_ID', 'BRIDGE', 'CLUSTER_ID', 'IP', 'MAC', 'TARGET', 'NIC_ID',
51
- 'NETWORK_ID', 'VN_MAD', 'SECURITY_GROUPS', 'VLAN_ID',
52
- 'BRIDGE_TYPE']
53
-
54
- REMOVE_IMAGE_ATTRS = ['DEV_PREFIX', 'SOURCE', 'ORIGINAL_SIZE', 'SIZE',
55
- 'DISK_SNAPSHOT_TOTAL_SIZE', 'DRIVER', 'IMAGE_STATE', 'SAVE',
56
- 'CLONE', 'READONLY', 'PERSISTENT', 'TARGET', 'ALLOW_ORPHANS',
57
- 'CLONE_TARGET', 'CLUSTER_ID', 'DATASTORE', 'DATASTORE_ID',
58
- 'DISK_ID', 'DISK_TYPE', 'IMAGE_ID', 'IMAGE', 'IMAGE_UNAME',
59
- 'IMAGE_UID', 'LN_TARGET', 'TM_MAD', 'TYPE', 'OPENNEBULA_MANAGED']
50
+ REMOVE_VNET_ATTRS = %w[AR_ID BRIDGE CLUSTER_ID IP MAC TARGET NIC_ID
51
+ NETWORK_ID VN_MAD SECURITY_GROUPS VLAN_ID
52
+ BRIDGE_TYPE]
53
+
54
+ REMOVE_IMAGE_ATTRS = %w[DEV_PREFIX SOURCE ORIGINAL_SIZE SIZE
55
+ DISK_SNAPSHOT_TOTAL_SIZE DRIVER IMAGE_STATE
56
+ SAVE CLONE READONLY PERSISTENT TARGET
57
+ ALLOW_ORPHANS CLONE_TARGET CLUSTER_ID
58
+ DATASTORE DATASTORE_ID DISK_ID DISK_TYPE
59
+ IMAGE_ID IMAGE IMAGE_UNAME IMAGE_UID
60
+ LN_TARGET TM_MAD TYPE OPENNEBULA_MANAGED]
60
61
 
61
62
  def save_as_template(name, desc, opts = {})
62
63
  opts = {
@@ -285,160 +286,6 @@ module OpenNebula::VirtualMachineExt
285
286
  raise
286
287
  end
287
288
 
288
- #-------------------------------------------------------------------
289
- # Backups a VM. TODO Add final description
290
- # @param keep [Bool]
291
- # @param logger[Logger]
292
- # @param binfo[Hash] Oneshot
293
- #-------------------------------------------------------------------
294
- def backup(keep = false, logger = nil, binfo = nil)
295
- # --------------------------------------------------------------
296
- # Check backup consistency
297
- # --------------------------------------------------------------
298
- rc = info
299
-
300
- raise rc.message if OpenNebula.is_error?(rc)
301
-
302
- binfo.merge!(backup_info) do |_key, old_val, new_val|
303
- new_val.nil? ? old_val : new_val
304
- end
305
-
306
- raise 'No backup information' if binfo.nil?
307
-
308
- raise 'No frequency defined' unless valid?(binfo[:freq])
309
-
310
- raise 'No marketplace defined' unless valid?(binfo[:market])
311
-
312
- return if Time.now.to_i - binfo[:last].to_i < binfo[:freq].to_i
313
-
314
- # --------------------------------------------------------------
315
- # Save VM as new template
316
- # --------------------------------------------------------------
317
- logger.info 'Saving VM as template' if logger
318
-
319
- tid = save_as_template(
320
- binfo[:name], '', :poweroff => true, :logger => logger
321
- )
322
-
323
- tmp = OpenNebula::Template.new_with_id(tid, @client)
324
- rc = tmp.info
325
-
326
- raise rc.message if OpenNebula.is_error?(rc)
327
-
328
- # --------------------------------------------------------------
329
- # Import template into Marketplace & update VM info
330
- # --------------------------------------------------------------
331
- logger.info "Importing template #{tmp.id} to marketplace "\
332
- "#{binfo[:market]}" if logger
333
-
334
- tmp.extend(OpenNebula::TemplateExt)
335
-
336
- rc, ids = tmp.mp_import(binfo[:market], true, binfo[:name],
337
- :wait => true, :logger => logger)
338
-
339
- raise rc.message if OpenNebula.is_error?(rc)
340
-
341
- logger.info "Imported app ids: #{ids.join(',')}" if logger
342
-
343
- rc = update(backup_attr(binfo, ids), true)
344
-
345
- if OpenNebula.is_error?(rc)
346
- raise 'Could not update the backup reference: ' \
347
- " #{rc.message}. New backup ids are #{ids.join(',')}."
348
- end
349
-
350
- # --------------------------------------------------------------
351
- # Cleanup
352
- # --------------------------------------------------------------
353
- backup_cleanup(keep, logger, binfo, tmp)
354
- rescue Error, StandardError => e
355
- backup_cleanup(keep, logger, binfo, tmp)
356
-
357
- logger.fatal(e.inspect) if logger
358
-
359
- raise
360
- end
361
-
362
- #-------------------------------------------------------------------
363
- # Restores VM information from previous backup
364
- #
365
- # @param datastore [Integer] Datastore ID to import app backup
366
- # @param logger [Logger] Logger instance to print debug info
367
- #
368
- # @return [Integer] VM ID
369
- #-------------------------------------------------------------------
370
- def restore(datastore, logger = nil)
371
- rc = info
372
-
373
- if OpenNebula.is_error?(rc)
374
- raise "Error getting VM: #{rc.message}"
375
- end
376
-
377
- logger.info 'Reading backup information' if logger
378
-
379
- backup_ids = backup_info[:apps]
380
-
381
- # highest (=last) of the app ids is the template id
382
- app_id = backup_ids.last
383
-
384
- app = OpenNebula::MarketPlaceApp.new_with_id(app_id, @client)
385
- rc = app.info
386
-
387
- if OpenNebula.is_error?(rc)
388
- raise "Can not find appliance #{app_id}: #{rc.message}."
389
- end
390
-
391
- if logger
392
- logger.info "Restoring VM #{self['ID']} from " \
393
- "saved appliance #{app_id}"
394
- end
395
-
396
- app.extend(OpenNebula::MarketPlaceAppExt)
397
-
398
- exp = app.export(:dsid => Integer(datastore),
399
- :name => "#{self['NAME']} - RESTORED")
400
-
401
- if OpenNebula.is_error?(exp)
402
- raise "Can not restore app: #{exp.message}."
403
- end
404
-
405
- # Check possible errors when exporting apps
406
- exp[:image].each do |image|
407
- next unless OpenNebula.is_error?(image)
408
-
409
- raise "Error restoring image: #{image.message}."
410
- end
411
-
412
- template = exp[:vmtemplate].first
413
-
414
- if OpenNebula.is_error?(template)
415
- raise "Error restoring template: #{template.message}."
416
- end
417
-
418
- if logger
419
- logger.info(
420
- "Backup restored, VM template: #{exp[:vmtemplate]}, " \
421
- "images: #{exp[:image]}"
422
- )
423
-
424
- logger.info(
425
- "Instantiating the template #{exp[:vmtemplate]}"
426
- )
427
- end
428
-
429
- tmpl = OpenNebula::Template.new_with_id(template, @client)
430
- rc = tmpl.instantiate
431
-
432
- if OpenNebula.is_error?(rc)
433
- raise "Can not instantiate the template: #{rc.message}."
434
- end
435
-
436
- rc
437
- rescue Error, StandardError => e
438
- logger.fatal(e.inspect) if logger
439
- raise
440
- end
441
-
442
289
  ####################################################################
443
290
  # Private extended interface
444
291
  ####################################################################
@@ -456,58 +303,6 @@ module OpenNebula::VirtualMachineExt
456
303
  !att.nil?
457
304
  end
458
305
 
459
- #-------------------------------------------------------------------
460
- # Get backup information from the VM
461
- #-------------------------------------------------------------------
462
- def backup_info
463
- base = '//USER_TEMPLATE/BACKUP'
464
- binfo = {}
465
-
466
- app_ids = self["#{base}/MARKETPLACE_APP_IDS"] || ''
467
-
468
- binfo[:name] = "#{self['NAME']} - BACKUP " \
469
- " - #{Time.now.strftime('%Y%m%d_%k%M')}"
470
-
471
- binfo[:freq] = self["#{base}/FREQUENCY_SECONDS"]
472
- binfo[:last] = self["#{base}/LAST_BACKUP_TIME"]
473
- binfo[:market] = Integer(self["#{base}/MARKETPLACE_ID"])
474
- binfo[:apps] = app_ids.split(',')
475
-
476
- binfo
477
- rescue StandardError
478
- binfo
479
- end
480
-
481
- #-------------------------------------------------------------------
482
- # Generate backup information string
483
- #-------------------------------------------------------------------
484
- def backup_attr(binfo, ids)
485
- 'BACKUP=[' \
486
- " MARKETPLACE_APP_IDS = \"#{ids.join(',')}\"," \
487
- " FREQUENCY_SECONDS = \"#{binfo[:freq]}\"," \
488
- " LAST_BACKUP_TIME = \"#{Time.now.to_i}\"," \
489
- " MARKETPLACE_ID = \"#{binfo[:market]}\" ]"
490
- end
491
-
492
- #-------------------------------------------------------------------
493
- # Cleanup backup leftovers in case of failure
494
- #-------------------------------------------------------------------
495
- def backup_cleanup(keep, logger, binfo, template)
496
- if template
497
- logger.info "Deleting template #{template.id}" if logger
498
-
499
- template.delete(true)
500
- end
501
-
502
- binfo[:apps].each do |id|
503
- logger.info "Deleting appliance #{id}" if logger
504
-
505
- papp = OpenNebula::MarketPlaceApp.new_with_id(id, @client)
506
-
507
- papp.delete
508
- end if !keep && binfo[:apps]
509
- end
510
-
511
306
  end
512
307
  end
513
308
 
@@ -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 #
@@ -44,7 +44,7 @@ module OpenNebula
44
44
  :recover => "vn.recover"
45
45
  }
46
46
 
47
- VN_STATES=%w{INIT READY LOCK_CREATE LOCK_DELETE DONE ERROR}
47
+ VN_STATES=%w{INIT READY LOCK_CREATE LOCK_DELETE DONE ERROR UPDATE_FAILURE}
48
48
 
49
49
  SHORT_VN_STATES={
50
50
  "INIT" => "init",
@@ -52,7 +52,8 @@ module OpenNebula
52
52
  "LOCK_CREATE" => "lock",
53
53
  "LOCK_DELETE" => "lock",
54
54
  "DONE" => "done",
55
- "ERROR" => "err"
55
+ "ERROR" => "err",
56
+ "UPDATE_FAILURE"=> "fail"
56
57
  }
57
58
 
58
59
  # Creates a VirtualNetwork description with just its identifier
@@ -326,7 +327,7 @@ module OpenNebula
326
327
  # Recovers an stuck Virtual Network
327
328
  #
328
329
  # @param result [Integer] Recover with failure (0), success (1),
329
- # delete (2)
330
+ # delete (2), retry (3)
330
331
  # @return [nil, OpenNebula::Error] nil in case of success, Error
331
332
  # otherwise
332
333
  def recover(result)
@@ -377,6 +378,34 @@ module OpenNebula
377
378
  SHORT_VN_STATES[state_str]
378
379
  end
379
380
 
381
+ # Returns three arrays with the numeric VM IDs for VMs updated,
382
+ # outdated (include updating) and error
383
+ def vm_ids
384
+ updated = Array.new
385
+
386
+ self.each('UPDATED_VMS/ID') do |id|
387
+ updated << id.text.to_i
388
+ end
389
+
390
+ outdated = Array.new
391
+
392
+ self.each('OUTDATED_VMS/ID') do |id|
393
+ outdated << id.text.to_i
394
+ end
395
+
396
+ self.each('UPDATING_VMS/ID') do |id|
397
+ outdated << id.text.to_i
398
+ end
399
+
400
+ error = Array.new
401
+
402
+ self.each('ERROR_VMS/ID') do |id|
403
+ error << id.text.to_i
404
+ end
405
+
406
+ [updated, outdated, error]
407
+ end
408
+
380
409
  private
381
410
  def set_publish(published)
382
411
  group_u = published ? 1 : 0
@@ -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 #
@@ -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 #
data/lib/opennebula.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 #
@@ -77,5 +77,5 @@ require 'opennebula/flow'
77
77
  module OpenNebula
78
78
 
79
79
  # OpenNebula version
80
- VERSION = '6.4.5'
80
+ VERSION = '6.5.80'
81
81
  end
data/lib/rest_client.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 #
@@ -69,21 +69,25 @@ module VCenterDriver
69
69
  end
70
70
 
71
71
  def self.new_from_host(host_id)
72
- client = OpenNebula::Client.new
73
- host = OpenNebula::Host.new_with_id(host_id, client)
74
- rc = host.info(true)
75
- if OpenNebula.is_error?(rc)
76
- raise "Could not get host info for ID: \
77
- #{host_id} - #{rc.message}"
78
- end
72
+ begin
73
+ client = OpenNebula::Client.new
74
+ host = OpenNebula::Host.new_with_id(host_id, client)
75
+ rc = host.info(true)
76
+ if OpenNebula.is_error?(rc)
77
+ raise "Could not get host info for ID: \
78
+ #{host_id} - #{rc.message}"
79
+ end
79
80
 
80
- connection = {
81
- :hostname => host['TEMPLATE/VCENTER_HOST'],
82
- :username => host['TEMPLATE/VCENTER_USER'],
83
- :password => host['TEMPLATE/VCENTER_PASSWORD']
84
- }
81
+ connection = {
82
+ :hostname => host['TEMPLATE/VCENTER_HOST'],
83
+ :username => host['TEMPLATE/VCENTER_USER'],
84
+ :password => host['TEMPLATE/VCENTER_PASSWORD']
85
+ }
85
86
 
86
- new(connection)
87
+ new(connection)
88
+ rescue StandardError => e
89
+ raise e
90
+ end
87
91
  end
88
92
 
89
93
  def get_or_create_tag(
@@ -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 #