lvm: volume import: handle worker returned by free_image
only affects LVM storages with 'saferemove 1' where the import fails at a rather advanced stage. Previously in such cases, the renamed (by free_image) volume del-vm-XYZ-disk-N would be left over. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
7ae13a34d2
commit
6a4545601b
@ -670,8 +670,16 @@ sub volume_import {
|
||||
$class->volume_import_write($fh, $file);
|
||||
};
|
||||
if (my $err = $@) {
|
||||
eval { $class->free_image($storeid, $scfg, $volname, 0) };
|
||||
my $cleanup_worker = eval { $class->free_image($storeid, $scfg, $volname, 0) };
|
||||
warn $@ if $@;
|
||||
|
||||
if ($cleanup_worker) {
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
my $authuser = $rpcenv->get_user();
|
||||
|
||||
$rpcenv->fork_worker('imgdel', undef, $authuser, $cleanup_worker);
|
||||
}
|
||||
|
||||
die $err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user