lvm plugin: fix error handling in volume_snapshot_rollback()

In case a cleanup worker is spawned, the error from the eval block
for allocation was lost. Save it in a variable for checking later.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
Link: https://lore.proxmox.com/20251103162330.112603-3-f.ebner@proxmox.com
This commit is contained in:
Fiona Ebner
2025-11-03 17:23:13 +01:00
committed by Thomas Lamprecht
parent f0f9054926
commit 0864fda2fd

View File

@ -1097,11 +1097,12 @@ sub volume_snapshot_rollback {
die "error deleting snapshot $snap $@\n" if $@;
eval { alloc_snap_image($class, $storeid, $scfg, $volname, $snap) };
my $alloc_err = $@;
fork_cleanup_worker($cleanup_worker);
if ($@) {
die "can't allocate new volume $volname: $@\n";
if ($alloc_err) {
die "can't allocate new volume $volname: $alloc_err\n";
}
return undef;