api: create disks: only log cleanup if it's actually done

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@proxmox.com>
This commit is contained in:
Dominik Csapak 2025-03-13 09:30:26 +01:00 committed by Wolfgang Bumiller
parent dfc47f7da2
commit 5b0f9cc848

View File

@ -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 $@;