From 248bc50e16f6713e05e1687f13cfb76c11c7f57c Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Tue, 14 Nov 2023 17:57:52 +0100 Subject: [PATCH] F #6333: Fix path for multiple disks (1/2) This is a partial fix for backup snapshots for VMs with multiple disks. It still fails for disks attached after the VM is created. In this case the SOURCE of the disk is not replace by the "readlink", causing problems to libvirt while resolving disks in the backingStore. --- src/tm_mad/lib/backup_qcow2.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/tm_mad/lib/backup_qcow2.rb b/src/tm_mad/lib/backup_qcow2.rb index 811260a060..35d11356b6 100755 --- a/src/tm_mad/lib/backup_qcow2.rb +++ b/src/tm_mad/lib/backup_qcow2.rb @@ -739,12 +739,11 @@ class KVMDomain qdisks << { :did => did, :tgt => tgt, :disk => disk } - bfile = disk['full-backing-filename'] - next_path = "#{disk.snap}/#{@backup_id.to_i + 1}" next_disk = QemuImg.new(next_path) - next_disk.create(:f => 'qcow2', :o => 'backing_fmt=qcow2', :b => bfile) + next_disk.create(:f => 'qcow2', :o => 'backing_fmt=qcow2', + :b => "#{disk.snap}/#{disk.name}") dspec << "#{tgt},file=#{next_path}" end @@ -777,7 +776,7 @@ class KVMDomain cmd("#{virsh} blockcommit", "#{@dom} #{tgt}", :wait => '', - :top => disk.path, + :top => "#{disk.snap}/#{disk.name}", :base => "#{disk.snap}/0") FileUtils.rm(disk.path, :force => true)