[pve-devel] [PATCH qemu-server] api: create disks: only log cleanup if it's actually done

Dominik Csapak d.csapak at proxmox.com
Thu Mar 13 09:30:26 CET 2025


we cleaned up extracted images, but logged it even for non extracted
ones. Only log this when we actually cleaned anything up.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Qemu.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index dc8915a7..156b1c7b 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -492,8 +492,10 @@ my sub create_disks : prototype($$$$$$$$$$$) {
 				= $import_from_volid->($storecfg, $source, $dest_info, $vollist);
 
 			    # remove extracted volumes after importing
-			    PVE::Storage::vdisk_free($storecfg, $source) if $needs_extraction;
-			    print "cleaned up extracted image $source\n";
+			    if ($needs_extraction) {
+				PVE::Storage::vdisk_free($storecfg, $source);
+				print "cleaned up extracted image $source\n";
+			    }
 			    @$vollist = grep { $_ ne $source } @$vollist;
 			};
 			die "cannot import from '$source' - $@" if $@;
-- 
2.39.5





More information about the pve-devel mailing list