opennebula-cli 5.11.90.pre → 5.12.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,6 @@
13
13
  # See the License for the specific language governing permissions and #
14
14
  # limitations under the License. #
15
15
  #--------------------------------------------------------------------------- #
16
-
17
16
  require 'one_helper'
18
17
  require 'one_helper/onevm_helper'
19
18
 
@@ -215,6 +214,71 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
215
214
  orphans
216
215
  end
217
216
 
217
+ # Update VNet address range
218
+ #
219
+ # @param vnet_id [Intenger] Virtual Network ID
220
+ # @param ar_id [Intenger] Address Range ID
221
+ # @param file [String] Path to file to read
222
+ # @param options [Hash] User CLI options
223
+ def update_ar(vnet_id, ar_id, file, options)
224
+ perform_action(vnet_id, options, 'AR updated') do |obj|
225
+ rc = obj.info
226
+
227
+ if OpenNebula.is_error?(rc)
228
+ STDERR.puts rc.message
229
+ exit(-1)
230
+ end
231
+
232
+ obj.delete_element("AR_POOL/AR[AR_ID!=#{ar_id}]")
233
+ obj.delete_element('AR_POOL/AR/LEASES')
234
+ obj.delete_element('AR_POOL/AR/USED_LEASES')
235
+ obj.delete_element('AR_POOL/AR/MAC_END')
236
+ obj.delete_element('AR_POOL/AR/IP_END')
237
+ obj.delete_element('AR_POOL/AR/IP6_ULA')
238
+ obj.delete_element('AR_POOL/AR/IP6_ULA_END')
239
+ obj.delete_element('AR_POOL/AR/IP6_GLOBAL')
240
+ obj.delete_element('AR_POOL/AR/IP6_GLOBAL_END')
241
+
242
+ if obj.template_like_str('AR_POOL').empty?
243
+ STDERR.puts "Address Range #{ar_id} does not exist for " \
244
+ "Virtual Network #{vnet_id}"
245
+ exit(-1)
246
+ end
247
+
248
+ xpath = "AR_POOL/AR[AR_ID=#{ar_id}]"
249
+
250
+ if options[:append]
251
+ str = OpenNebulaHelper.append_template(vnet_id,
252
+ obj,
253
+ file,
254
+ xpath)
255
+ else
256
+ str = OpenNebulaHelper.update_template(vnet_id,
257
+ obj,
258
+ file,
259
+ xpath)
260
+ end
261
+
262
+ if options[:append]
263
+ # Insert element in current template
264
+ parts = obj.template_like_str('AR_POOL').split("\n")
265
+
266
+ # Insert it in second position, OpenNebula will sort it
267
+ parts.insert(1, "#{str.strip},")
268
+
269
+ parts = parts.join("\n")
270
+ str = parts
271
+ else
272
+ # Use the information from user
273
+ unless str.gsub(' ', '').match(/AR=\[/)
274
+ str = "AR=[\n#{str.split("\n").join(",\n")}]"
275
+ end
276
+ end
277
+
278
+ obj.update_ar(str)
279
+ end
280
+ end
281
+
218
282
  private
219
283
 
220
284
  def factory(id=nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.11.90.pre
4
+ version: 5.12.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-01 00:00:00.000000000 Z
11
+ date: 2021-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opennebula
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.11.90.pre
19
+ version: 5.12.0.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.11.90.pre
26
+ version: 5.12.0.4
27
27
  description: Commands used to talk to OpenNebula
28
28
  email: contact@opennebula.io
29
29
  executables:
@@ -123,9 +123,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - '>'
126
+ - - '>='
127
127
  - !ruby/object:Gem::Version
128
- version: 1.3.1
128
+ version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
131
  rubygems_version: 2.0.14.1