1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-24 21:34:01 +03:00

F #6029: Normalize exit codes for rsync backup actions (#2535)

Possible fix for "Message received: BACKUP SUCCESS 96 -" (?)
This commit is contained in:
Michal Opala 2023-03-01 13:19:30 +01:00 committed by GitHub
parent f4c42df235
commit e6652bd08a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View File

@ -91,7 +91,7 @@ begin
ds = TransferManager::Datastore.new(:ds_xml => ds_xml)
rescue StandardError => e
STDERR.puts e.message
exit(1)
exit(-1)
end
path = Pathname.new(base).cleanpath.to_s
@ -139,4 +139,6 @@ if rc.code != 0 || rc.stdout.empty?
exit(-1)
end
puts "#{backup_id} #{rc.stdout.split[0]}"
STDOUT.puts "#{backup_id} #{rc.stdout.split[0]}"
exit(0)

View File

@ -82,7 +82,7 @@ begin
if !diskid
STDERR.puts "Wrong format for disk filename #{parts[2]}"
exit(1)
exit(-1)
end
last_snap = parts[1].split(',')[-1].split(':')[-1]
@ -90,7 +90,7 @@ begin
cmd = "cat #{base_path}#{last_snap}/vm.xml"
rescue StandardError => e
STDERR.puts e.message
exit(1)
exit(-1)
end
rc = TransferManager::Action.ssh('gather_vm_xml',
@ -102,7 +102,7 @@ rc = TransferManager::Action.ssh('gather_vm_xml',
if rc.code != 0
STDERR.puts rc.stderr
exit(1)
exit(-1)
end
vm = REXML::Document.new(Base64.decode64(rc.stdout)).root
@ -113,16 +113,16 @@ disk = vm.elements[xpath]
if !disk
STDERR.puts "Cannot find disk #{diskid[1]} in VM backup info"
exit(1)
exit(-1)
end
size = disk.elements['//SIZE']
if !size
STDERR.puts "Cannot find size for disk #{diskid[1]} in VM backup info"
exit(1)
exit(-1)
end
puts size.text
STDOUT.puts size.text
exit 0
exit(0)