opennebula 6.2.1 → 6.3.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 (125) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ActionManager.rb +1 -1
  3. data/lib/CommandManager.rb +1 -1
  4. data/lib/DriverExecHelper.rb +1 -1
  5. data/lib/OpenNebulaDriver.rb +1 -1
  6. data/lib/VirtualMachineDriver.rb +1 -1
  7. data/lib/cloud/CloudClient.rb +3 -3
  8. data/lib/datacenter.rb +1 -1
  9. data/lib/datastore.rb +2 -2
  10. data/lib/distributed_firewall.rb +1 -1
  11. data/lib/file_helper.rb +2 -2
  12. data/lib/host.rb +4 -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 +1 -1
  17. data/lib/models/service.rb +98 -56
  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 +1 -1
  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 +7 -3
  51. data/lib/opennebula/flow/service_template.rb +7 -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 +13 -5
  62. data/lib/opennebula/host_pool.rb +1 -1
  63. data/lib/opennebula/image.rb +1 -1
  64. data/lib/opennebula/image_pool.rb +1 -1
  65. data/lib/opennebula/ldap_auth.rb +1 -1
  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 +158 -33
  72. data/lib/opennebula/marketplaceapp_pool.rb +1 -1
  73. data/lib/opennebula/oneflow_client.rb +53 -26
  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 +27 -2
  91. data/lib/opennebula/virtual_machine_ext.rb +1 -1
  92. data/lib/opennebula/virtual_machine_pool.rb +1 -1
  93. data/lib/opennebula/virtual_network.rb +39 -2
  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 +1 -1
  110. data/lib/scripts_common.rb +6 -1
  111. data/lib/transport_zone.rb +1 -1
  112. data/lib/vcenter_driver.rb +1 -1
  113. data/lib/vcenter_importer.rb +10 -12
  114. data/lib/vi_client.rb +1 -1
  115. data/lib/vi_helper.rb +18 -3
  116. data/lib/virtual_machine.rb +21 -12
  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 +5 -1
  122. data/lib/vm_nic.rb +1 -1
  123. data/lib/vm_template.rb +60 -4
  124. data/lib/vmm_importer.rb +10 -7
  125. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 630fc82258e06265dd9308385f987452c2c9e97774f9c844567eb0512c699996
4
- data.tar.gz: 4b19ee5faf356fc61ba4e8883dc7bb37137d54d34c251c6f0cbbfab5a8b0b27b
3
+ metadata.gz: 9037eadf643ff9e3cb8745aea4cbfe59d88fec16905216f170123da1670cda30
4
+ data.tar.gz: 6171ac7fbd6f35e063204eb4a7c35ae4ec5afb0e548d2558623a7095f9a008cf
5
5
  SHA512:
6
- metadata.gz: ea3eba7d99bfc70cb7b94a2c8c2548b130d50ec3cf73d3344e0ed12a05b2e83780eec32e4790cfeef00bde6a38164468a0cfe91bb62cd1325c20aac7f9cca235
7
- data.tar.gz: eeb5c702a03ef47f5ad8e37f95b94259e49019a78d5b58f8ce560d3b2afd50cb8828a7512afe14b1f3e25e262ab3b3974f9174e3109a20a98d89140a90fbca96
6
+ metadata.gz: 30d60c2a1447a38a642d4bb93792df47ce39c520a7255fbaa2fd49a445885cc0cd4b28662f9cf45e8d730a3cc7f16db1901489662149a1121c623df35250b5ea
7
+ data.tar.gz: 5de0e5c492f708e3e56869c6e8b3aea9cfa05c78a5945f84a32884d0a9be5f347e3d35d3b08289c26084a245aa758071a07bf7231e8ef71c7806a97d9e3dbdad
data/lib/ActionManager.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- */
2
- # Copyright 2002-2021, 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-2021, 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,6 +1,6 @@
1
1
  # rubocop:disable Naming/FileName
2
2
  # -------------------------------------------------------------------------- #
3
- # Copyright 2002-2021, 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-2021, 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-2021, 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-2021, 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.2.1'
54
+ VERSION = '6.3.85'
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-2021, 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-2021, 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/datastore.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, 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 #
@@ -561,7 +561,7 @@ module VCenterDriver
561
561
  rescue StandardError => e
562
562
  message = "Could not find file. Reason: \"#{e.message}\"."
563
563
  if VCenterDriver::CONFIG[:debug_information]
564
- message += ' ' + e.backtrace
564
+ message += ' ' + e.backtrace.to_s
565
565
  end
566
566
  raise message
567
567
  end
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, 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-2021, 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 #
@@ -98,7 +98,7 @@ module VCenterDriver
98
98
  end
99
99
 
100
100
  def self.get_type(file)
101
- type = `file -b --mime-type #{file}`
101
+ type = `file -P bytes=256 -b --mime-type #{file}`
102
102
  if $?.exitstatus != 0 # rubocop:disable Style/SpecialGlobalVars
103
103
  STDERR.puts "Can not read file #{file}"
104
104
  exit(-1)
data/lib/host.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, 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 #
@@ -712,7 +712,7 @@ module VCenterDriver
712
712
 
713
713
  # Only take care of VMs, not templates
714
714
  if !hashed_properties['config.template']
715
- vms[r.obj._ref] = hashed_properties
715
+ vms[r.obj._ref + '_' + vc_uuid] = hashed_properties
716
716
  vm_objects << r.obj
717
717
  end
718
718
  end
@@ -802,7 +802,8 @@ module VCenterDriver
802
802
  found_vm =
803
803
  host_vms
804
804
  .select do |vm|
805
- vm['DEPLOY_ID'].eql? vm_ref
805
+ vm['DEPLOY_ID'] == vm_ref ||
806
+ vm['DEPLOY_ID'] == VIHelper.get_deploy_id(vm_ref)
806
807
  end.first
807
808
  id = found_vm['ID'] if found_vm
808
809
 
data/lib/logical_port.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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 #
@@ -24,17 +24,21 @@ module OpenNebula
24
24
  DOCUMENT_TYPE = 100
25
25
 
26
26
  STATE = {
27
- 'PENDING' => 0,
28
- 'DEPLOYING' => 1,
29
- 'RUNNING' => 2,
30
- 'UNDEPLOYING' => 3,
31
- 'WARNING' => 4,
32
- 'DONE' => 5,
33
- 'FAILED_UNDEPLOYING' => 6,
34
- 'FAILED_DEPLOYING' => 7,
35
- 'SCALING' => 8,
36
- 'FAILED_SCALING' => 9,
37
- 'COOLDOWN' => 10
27
+ 'PENDING' => 0,
28
+ 'DEPLOYING' => 1,
29
+ 'RUNNING' => 2,
30
+ 'UNDEPLOYING' => 3,
31
+ 'WARNING' => 4,
32
+ 'DONE' => 5,
33
+ 'FAILED_UNDEPLOYING' => 6,
34
+ 'FAILED_DEPLOYING' => 7,
35
+ 'SCALING' => 8,
36
+ 'FAILED_SCALING' => 9,
37
+ 'COOLDOWN' => 10,
38
+ 'DEPLOYING_NETS' => 11,
39
+ 'UNDEPLOYING_NETS' => 12,
40
+ 'FAILED_DEPLOYING_NETS' => 13,
41
+ 'FAILED_UNDEPLOYING_NETS' => 14
38
42
  }
39
43
 
40
44
  STATE_STR = %w[
@@ -49,6 +53,10 @@ module OpenNebula
49
53
  SCALING
50
54
  FAILED_SCALING
51
55
  COOLDOWN
56
+ DEPLOYING_NETS
57
+ UNDEPLOYING_NETS
58
+ FAILED_DEPLOYING_NETS
59
+ FAILED_UNDEPLOYING_NETS
52
60
  ]
53
61
 
54
62
  TRANSIENT_STATES = %w[
@@ -56,12 +64,16 @@ module OpenNebula
56
64
  UNDEPLOYING
57
65
  SCALING
58
66
  COOLDOWN
67
+ DEPLOYING_NETS
68
+ UNDEPLOYING_NETS
59
69
  ]
60
70
 
61
71
  FAILED_STATES = %w[
62
72
  FAILED_DEPLOYING
63
73
  FAILED_UNDEPLOYING
64
74
  FAILED_SCALING
75
+ FAILED_DEPLOYING_NETS
76
+ FAILED_UNDEPLOYING_NETS
65
77
  ]
66
78
 
67
79
  RECOVER_DEPLOY_STATES = %w[
@@ -73,6 +85,7 @@ module OpenNebula
73
85
  RECOVER_UNDEPLOY_STATES = %w[
74
86
  FAILED_UNDEPLOYING
75
87
  UNDEPLOYING
88
+ FAILED_UNDEPLOYING_NETS
76
89
  ]
77
90
 
78
91
  RECOVER_SCALE_STATES = %w[
@@ -80,6 +93,13 @@ module OpenNebula
80
93
  SCALING
81
94
  ]
82
95
 
96
+ RECOVER_DEPLOY_NETS_STATES = %w[DEPLOYING_NETS FAILED_DEPLOYING_NETS]
97
+
98
+ RECOVER_UNDEPLOY_NETS_STATES = %w[
99
+ UNDEPLOYING_NETS
100
+ FAILED_UNDEPLOYING_NETS
101
+ ]
102
+
83
103
  # List of attributes that can't be changed in update operation
84
104
  #
85
105
  # custom_attrs: it only has sense when deploying, not in running
@@ -168,6 +188,14 @@ module OpenNebula
168
188
  RECOVER_SCALE_STATES.include? STATE_STR[state]
169
189
  end
170
190
 
191
+ def can_recover_deploy_nets?
192
+ RECOVER_DEPLOY_NETS_STATES.include?(STATE_STR[state])
193
+ end
194
+
195
+ def can_recover_undeploy_nets?
196
+ RECOVER_UNDEPLOY_NETS_STATES.include?(STATE_STR[state])
197
+ end
198
+
171
199
  # Return true if the service is running
172
200
  # @return true if the service is runnning, false otherwise
173
201
  def running?
@@ -237,6 +265,24 @@ module OpenNebula
237
265
  true
238
266
  end
239
267
 
268
+ # Returns virtual networks IDs
269
+ # @return [Array] Array of integers containing the IDs
270
+ def networks(deploy)
271
+ ret = []
272
+
273
+ return ret unless @body['networks_values']
274
+
275
+ @body['networks_values'].each do |vnet|
276
+ vnet.each do |_, net|
277
+ next if net.keys.first == 'id' && !deploy
278
+
279
+ ret << net['id'].to_i
280
+ end
281
+ end
282
+
283
+ ret
284
+ end
285
+
240
286
  # Create a new service based on the template provided
241
287
  # @param [String] template_json
242
288
  # @return [nil, OpenNebula::Error] nil in case of success, Error
@@ -570,17 +616,22 @@ module OpenNebula
570
616
 
571
617
  return if body['networks_values'].nil?
572
618
 
573
- body['networks_values'].each do |net|
574
- rc = create_vnet(net) if net[net.keys[0]].key?('template_id')
575
-
576
- if OpenNebula.is_error?(rc)
577
- return rc
578
- end
619
+ body['networks_values'].each do |vnet|
620
+ vnet.each do |name, net|
621
+ key = net.keys.first
622
+
623
+ case key
624
+ when 'id'
625
+ next
626
+ when 'template_id'
627
+ rc = create_vnet(name, net)
628
+ when 'reserve_from'
629
+ rc = reserve(name, net)
630
+ end
579
631
 
580
- rc = reserve(net) if net[net.keys[0]].key?('reserve_from')
632
+ return rc if OpenNebula.is_error?(rc)
581
633
 
582
- if OpenNebula.is_error?(rc)
583
- return rc
634
+ net['id'] = rc
584
635
  end
585
636
  end if deploy
586
637
 
@@ -593,22 +644,25 @@ module OpenNebula
593
644
  end
594
645
 
595
646
  def delete_networks
596
- vnets = @body['networks_values']
647
+ vnets = @body['networks_values']
597
648
  vnets_failed = []
598
649
 
599
650
  return if vnets.nil?
600
651
 
601
652
  vnets.each do |vnet|
602
- next unless vnet[vnet.keys[0]].key?('template_id') ||
603
- vnet[vnet.keys[0]].key?('reserve_from')
653
+ vnet.each do |_, net|
654
+ key = net.keys.first
604
655
 
605
- vnet_id = vnet[vnet.keys[0]]['id'].to_i
656
+ next unless %w[template_id reserve_from].include?(key)
606
657
 
607
- rc = OpenNebula::VirtualNetwork
608
- .new_with_id(vnet_id, @client).delete
658
+ rc = OpenNebula::VirtualNetwork.new_with_id(
659
+ net['id'],
660
+ @client
661
+ ).delete
609
662
 
610
- if OpenNebula.is_error?(rc)
611
- vnets_failed << vnet_id
663
+ next unless OpenNebula.is_error?(rc)
664
+
665
+ vnets_failed << net['id']
612
666
  end
613
667
  end
614
668
 
@@ -677,44 +731,32 @@ module OpenNebula
677
731
  @body['log'] = @body['log'].last(MAX_LOG)
678
732
  end
679
733
 
680
- def create_vnet(net)
734
+ def create_vnet(name, net)
681
735
  extra = ''
736
+ extra = net['extra'] if net.key? 'extra'
682
737
 
683
- extra = net[net.keys[0]]['extra'] if net[net.keys[0]].key? 'extra'
684
-
685
- vntmpl_id = OpenNebula::VNTemplate
686
- .new_with_id(net[net.keys[0]]['template_id']
687
- .to_i, @client).instantiate(get_vnet_name(net), extra)
688
-
689
- # TODO, check which error should be returned
690
- return vntmpl_id if OpenNebula.is_error?(vntmpl_id)
691
-
692
- net[net.keys[0]]['id'] = vntmpl_id
693
-
694
- true
738
+ OpenNebula::VNTemplate.new_with_id(
739
+ net['template_id'].to_i,
740
+ @client
741
+ ).instantiate(get_vnet_name(name), extra)
695
742
  end
696
743
 
697
- def reserve(net)
698
- get_vnet_name(net)
699
- extra = net[net.keys[0]]['extra'] if net[net.keys[0]].key? 'extra'
744
+ def reserve(name, net)
745
+ extra = ''
746
+ extra = net['extra'] if net.key? 'extra'
700
747
 
701
748
  return false if !extra || extra.empty?
702
749
 
703
- extra.concat("\nNAME=\"#{get_vnet_name(net)}\"\n")
704
-
705
- reserve_id = OpenNebula::VirtualNetwork
706
- .new_with_id(net[net.keys[0]]['reserve_from']
707
- .to_i, @client).reserve_with_extra(extra)
750
+ extra.concat("\nNAME=\"#{get_vnet_name(name)}\"\n")
708
751
 
709
- return reserve_id if OpenNebula.is_error?(reserve_id)
710
-
711
- net[net.keys[0]]['id'] = reserve_id
712
-
713
- true
752
+ OpenNebula::VirtualNetwork.new_with_id(
753
+ net['reserve_from'].to_i,
754
+ @client
755
+ ).reserve_with_extra(extra)
714
756
  end
715
757
 
716
758
  def get_vnet_name(net)
717
- "#{net.keys[0]}-#{id}"
759
+ "#{net}-#{id}"
718
760
  end
719
761
 
720
762
  def resolve_attributes(template)
data/lib/models.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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-2021, 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 #