opennebula 6.0.1 → 6.1.90.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.
- checksums.yaml +4 -4
- data/lib/CommandManager.rb +13 -16
- data/lib/DriverExecHelper.rb +12 -22
- data/lib/cloud/CloudClient.rb +1 -1
- data/lib/datacenter.rb +71 -35
- data/lib/datastore.rb +6 -2
- data/lib/distributed_firewall.rb +17 -4
- data/lib/file_helper.rb +4 -0
- data/lib/host.rb +4 -4
- data/lib/models/role.rb +13 -37
- data/lib/models/service.rb +70 -19
- data/lib/network.rb +7 -1
- data/lib/nsx_client.rb +17 -4
- data/lib/nsx_constants.rb +18 -5
- data/lib/nsx_driver.rb +15 -2
- data/lib/nsx_rule.rb +17 -4
- data/lib/nsxt_client.rb +17 -4
- data/lib/nsxv_client.rb +17 -4
- data/lib/opennebula/flow/service_template.rb +23 -5
- data/lib/opennebula/ldap_auth.rb +3 -1
- data/lib/opennebula/marketplace.rb +30 -2
- data/lib/opennebula/pool.rb +7 -5
- data/lib/opennebula/server_cipher_auth.rb +6 -3
- data/lib/opennebula/virtual_machine.rb +42 -8
- data/lib/opennebula/virtual_machine_ext.rb +35 -17
- data/lib/opennebula/wait_ext.rb +92 -78
- data/lib/opennebula/zone.rb +40 -1
- data/lib/opennebula.rb +1 -1
- data/lib/scripts_common.rb +1 -10
- data/lib/vcenter_driver.rb +14 -12
- data/lib/vcenter_importer.rb +5 -3
- data/lib/virtual_machine.rb +59 -12
- data/lib/vm_monitor.rb +0 -2
- data/lib/vm_template.rb +12 -6
- data/lib/vmm_importer.rb +8 -0
- metadata +5 -5
data/lib/nsx_constants.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# a copy of the License at #
|
7
7
|
# #
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
9
|
-
#
|
9
|
+
# #
|
10
10
|
# Unless required by applicable law or agreed to in writing, software #
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
@@ -29,14 +29,27 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
# rubocop: disable all
|
33
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
34
|
+
if File.directory?(GEMS_LOCATION)
|
35
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
36
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
37
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
38
|
+
|
39
|
+
# Suppress warnings from Rubygems
|
40
|
+
# https://github.com/OpenNebula/one/issues/5379
|
41
|
+
begin
|
42
|
+
verb = $VERBOSE
|
43
|
+
$VERBOSE = nil
|
36
44
|
require 'rubygems'
|
37
45
|
Gem.use_paths(real_gems_path)
|
46
|
+
ensure
|
47
|
+
$VERBOSE = verb
|
38
48
|
end
|
39
49
|
end
|
50
|
+
end
|
51
|
+
# %%RUBYGEMS_SETUP_END%%
|
52
|
+
# rubocop: enable all
|
40
53
|
|
41
54
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
42
55
|
|
data/lib/nsx_driver.rb
CHANGED
@@ -36,14 +36,27 @@ end
|
|
36
36
|
|
37
37
|
ENV['LANG'] = 'C'
|
38
38
|
|
39
|
+
# rubocop: disable all
|
40
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
39
41
|
if File.directory?(GEMS_LOCATION)
|
40
42
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
41
43
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
42
44
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
43
|
-
|
44
|
-
|
45
|
+
|
46
|
+
# Suppress warnings from Rubygems
|
47
|
+
# https://github.com/OpenNebula/one/issues/5379
|
48
|
+
begin
|
49
|
+
verb = $VERBOSE
|
50
|
+
$VERBOSE = nil
|
51
|
+
require 'rubygems'
|
52
|
+
Gem.use_paths(real_gems_path)
|
53
|
+
ensure
|
54
|
+
$VERBOSE = verb
|
55
|
+
end
|
45
56
|
end
|
46
57
|
end
|
58
|
+
# %%RUBYGEMS_SETUP_END%%
|
59
|
+
# rubocop: enable all
|
47
60
|
|
48
61
|
$LOAD_PATH << LIB_LOCATION + '/ruby'
|
49
62
|
$LOAD_PATH << LIB_LOCATION + '/ruby/nsx_driver'
|
data/lib/nsx_rule.rb
CHANGED
@@ -33,14 +33,27 @@ module NSXDriver
|
|
33
33
|
unless defined?(GEMS_LOCATION)
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
# rubocop: disable all
|
37
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
38
|
+
if File.directory?(GEMS_LOCATION)
|
39
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
40
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
41
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
42
|
+
|
43
|
+
# Suppress warnings from Rubygems
|
44
|
+
# https://github.com/OpenNebula/one/issues/5379
|
45
|
+
begin
|
46
|
+
verb = $VERBOSE
|
47
|
+
$VERBOSE = nil
|
40
48
|
require 'rubygems'
|
41
49
|
Gem.use_paths(real_gems_path)
|
50
|
+
ensure
|
51
|
+
$VERBOSE = verb
|
42
52
|
end
|
43
53
|
end
|
54
|
+
end
|
55
|
+
# %%RUBYGEMS_SETUP_END%%
|
56
|
+
# rubocop: enable all
|
44
57
|
|
45
58
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
46
59
|
|
data/lib/nsxt_client.rb
CHANGED
@@ -29,14 +29,27 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
# rubocop: disable all
|
33
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
34
|
+
if File.directory?(GEMS_LOCATION)
|
35
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
36
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
37
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
38
|
+
|
39
|
+
# Suppress warnings from Rubygems
|
40
|
+
# https://github.com/OpenNebula/one/issues/5379
|
41
|
+
begin
|
42
|
+
verb = $VERBOSE
|
43
|
+
$VERBOSE = nil
|
36
44
|
require 'rubygems'
|
37
45
|
Gem.use_paths(real_gems_path)
|
46
|
+
ensure
|
47
|
+
$VERBOSE = verb
|
38
48
|
end
|
39
49
|
end
|
50
|
+
end
|
51
|
+
# %%RUBYGEMS_SETUP_END%%
|
52
|
+
# rubocop: enable all
|
40
53
|
|
41
54
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
42
55
|
|
data/lib/nsxv_client.rb
CHANGED
@@ -29,14 +29,27 @@ module NSXDriver
|
|
29
29
|
unless defined?(GEMS_LOCATION)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
# rubocop: disable all
|
33
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
34
|
+
if File.directory?(GEMS_LOCATION)
|
35
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
36
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
37
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
38
|
+
|
39
|
+
# Suppress warnings from Rubygems
|
40
|
+
# https://github.com/OpenNebula/one/issues/5379
|
41
|
+
begin
|
42
|
+
verb = $VERBOSE
|
43
|
+
$VERBOSE = nil
|
36
44
|
require 'rubygems'
|
37
45
|
Gem.use_paths(real_gems_path)
|
46
|
+
ensure
|
47
|
+
$VERBOSE = verb
|
38
48
|
end
|
39
49
|
end
|
50
|
+
end
|
51
|
+
# %%RUBYGEMS_SETUP_END%%
|
52
|
+
# rubocop: enable all
|
40
53
|
|
41
54
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
42
55
|
|
@@ -307,10 +307,18 @@ module OpenNebula
|
|
307
307
|
|
308
308
|
template = JSON.parse(template_json)
|
309
309
|
|
310
|
-
|
311
|
-
|
310
|
+
if append
|
311
|
+
IMMUTABLE_ATTRS.each do |attr|
|
312
|
+
unless template[attr].nil?
|
313
|
+
return [false, "service_template/#{attr}"]
|
314
|
+
end
|
315
|
+
end
|
316
|
+
else
|
317
|
+
IMMUTABLE_ATTRS.each do |attr|
|
318
|
+
next if template[attr] == @body[attr]
|
312
319
|
|
313
|
-
|
320
|
+
return [false, "service_template/#{attr}"]
|
321
|
+
end
|
314
322
|
end
|
315
323
|
|
316
324
|
template = @body.merge(template) if append
|
@@ -361,8 +369,8 @@ module OpenNebula
|
|
361
369
|
# exceeds the limit
|
362
370
|
new_name = "#{template.name}-#{name}"
|
363
371
|
|
364
|
-
if new_name.size >
|
365
|
-
new_name = "#{template.name[0..(
|
372
|
+
if new_name.size > 119
|
373
|
+
new_name = "#{template.name[0..(119 - name.size)]}-#{name}"
|
366
374
|
end
|
367
375
|
|
368
376
|
rc = template.clone(new_name, recursive)
|
@@ -451,6 +459,16 @@ module OpenNebula
|
|
451
459
|
validate_values(template)
|
452
460
|
end
|
453
461
|
|
462
|
+
def self.validate_role(template)
|
463
|
+
validator = Validator::Validator.new(
|
464
|
+
:default_values => true,
|
465
|
+
:delete_extra_properties => false,
|
466
|
+
:allow_extra_properties => true
|
467
|
+
)
|
468
|
+
|
469
|
+
validator.validate!(template, ROLE_SCHEMA)
|
470
|
+
end
|
471
|
+
|
454
472
|
def instantiate(merge_template)
|
455
473
|
rc = nil
|
456
474
|
|
data/lib/opennebula/ldap_auth.rb
CHANGED
@@ -161,7 +161,8 @@ class OpenNebula::LdapAuth
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def is_in_group?(user, group)
|
164
|
-
username =
|
164
|
+
username = Net::LDAP::Filter.escape(
|
165
|
+
user.first.force_encoding(Encoding::UTF_8))
|
165
166
|
result=@ldap.search(
|
166
167
|
:base => group,
|
167
168
|
:attributes => [@options[:group_field]],
|
@@ -273,6 +274,7 @@ def get_server_order(opts, user)
|
|
273
274
|
user = m[1] if m[1]
|
274
275
|
|
275
276
|
order << to_array(server)
|
277
|
+
break
|
276
278
|
end
|
277
279
|
end
|
278
280
|
|
@@ -29,7 +29,15 @@ module OpenNebula
|
|
29
29
|
:update => "market.update",
|
30
30
|
:chown => "market.chown",
|
31
31
|
:chmod => "market.chmod",
|
32
|
-
:rename => "market.rename"
|
32
|
+
:rename => "market.rename",
|
33
|
+
:enable => "market.enable"
|
34
|
+
}
|
35
|
+
|
36
|
+
MARKETPLACE_STATES=%w{ENABLED DISABLED}
|
37
|
+
|
38
|
+
SHORT_MARKETPLACE_STATES={
|
39
|
+
"ENABLED" => "on",
|
40
|
+
"DISABLED" => "off"
|
33
41
|
}
|
34
42
|
|
35
43
|
# Creates a MarketPlace description with just its identifier
|
@@ -130,13 +138,33 @@ module OpenNebula
|
|
130
138
|
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
131
139
|
# otherwise
|
132
140
|
def rename(name)
|
133
|
-
|
141
|
+
call(MARKETPLACE_METHODS[:rename], @pe_id, name)
|
142
|
+
end
|
143
|
+
|
144
|
+
# Enables this marketplace
|
145
|
+
def enable
|
146
|
+
call(MARKETPLACE_METHODS[:enable], @pe_id, true)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Enables this marketplace
|
150
|
+
def disable
|
151
|
+
call(MARKETPLACE_METHODS[:enable], @pe_id, false)
|
134
152
|
end
|
135
153
|
|
136
154
|
# ---------------------------------------------------------------------
|
137
155
|
# Helpers to get information
|
138
156
|
# ---------------------------------------------------------------------
|
139
157
|
|
158
|
+
# Returns the state of the Zone (numeric value)
|
159
|
+
def state
|
160
|
+
self['STATE'].to_i
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns the state of the Zone (string value)
|
164
|
+
def state_str
|
165
|
+
MARKETPLACE_STATES[state]
|
166
|
+
end
|
167
|
+
|
140
168
|
# Returns whether or not the marketplace app with id 'id' is part of
|
141
169
|
# this marketplace
|
142
170
|
def contains(id)
|
data/lib/opennebula/pool.rb
CHANGED
@@ -261,6 +261,8 @@ module OpenNebula
|
|
261
261
|
size = OpenNebula.pool_page_size if (!size || size == 0)
|
262
262
|
rc = @client.call(method, @user_id, current, -size, state)
|
263
263
|
|
264
|
+
return rc if OpenNebula.is_error?(rc)
|
265
|
+
|
264
266
|
initialize_xml(rc, @pool_name)
|
265
267
|
else
|
266
268
|
rc = info
|
@@ -276,11 +278,11 @@ module OpenNebula
|
|
276
278
|
page = OpenNebula::XMLElement.new
|
277
279
|
|
278
280
|
loop do
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
281
|
+
rc = get_page(size, current, extended, state)
|
282
|
+
|
283
|
+
break rc if OpenNebula.is_error?(rc)
|
284
|
+
|
285
|
+
page.initialize_xml(rc, @pool_name)
|
284
286
|
|
285
287
|
break if page["//#{element}"].nil?
|
286
288
|
|
@@ -41,8 +41,10 @@ class OpenNebula::ServerCipherAuth
|
|
41
41
|
if !srv_passwd.empty?
|
42
42
|
# truncate token to 32-bytes for Ruby >= 2.4
|
43
43
|
@key = Digest::SHA256.hexdigest(@srv_passwd)[0..31]
|
44
|
-
|
44
|
+
@iv = @key[0..15]
|
45
|
+
else
|
45
46
|
@key = ""
|
47
|
+
@iv = ""
|
46
48
|
end
|
47
49
|
|
48
50
|
@cipher = OpenSSL::Cipher.new(CIPHER)
|
@@ -112,6 +114,7 @@ class OpenNebula::ServerCipherAuth
|
|
112
114
|
begin
|
113
115
|
# truncate token to 32-bytes for Ruby >= 2.4
|
114
116
|
@key = srv_pass[0..31]
|
117
|
+
@iv = srv_pass[0..15]
|
115
118
|
|
116
119
|
token_array = decrypt(signed_text).split(':')
|
117
120
|
|
@@ -133,7 +136,7 @@ class OpenNebula::ServerCipherAuth
|
|
133
136
|
def encrypt(data)
|
134
137
|
@cipher.encrypt
|
135
138
|
@cipher.key = @key
|
136
|
-
|
139
|
+
@cipher.iv = @iv
|
137
140
|
rc = @cipher.update(data)
|
138
141
|
rc << @cipher.final
|
139
142
|
|
@@ -143,7 +146,7 @@ class OpenNebula::ServerCipherAuth
|
|
143
146
|
def decrypt(data)
|
144
147
|
@cipher.decrypt
|
145
148
|
@cipher.key = @key
|
146
|
-
|
149
|
+
@cipher.iv = @iv
|
147
150
|
rc = @cipher.update(Base64::decode64(data))
|
148
151
|
rc << @cipher.final
|
149
152
|
|
@@ -50,8 +50,11 @@ module OpenNebula
|
|
50
50
|
:disksnapshotrename => "vm.disksnapshotrename",
|
51
51
|
:diskresize => "vm.diskresize",
|
52
52
|
:updateconf => "vm.updateconf",
|
53
|
-
:lock
|
54
|
-
:unlock
|
53
|
+
:lock => "vm.lock",
|
54
|
+
:unlock => "vm.unlock",
|
55
|
+
:schedadd => "vm.schedadd",
|
56
|
+
:scheddelete => "vm.scheddelete",
|
57
|
+
:schedupdate => "vm.schedupdate"
|
55
58
|
}
|
56
59
|
|
57
60
|
VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
|
@@ -260,7 +263,7 @@ module OpenNebula
|
|
260
263
|
# +id+ the id of the vm
|
261
264
|
#
|
262
265
|
# Example:
|
263
|
-
#
|
266
|
+
# vm = VirtualMachine.new(VirtualMachine.build_xml(3),rpc_client)
|
264
267
|
#
|
265
268
|
def VirtualMachine.build_xml(pe_id=nil)
|
266
269
|
if pe_id
|
@@ -710,18 +713,49 @@ module OpenNebula
|
|
710
713
|
end
|
711
714
|
end
|
712
715
|
|
713
|
-
#
|
714
|
-
#
|
715
|
-
#
|
716
|
+
# Changes the attributes of a VM in power off, failure and undeploy
|
717
|
+
# states
|
718
|
+
#
|
719
|
+
# @param new_conf, string describing the new attributes. Each attribute
|
716
720
|
# will replace the existing ones or delete it if empty. Attributes that
|
717
721
|
# can be updated are: INPUT/{TYPE, BUS}; RAW/{TYPE, DATA, DATA_VMX},
|
718
722
|
# OS/{BOOT, BOOTLOADER, ARCH, MACHINE, KERNEL, INITRD},
|
719
723
|
# FEATURES/{ACPI, APIC, PAE, LOCALTIME, HYPERV, GUEST_AGENT},
|
720
724
|
# and GRAPHICS/{TYPE, LISTEN, PASSWD, KEYMAP}
|
725
|
+
# @param append, append template, do not delete empty attributes
|
726
|
+
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
727
|
+
# otherwise
|
728
|
+
def updateconf(new_conf, append = false)
|
729
|
+
return call(VM_METHODS[:updateconf], @pe_id, new_conf, append ? 1 : 0)
|
730
|
+
end
|
731
|
+
|
732
|
+
# Add sched actions
|
733
|
+
#
|
734
|
+
# @param sched_template [String] Template with SCHED_ACTIONs
|
735
|
+
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
736
|
+
# otherwise
|
737
|
+
def sched_action_add(sched_template)
|
738
|
+
return call(VM_METHODS[:schedadd], @pe_id, sched_template)
|
739
|
+
end
|
740
|
+
|
741
|
+
# Delete sched action
|
742
|
+
#
|
743
|
+
# @param sched_id [Int] id of the SCHED_ACTION
|
744
|
+
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
745
|
+
# otherwise
|
746
|
+
def sched_action_delete(sched_id)
|
747
|
+
return call(VM_METHODS[:scheddelete], @pe_id, sched_id.to_i)
|
748
|
+
end
|
749
|
+
|
750
|
+
# Update sched_action
|
751
|
+
#
|
752
|
+
# @param sched_id [Int] id of the SCHED_ACTION
|
753
|
+
# @param sched_template [String] Template containing a SCHED_ACTION
|
721
754
|
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
722
755
|
# otherwise
|
723
|
-
def
|
724
|
-
return call(VM_METHODS[:
|
756
|
+
def sched_action_update(sched_id, sched_template)
|
757
|
+
return call(VM_METHODS[:schedupdate], @pe_id, sched_id.to_i,
|
758
|
+
sched_template)
|
725
759
|
end
|
726
760
|
|
727
761
|
########################################################################
|
@@ -267,17 +267,20 @@ module OpenNebula::VirtualMachineExt
|
|
267
267
|
# --------------------------------------------------------------
|
268
268
|
# Check backup consistency
|
269
269
|
# --------------------------------------------------------------
|
270
|
-
|
271
|
-
rc = info
|
272
|
-
raise rc.message if OpenNebula.is_error?(rc)
|
270
|
+
rc = info
|
273
271
|
|
274
|
-
|
272
|
+
raise rc.message if OpenNebula.is_error?(rc)
|
273
|
+
|
274
|
+
binfo.merge!(backup_info) do |key, old_val, new_val|
|
275
|
+
new_val.nil? ? old_val : new_val
|
275
276
|
end
|
276
277
|
|
277
278
|
raise 'No backup information' if binfo.nil?
|
278
279
|
|
279
280
|
raise 'No frequency defined' unless valid?(binfo[:freq])
|
280
281
|
|
282
|
+
raise 'No marketplace defined' unless valid?(binfo[:market])
|
283
|
+
|
281
284
|
return if Time.now.to_i - binfo[:last].to_i < binfo[:freq].to_i
|
282
285
|
|
283
286
|
# --------------------------------------------------------------
|
@@ -319,19 +322,12 @@ module OpenNebula::VirtualMachineExt
|
|
319
322
|
# --------------------------------------------------------------
|
320
323
|
# Cleanup
|
321
324
|
# --------------------------------------------------------------
|
322
|
-
logger
|
323
|
-
|
324
|
-
tmp.delete(true)
|
325
|
-
|
326
|
-
binfo[:apps].each do |id|
|
327
|
-
logger.info "Deleting applicance #{id}" if logger
|
328
|
-
|
329
|
-
papp = OpenNebula::MarketPlaceApp.new_with_id(id, @client)
|
330
|
-
|
331
|
-
papp.delete
|
332
|
-
end if !keep && binfo[:apps]
|
325
|
+
backup_cleanup(keep, logger, binfo, tmp)
|
333
326
|
rescue Error, StandardError => e
|
327
|
+
backup_cleanup(keep, logger, binfo, tmp)
|
328
|
+
|
334
329
|
logger.fatal(e.inspect) if logger
|
330
|
+
|
335
331
|
raise
|
336
332
|
end
|
337
333
|
|
@@ -421,9 +417,9 @@ module OpenNebula::VirtualMachineExt
|
|
421
417
|
|
422
418
|
private
|
423
419
|
|
424
|
-
|
420
|
+
#-------------------------------------------------------------------
|
425
421
|
# Check an attribute is defined and valid
|
426
|
-
|
422
|
+
#-------------------------------------------------------------------
|
427
423
|
def valid?(att)
|
428
424
|
return false if att.nil?
|
429
425
|
|
@@ -454,6 +450,9 @@ module OpenNebula::VirtualMachineExt
|
|
454
450
|
binfo
|
455
451
|
end
|
456
452
|
|
453
|
+
#-------------------------------------------------------------------
|
454
|
+
# Generate backup information string
|
455
|
+
#-------------------------------------------------------------------
|
457
456
|
def backup_attr(binfo, ids)
|
458
457
|
'BACKUP=[' \
|
459
458
|
" MARKETPLACE_APP_IDS = \"#{ids.join(',')}\"," \
|
@@ -462,6 +461,25 @@ module OpenNebula::VirtualMachineExt
|
|
462
461
|
" MARKETPLACE_ID = \"#{binfo[:market]}\" ]"
|
463
462
|
end
|
464
463
|
|
464
|
+
#-------------------------------------------------------------------
|
465
|
+
# Cleanup backup leftovers in case of failure
|
466
|
+
#-------------------------------------------------------------------
|
467
|
+
def backup_cleanup(keep, logger, binfo, template)
|
468
|
+
if template
|
469
|
+
logger.info "Deleting template #{template.id}" if logger
|
470
|
+
|
471
|
+
template.delete(true)
|
472
|
+
end
|
473
|
+
|
474
|
+
binfo[:apps].each do |id|
|
475
|
+
logger.info "Deleting applicance #{id}" if logger
|
476
|
+
|
477
|
+
papp = OpenNebula::MarketPlaceApp.new_with_id(id, @client)
|
478
|
+
|
479
|
+
papp.delete
|
480
|
+
end if !keep && binfo[:apps]
|
481
|
+
end
|
482
|
+
|
465
483
|
end
|
466
484
|
end
|
467
485
|
|