From 971f27c404f6d5dd6116ed75f524ab19e6b8423b Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 23 Nov 2011 07:30:43 +0100 Subject: [PATCH] improve error message when archive does not exist --- PVE/API2/Qemu.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 91fdf1ad..98b306f9 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -150,16 +150,18 @@ __PACKAGE__->register_method({ die "pipe requires cli environment\n" && $rpcenv->{type} ne 'cli'; } else { + my $path; if (PVE::Storage::parse_volume_id($archive, 1)) { - $archive = PVE::Storage::path($storecfg, $archive); + $path = PVE::Storage::path($storecfg, $archive); } else { raise_param_exc({ archive => "Only root can pass arbitrary paths." }) if $user ne 'root@pam'; - $archive = abs_path($archive); + $path = abs_path($archive); } - die "can't find file '$archive'\n" if ! -f $archive; - } + die "can't find archive file '$archive'\n" if !($path && -f $path); + $archive = $path; + } } my $restorefn = sub {