mirror of
https://git.proxmox.com/git/pve-guest-common
synced 2025-04-29 23:35:05 +00:00
storage tunnel: add error handling for cleaning up unix socket file
Warn if removing the socket failed and it still existed when trying to do so. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
16ff09f72c
commit
d0415b8179
@ -258,7 +258,7 @@ sub handle_query_disk_import {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $unix = $state->{disk_import}->{socket};
|
my $unix = $state->{disk_import}->{socket};
|
||||||
unlink $unix;
|
unlink $unix or $!{ENOENT} or warn "failed to unlink disk import socket – $!\n";
|
||||||
delete $state->{sockets}->{$unix};
|
delete $state->{sockets}->{$unix};
|
||||||
delete $state->{disk_import};
|
delete $state->{disk_import};
|
||||||
|
|
||||||
@ -276,10 +276,11 @@ sub handle_query_disk_import {
|
|||||||
waitpid($state->{disk_import}->{pid}, 0);
|
waitpid($state->{disk_import}->{pid}, 0);
|
||||||
|
|
||||||
my $unix = $state->{disk_import}->{socket};
|
my $unix = $state->{disk_import}->{socket};
|
||||||
unlink $unix;
|
unlink $unix or $!{ENOENT} or warn "failed to unlink disk import socket – $!\n";
|
||||||
delete $state->{sockets}->{$unix};
|
delete $state->{sockets}->{$unix};
|
||||||
delete $state->{disk_import};
|
delete $state->{disk_import};
|
||||||
$state->{cleanup}->{volumes}->{$volid} = 1;
|
$state->{cleanup}->{volumes}->{$volid} = 1;
|
||||||
|
|
||||||
my $cfg = PVE::Storage::config();
|
my $cfg = PVE::Storage::config();
|
||||||
my ($storage, $volume) = PVE::Storage::parse_volume_id($volid);
|
my ($storage, $volume) = PVE::Storage::parse_volume_id($volid);
|
||||||
my $scfg = PVE::Storage::storage_config($cfg, $storage);
|
my $scfg = PVE::Storage::storage_config($cfg, $storage);
|
||||||
@ -288,6 +289,7 @@ sub handle_query_disk_import {
|
|||||||
my $path = PVE::Storage::path($cfg, $volid);
|
my $path = PVE::Storage::path($cfg, $volid);
|
||||||
PVE::Storage::file_size_info($path, undef, 1);
|
PVE::Storage::file_size_info($path, undef, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status => "complete",
|
status => "complete",
|
||||||
volid => $volid,
|
volid => $volid,
|
||||||
|
Loading…
Reference in New Issue
Block a user