fix #6317: backup: use correct cleanup_fleecing_images helper

The local one is specific for `allocate_fleecing_images` and has a
comment stating to use the one from `PVE::QemuConfig` in all other
cases.

The `cleanup` sub already called this, but only if the VM was running.
We do allocate fleecing images for previously-stopped VMs as well,
though, so we also need to do the cleanup.

As for the `detach_fleecing_images()` call: while could have stayed in
the `vm_running_locall()` branch, it also performs this check and this
way the entire fleecing cleanup stays together in one place.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2025-04-14 13:59:53 +02:00 committed by Fabian Grünbichler
parent a411016f58
commit 8009da73f1

View File

@ -1267,14 +1267,16 @@ sub cleanup {
} }
$detach_tpmstate_drive->($task, $vmid); $detach_tpmstate_drive->($task, $vmid);
}
if ($task->{'use-fleecing'}) { if ($task->{'use-fleecing'}) {
eval {
detach_fleecing_images($task->{disks}, $vmid); detach_fleecing_images($task->{disks}, $vmid);
PVE::QemuConfig::cleanup_fleecing_images( PVE::QemuConfig::cleanup_fleecing_images(
$vmid, $self->{storecfg}, sub { $self->log($_[0], $_[1]); }); $vmid, $self->{storecfg}, sub { $self->log($_[0], $_[1]); });
};
$self->log('warn', "attempt to clean up fleecing images failed - $@") if $@;
} }
}
cleanup_fleecing_images($self, $task->{disks}) if $task->{'use-fleecing'};
if ($self->{qmeventd_fh}) { if ($self->{qmeventd_fh}) {
close($self->{qmeventd_fh}); close($self->{qmeventd_fh});