opennebula 6.6.1.1 → 6.6.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d82e15d5ec4c50fc681010bbb3f80be515bb250a074c81f71947af45902e38e
4
- data.tar.gz: 8c45829d942be1ea53f9655950f3338fca21d476c15ff772c99d708abb2a4c42
3
+ metadata.gz: d0911e0ad571781c4b94ee39d8459948d92ef8eb0d95aa9e06387bf402d2abd9
4
+ data.tar.gz: 98c66b223bdf54a82a8d4524288067b9b41045781ff90d4828328db18066d67f
5
5
  SHA512:
6
- metadata.gz: 98d4c469ae9bd579ab84a68f0126d9ea998a4656e9fa3d20c6854db47ef0f224abd0f9820aa227f075dfb8a9877ce520907e6a248825560e053e26d878fd17be
7
- data.tar.gz: 8a745dc0a6e307140d661d23d22e3e1608cb6d14c07454367c61ceeba7f965bef1c2ea3bd1af2c0fab67106270312f511af455cf934dea3eea9bb3fae6d70849
6
+ metadata.gz: 9fc7ce19570b9ee1c5b3047e4d0503bd7028b4cee025fd37b8c42526fbe440fb0398ca2c9ba7a803e524e4fd9415f54c971e6be8aaa16a3513df91677cb1f557
7
+ data.tar.gz: 6e39b6567ce933244ddcedb2700abb82e002ccf3ed6199b78cccd064330fd93e7774d44defa7d6901b6a9d08ffd0abc798cd17f1706088f24897d7efcaaaeef5
@@ -55,7 +55,8 @@ class VirtualMachineDriver < OpenNebulaDriver
55
55
  :update_conf => "UPDATECONF",
56
56
  :resize => "RESIZE",
57
57
  :backup => "BACKUP",
58
- :update_nic => "UPDATENIC"
58
+ :update_nic => "UPDATENIC",
59
+ :backup_cancel=> "BACKUPCANCEL"
59
60
  }
60
61
 
61
62
  POLL_ATTRIBUTE = OpenNebula::VirtualMachine::Driver::POLL_ATTRIBUTE
@@ -104,6 +105,7 @@ class VirtualMachineDriver < OpenNebulaDriver
104
105
  register_action(ACTION[:resize].to_sym, method("resize"))
105
106
  register_action(ACTION[:backup].to_sym, method("backup"))
106
107
  register_action(ACTION[:update_nic].to_sym, method("update_nic"))
108
+ register_action(ACTION[:backup_cancel].to_sym, method("backup_cancel"))
107
109
  end
108
110
 
109
111
  # Decodes the encoded XML driver message received from the core
@@ -248,6 +250,11 @@ class VirtualMachineDriver < OpenNebulaDriver
248
250
  send_message(ACTION[:update_nic],RESULT[:failure],id,error)
249
251
  end
250
252
 
253
+ def backup_cancel(id, drv_message)
254
+ error = "Action not implemented by driver #{self.class}"
255
+ send_message(ACTION[:backup_cancel],RESULT[:failure],id,error)
256
+ end
257
+
251
258
  private
252
259
 
253
260
  # Interface to handle the pending events from the ActionManager Interface
@@ -51,7 +51,7 @@ end
51
51
  module CloudClient
52
52
 
53
53
  # OpenNebula version
54
- VERSION = '6.6.1.1'
54
+ VERSION = '6.6.2'
55
55
 
56
56
  # #########################################################################
57
57
  # Default location for the authentication file
@@ -323,6 +323,9 @@ module OpenNebula
323
323
 
324
324
  template['start_time'] = Integer(Time.now)
325
325
 
326
+ # Replace $attibute by the corresponding value
327
+ resolve_attributes(template)
328
+
326
329
  super(template.to_json, template['name'])
327
330
  end
328
331
 
@@ -660,7 +663,7 @@ module OpenNebula
660
663
  end if deploy
661
664
 
662
665
  # Replace $attibute by the corresponding value
663
- resolve_attributes(body)
666
+ resolve_networks(body)
664
667
 
665
668
  # @body = template.to_hash
666
669
 
@@ -784,31 +787,49 @@ module OpenNebula
784
787
  end
785
788
 
786
789
  # rubocop:disable Layout/LineLength
790
+ def resolve_networks(template)
791
+ template['roles'].each do |role|
792
+ next unless role['vm_template_contents']
793
+
794
+ # $CUSTOM1_VAR Any word character
795
+ # (letter, number, underscore)
796
+ role['vm_template_contents'].scan(/\$(\w+)/).each do |key|
797
+ net = template['networks_values'].find {|att| att.key? key[0] }
798
+
799
+ next if net.nil?
800
+
801
+ role['vm_template_contents'].gsub!(
802
+ '$'+key[0],
803
+ net[net.keys[0]]['id'].to_s
804
+ )
805
+ end
806
+ end
807
+ end
808
+
787
809
  def resolve_attributes(template)
788
810
  template['roles'].each do |role|
789
811
  if role['vm_template_contents']
790
812
  # $CUSTOM1_VAR Any word character
791
813
  # (letter, number, underscore)
792
814
  role['vm_template_contents'].scan(/\$(\w+)/).each do |key|
793
- # Check if $ var value is in custom_attrs_values
794
- if !template['custom_attrs_values'].nil? &&
795
- template['custom_attrs_values'].key?(key[0])
815
+ # Check if $ var value is in custom_attrs_values within the role
816
+ if !role['custom_attrs_values'].nil? && \
817
+ role['custom_attrs_values'].key?(key[0])
796
818
  role['vm_template_contents'].gsub!(
797
819
  '$'+key[0],
798
- template['custom_attrs_values'][key[0]]
820
+ role['custom_attrs_values'][key[0]]
799
821
  )
800
822
  next
801
823
  end
802
824
 
803
- # Check if $ var value is in networks
804
- net = template['networks_values']
805
- .find {|att| att.key? key[0] }
825
+ # Check if $ var value is in custom_attrs_values
806
826
 
807
- next if net.nil?
827
+ next unless !template['custom_attrs_values'].nil? && \
828
+ template['custom_attrs_values'].key?(key[0])
808
829
 
809
830
  role['vm_template_contents'].gsub!(
810
831
  '$'+key[0],
811
- net[net.keys[0]]['id'].to_s
832
+ template['custom_attrs_values'][key[0]]
812
833
  )
813
834
  end
814
835
  end
@@ -42,6 +42,16 @@ module OpenNebula
42
42
  :type => :string,
43
43
  :required => false
44
44
  },
45
+ 'custom_attrs' => {
46
+ :type => :object,
47
+ :properties => {},
48
+ :required => false
49
+ },
50
+ 'custom_attrs_values' => {
51
+ :type => :object,
52
+ :properties => {},
53
+ :required => false
54
+ },
45
55
  'parents' => {
46
56
  :type => :array,
47
57
  :items => {
@@ -487,7 +497,7 @@ module OpenNebula
487
497
  instantiate_template = JSON.parse(@body.to_json)
488
498
  else
489
499
  instantiate_template = JSON.parse(@body.to_json)
490
- .merge(merge_template)
500
+ .deep_merge(merge_template)
491
501
  end
492
502
 
493
503
  begin
@@ -58,7 +58,8 @@ module OpenNebula
58
58
  :attachsg => "vm.attachsg",
59
59
  :detachsg => "vm.detachsg",
60
60
  :backup => "vm.backup",
61
- :updatenic => "vm.updatenic"
61
+ :updatenic => "vm.updatenic",
62
+ :backupcancel => "vm.backupcancel"
62
63
  }
63
64
 
64
65
  VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
@@ -807,6 +808,14 @@ module OpenNebula
807
808
  return @client.call(VM_METHODS[:backup], @pe_id, ds_id, reset)
808
809
  end
809
810
 
811
+ # Cancel ongoing backup operation for the VM
812
+ #
813
+ # @return [nil, OpenNebula::Error] nil in case of sucess, Error
814
+ # otherwise.
815
+ def backup_cancel()
816
+ return @client.call(VM_METHODS[:backupcancel], @pe_id)
817
+ end
818
+
810
819
  ########################################################################
811
820
  # Helpers to get VirtualMachine information
812
821
  ########################################################################
data/lib/opennebula.rb CHANGED
@@ -77,5 +77,5 @@ require 'opennebula/flow'
77
77
  module OpenNebula
78
78
 
79
79
  # OpenNebula version
80
- VERSION = '6.6.1.1'
80
+ VERSION = '6.6.2'
81
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.6.1.1
4
+ version: 6.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-19 00:00:00.000000000 Z
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri