opennebula 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 (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 +1 -1
  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 +1 -1
  10. data/lib/distributed_firewall.rb +1 -1
  11. data/lib/file_helper.rb +1 -1
  12. data/lib/host.rb +2 -2
  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 +48 -2
  17. data/lib/models/service.rb +1 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  81. data/lib/opennebula/system.rb +1 -1
  82. data/lib/opennebula/template.rb +1 -1
  83. data/lib/opennebula/template_ext.rb +1 -1
  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 +1 -207
  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 +1 -1
  117. data/lib/virtual_wire.rb +1 -1
  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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5f6ca2f486dd7127edf5b9320376397e778f33335e3d9403b6fa2f2b96fc2cd
4
- data.tar.gz: 0101d985b9b7d4bc22499a3a2478b54a98fdb6d1384a235f66515851fab9f399
3
+ metadata.gz: 5cb427e39e8e2f581076e069b21c0da24b5e82dac56e29b0e7017c7e419b3a31
4
+ data.tar.gz: 59203c99872a0065565a336a0bc814f5f7f9acd15a79bcdf3e1df9c92f3b5209
5
5
  SHA512:
6
- metadata.gz: 619e3110a10dcb5959009b1c077685448b38cae6cd8e5bb2e53ff1ec3d922d660e6e91be9d17012f5046ea5b9055697399a80ddbb7b7408fd9fedb196c46e0fa
7
- data.tar.gz: 12561af3a0ceffd756e90da166dba0625444118cf137ebb9d781f034175b330ee4d0cd8fe99997285ac0ee55c51af58acca4ec9dea0f494f4a27d3b22301eede
6
+ metadata.gz: c20a43d2ade283e63fda2143c9fb8fc2d88f7191e81f75f17219d0d625c99f587f6aea2517dfde44d1dd65aea08c65fa349518045a58df2f912d3d7bc5afb197
7
+ data.tar.gz: 7e4f2365737cf9746b91834ff0af8cb01ff7dc198b5f143686d483f6c9aa927df6cbac4e4226682ce599c5afea85be716e2cb21dc2144986e288f8f2f33e5bbb
data/lib/ActionManager.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
  # Licensed under the Apache License, Version 2.0 (the "License"); you may */
4
4
  # not use this file except in compliance with the License. You may obtain */
5
5
  # a copy of the License at */
@@ -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
@@ -212,19 +212,22 @@ end
212
212
  # Executes commands in a remote machine ussing ssh. See documentation
213
213
  # for GenericCommand
214
214
  class SSHCommand < GenericCommand
215
- attr_accessor :host
215
+
216
+ attr_accessor :host, :ssh_opts
216
217
 
217
218
  # Creates a command and runs it
218
- def self.run(command, host, logger=nil, stdin=nil, timeout=nil)
219
- cmd=self.new(command, host, logger, stdin, timeout)
219
+ def self.run(command, host, logger=nil, stdin=nil, timeout=nil, ssh_opts='')
220
+ cmd=self.new(command, host, logger, stdin, timeout, ssh_opts)
220
221
  cmd.run
221
222
  cmd
222
223
  end
223
224
 
224
225
  # This one takes another parameter. +host+ is the machine
225
226
  # where the command is going to be executed
226
- def initialize(command, host, logger=nil, stdin=nil, timeout=nil)
227
+ def initialize(command, host, logger=nil, stdin=nil, timeout=nil, ssh_opts='')
227
228
  @host=host
229
+ @ssh_opts = ssh_opts
230
+
228
231
  super(command, logger, stdin, timeout)
229
232
  end
230
233
 
@@ -232,10 +235,10 @@ private
232
235
 
233
236
  def execute
234
237
  if @stdin
235
- capture3_timeout("ssh #{@host} #{@command}",
238
+ capture3_timeout("ssh #{@ssh_opts} #{@host} #{@command}",
236
239
  :pgroup => true, :stdin_data => @stdin)
237
240
  else
238
- capture3_timeout("ssh -n #{@host} #{@command}",
241
+ capture3_timeout("ssh -n #{@ssh_opts} #{@host} #{@command}",
239
242
  :pgroup => true)
240
243
  end
241
244
  end
@@ -1,6 +1,6 @@
1
1
  # rubocop:disable Naming/FileName
2
2
  # -------------------------------------------------------------------------- #
3
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
3
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
4
4
  # #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
6
6
  # 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 #
@@ -53,7 +53,9 @@ class VirtualMachineDriver < OpenNebulaDriver
53
53
  :resize_disk => "RESIZEDISK",
54
54
  :update_sg => "UPDATESG",
55
55
  :update_conf => "UPDATECONF",
56
- :resize => "RESIZE"
56
+ :resize => "RESIZE",
57
+ :backup => "BACKUP",
58
+ :update_nic => "UPDATENIC"
57
59
  }
58
60
 
59
61
  POLL_ATTRIBUTE = OpenNebula::VirtualMachine::Driver::POLL_ATTRIBUTE
@@ -76,23 +78,23 @@ class VirtualMachineDriver < OpenNebulaDriver
76
78
 
77
79
  super(directory, @options)
78
80
 
79
- @hosts = Array.new
80
-
81
- register_action(ACTION[:deploy].to_sym, method("deploy"))
82
- register_action(ACTION[:shutdown].to_sym, method("shutdown"))
83
- register_action(ACTION[:reboot].to_sym, method("reboot"))
84
- register_action(ACTION[:reset].to_sym, method("reset"))
85
- register_action(ACTION[:cancel].to_sym, method("cancel"))
86
- register_action(ACTION[:save].to_sym, method("save"))
87
- register_action(ACTION[:restore].to_sym, method("restore"))
88
- register_action(ACTION[:migrate].to_sym, method("migrate"))
89
- register_action(ACTION[:poll].to_sym, method("poll"))
81
+ @hosts = Array.new
82
+
83
+ register_action(ACTION[:deploy].to_sym, method("deploy"))
84
+ register_action(ACTION[:shutdown].to_sym, method("shutdown"))
85
+ register_action(ACTION[:reboot].to_sym, method("reboot"))
86
+ register_action(ACTION[:reset].to_sym, method("reset"))
87
+ register_action(ACTION[:cancel].to_sym, method("cancel"))
88
+ register_action(ACTION[:save].to_sym, method("save"))
89
+ register_action(ACTION[:restore].to_sym, method("restore"))
90
+ register_action(ACTION[:migrate].to_sym, method("migrate"))
91
+ register_action(ACTION[:poll].to_sym, method("poll"))
90
92
  register_action(ACTION[:attach_disk].to_sym, method("attach_disk"))
91
93
  register_action(ACTION[:detach_disk].to_sym, method("detach_disk"))
92
94
  register_action(ACTION[:snapshot_create].to_sym, method("snapshot_create"))
93
95
  register_action(ACTION[:snapshot_revert].to_sym, method("snapshot_revert"))
94
96
  register_action(ACTION[:snapshot_delete].to_sym, method("snapshot_delete"))
95
- register_action(ACTION[:cleanup].to_sym, method("cleanup"))
97
+ register_action(ACTION[:cleanup].to_sym, method("cleanup"))
96
98
  register_action(ACTION[:attach_nic].to_sym, method("attach_nic"))
97
99
  register_action(ACTION[:detach_nic].to_sym, method("detach_nic"))
98
100
  register_action(ACTION[:disk_snapshot_create].to_sym, method("disk_snapshot_create"))
@@ -100,6 +102,8 @@ class VirtualMachineDriver < OpenNebulaDriver
100
102
  register_action(ACTION[:update_sg].to_sym, method("update_sg"))
101
103
  register_action(ACTION[:update_conf].to_sym, method("update_conf"))
102
104
  register_action(ACTION[:resize].to_sym, method("resize"))
105
+ register_action(ACTION[:backup].to_sym, method("backup"))
106
+ register_action(ACTION[:update_nic].to_sym, method("update_nic"))
103
107
  end
104
108
 
105
109
  # Decodes the encoded XML driver message received from the core
@@ -234,6 +238,16 @@ class VirtualMachineDriver < OpenNebulaDriver
234
238
  send_message(ACTION[:resize],RESULT[:failure],id,error)
235
239
  end
236
240
 
241
+ def backup(id, drv_message)
242
+ error = "Action not implemented by driver #{self.class}"
243
+ send_message(ACTION[:backup],RESULT[:failure],id,error)
244
+ end
245
+
246
+ def update_nic(id, drv_message)
247
+ error = "Action not implemented by driver #{self.class}"
248
+ send_message(ACTION[:update_nic],RESULT[:failure],id,error)
249
+ end
250
+
237
251
  private
238
252
 
239
253
  # Interface to handle the pending events from the ActionManager Interface
@@ -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 #
@@ -51,7 +51,7 @@ end
51
51
  module CloudClient
52
52
 
53
53
  # OpenNebula version
54
- VERSION = '6.4.3'
54
+ VERSION = '6.5.80'
55
55
 
56
56
  # #########################################################################
57
57
  # Default location for the authentication file
@@ -229,7 +229,7 @@ module CloudCLI
229
229
  def version_text
230
230
  version=<<EOT
231
231
  OpenNebula #{CloudClient::VERSION}
232
- Copyright 2002-2023, OpenNebula Project, OpenNebula Systems
232
+ Copyright 2002-2022, OpenNebula Project, OpenNebula Systems
233
233
 
234
234
  Licensed under the Apache License, Version 2.0 (the "License"); you may
235
235
  not use this file except in compliance with the License. You may obtain
data/lib/datacenter.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 #
@@ -929,26 +929,30 @@ module VCenterDriver
929
929
  spec.configSpec.maxMtu = mtu
930
930
 
931
931
  # The DVS must be created in the networkFolder of the datacenter
932
- dvs_creation_task = @item
933
- .networkFolder
934
- .CreateDVS_Task(
935
- :spec => spec
936
- )
937
- dvs_creation_task.wait_for_completion
938
-
939
- # If task finished successfuly we rename the uplink portgroup
940
- dvs = nil
941
- if dvs_creation_task.info.state == 'success'
942
- dvs = dvs_creation_task.info.result
943
- dvs
944
- .config
945
- .uplinkPortgroup[0]
946
- .Rename_Task(
947
- :newName => "#{switch_name}-uplink-pg"
948
- ).wait_for_completion
949
- else
950
- raise "The Distributed vSwitch #{switch_name} \
951
- could not be created. "
932
+ begin
933
+ dvs_creation_task = @item
934
+ .networkFolder
935
+ .CreateDVS_Task(
936
+ :spec => spec
937
+ )
938
+ dvs_creation_task.wait_for_completion
939
+
940
+ # If task finished successfuly we rename the uplink portgroup
941
+ dvs = nil
942
+ if dvs_creation_task.info.state == 'success'
943
+ dvs = dvs_creation_task.info.result
944
+ dvs
945
+ .config
946
+ .uplinkPortgroup[0]
947
+ .Rename_Task(
948
+ :newName => "#{switch_name}-uplink-pg"
949
+ ).wait_for_completion
950
+ else
951
+ raise "The Distributed vSwitch #{switch_name} \
952
+ could not be created. "
953
+ end
954
+ rescue StandardError => e
955
+ raise e
952
956
  end
953
957
 
954
958
  @net_rollback << {
data/lib/datastore.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 #
@@ -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/file_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 #
data/lib/host.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 #
@@ -233,7 +233,7 @@ module VCenterDriver
233
233
  end
234
234
 
235
235
  nxs_type = @one_item['TEMPLATE/NSX_TYPE']
236
- return unless nxs_type == NSXDriver::NSXConstants::NSXT
236
+ unless nxs_type == NSXDriver::NSXConstants::NSXT; return; end
237
237
 
238
238
  # URL to test a connection
239
239
  url = '/api/v1/transport-zones'
data/lib/logical_port.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 #
@@ -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/memoize.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 #
data/lib/models/role.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 #
@@ -455,6 +455,9 @@ module OpenNebula
455
455
  extra_template << "\nSERVICE_ID = #{@service.id}"
456
456
  extra_template << "\nROLE_NAME = \"#{@body['name']}\""
457
457
 
458
+ # Evaluate attributes with parent roles
459
+ evaluate(extra_template)
460
+
458
461
  n_nodes.times do
459
462
  vm_name = @@vm_name_template
460
463
  .gsub('$SERVICE_ID', @service.id.to_s)
@@ -1122,7 +1125,7 @@ module OpenNebula
1122
1125
  # Min is a hard limit, if the current cardinality + adjustment does
1123
1126
  # not reach it, the difference is added
1124
1127
 
1125
- max = [cardinality, max_cardinality.to_i].max
1128
+ max = [cardinality, max_cardinality.to_i].max()
1126
1129
  # min = [cardinality(), min_cardinality.to_i].min()
1127
1130
  min = min_cardinality.to_i
1128
1131
 
@@ -1168,6 +1171,49 @@ module OpenNebula
1168
1171
  new_cardinality
1169
1172
  end
1170
1173
 
1174
+ # Evaluate rules that references to parent roles
1175
+ #
1176
+ # @param template [String] Role template with $ to replace
1177
+ def evaluate(template)
1178
+ client = service.client
1179
+
1180
+ template.scan(/\$\{(.*?)\}/).flatten.each do |value|
1181
+ s_value = value.split('.') # 0 -> parent, 1..N -> XPATH
1182
+
1183
+ # If parent not found, instead of error, replace it by blank
1184
+ unless parents.include?(s_value[0])
1185
+ template.gsub!("${#{value}}", '')
1186
+ next
1187
+ end
1188
+
1189
+ found = false
1190
+ p_nodes = service.roles[s_value[0]].nodes
1191
+ xpath = "//#{s_value[1..-1].join('/').upcase}"
1192
+
1193
+ # Iterate over parent nodes to find the XPATH on their template
1194
+ p_nodes.each do |node|
1195
+ id = node['deploy_id']
1196
+ vm = OpenNebula::VirtualMachine.new_with_id(id, client)
1197
+
1198
+ # If error continue searching in other nodes
1199
+ next if OpenNebula.is_error?(vm.info)
1200
+
1201
+ next unless vm[xpath]
1202
+
1203
+ template.gsub!("${#{value}}", vm[xpath])
1204
+
1205
+ # If found, continue with next expression
1206
+ found = true
1207
+ break
1208
+ end
1209
+
1210
+ next if found
1211
+
1212
+ # If value not found, replace it by blank to avoid issues
1213
+ template.gsub!("${#{value}}", '')
1214
+ end
1215
+ end
1216
+
1171
1217
  end
1172
1218
 
1173
1219
  end
@@ -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/models.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 #
data/lib/network.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 #
data/lib/nsx_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 #
data/lib/nsx_component.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 #
data/lib/nsx_constants.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 #
data/lib/nsx_driver.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 #
data/lib/nsx_error.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 #
data/lib/nsx_rule.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 #
data/lib/nsxt_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 #
data/lib/nsxt_dfw.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 #
@@ -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/nsxt_rule.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 #
data/lib/nsxt_tz.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 #
data/lib/nsxv_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 #
data/lib/nsxv_dfw.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 #
@@ -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/nsxv_rule.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 #
data/lib/nsxv_tz.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 #
@@ -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 #
@@ -34,12 +34,13 @@ module OpenNebula
34
34
  :enable => "datastore.enable"
35
35
  }
36
36
 
37
- DATASTORE_TYPES=%w{IMAGE SYSTEM FILE}
37
+ DATASTORE_TYPES=%w{IMAGE SYSTEM FILE BACKUP}
38
38
 
39
39
  SHORT_DATASTORE_TYPES = {
40
40
  "IMAGE" => "img",
41
41
  "SYSTEM"=> "sys",
42
- "FILE" => "fil"
42
+ "FILE" => "fil",
43
+ "BACKUP"=> "bck"
43
44
  }
44
45
 
45
46
  DATASTORE_STATES=%w{READY DISABLED}