mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-08 05:57:23 +03:00
parent
20f6c39a8a
commit
694ff377aa
@ -66,6 +66,7 @@ ds_id = tokens[0].to_i
|
||||
snaps = tokens[1].split(',').map {|s| s.split(':')[1] }
|
||||
disk_path = tokens[2..].join('/')
|
||||
disk_index = File.basename(disk_path).split('.')[1]
|
||||
vm_id = disk_path.match('/(\d+)/backup/[^/]+$')[1].to_i
|
||||
|
||||
begin
|
||||
# Do a sanity check if Restic is available/enabled.
|
||||
@ -81,12 +82,11 @@ begin
|
||||
|
||||
rc = backup_ds.info(true)
|
||||
|
||||
raise StandardError, rc.message \
|
||||
if OpenNebula.is_error?(backup_ds)
|
||||
raise StandardError, rc.message if OpenNebula.is_error?(backup_ds)
|
||||
|
||||
# Pull from Restic, then post-process qcow2 disks.
|
||||
|
||||
rds = Restic.new backup_ds.to_xml
|
||||
rds = Restic.new backup_ds.to_xml, :vm_id => vm_id
|
||||
|
||||
tmp_dir = "#{rds.tmp_dir}/#{SecureRandom.uuid}"
|
||||
FileUtils.mkdir_p tmp_dir
|
||||
@ -101,8 +101,7 @@ begin
|
||||
mv '#{tmp_dir}/#{File.basename(disk_paths.last)}' '#{tmp_dir}/disk.#{disk_index}'
|
||||
EOS
|
||||
|
||||
raise StandardError, rc.stderr \
|
||||
if rc.code != 0
|
||||
raise StandardError, rc.stderr if rc.code != 0
|
||||
|
||||
# Return shell code snippets according to the downloader's interface.
|
||||
|
||||
|
@ -2940,7 +2940,6 @@ void LifeCycleManager::trigger_backup_success(int vid)
|
||||
|
||||
oss << "<EXTRA_DATA>"
|
||||
<< "<KEEP_LAST>" << keep_last << "</KEEP_LAST>"
|
||||
<< "<VM_ID>" << vid << "</VM_ID>"
|
||||
<< "</EXTRA_DATA>";
|
||||
|
||||
if ( imagem->flatten_increments(image_id, ds_id, oss.str(), error) != 0 )
|
||||
|
@ -78,8 +78,10 @@ module TransferManager
|
||||
|
||||
@increments[0] = @action.elements["#{prefix}/SOURCE"].text if @increments.empty?
|
||||
|
||||
# NOTE: In the case of backup images, there should always be just a single ID in the VMS array.
|
||||
@vm_id = @action.elements["#{prefix}/VMS/ID"].text.to_i
|
||||
|
||||
@keep_last = @action.elements['/DS_DRIVER_ACTION_DATA/EXTRA_DATA/KEEP_LAST']&.text.to_i
|
||||
@vm_id = @action.elements['/DS_DRIVER_ACTION_DATA/EXTRA_DATA/VM_ID']&.text.to_i
|
||||
end
|
||||
|
||||
def last
|
||||
|
Loading…
x
Reference in New Issue
Block a user