]> git.proxmox.com Git - qemu-server.git/commitdiff
improve error message when archive does not exist
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 23 Nov 2011 06:30:43 +0000 (07:30 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 23 Nov 2011 06:30:43 +0000 (07:30 +0100)
PVE/API2/Qemu.pm

index 91fdf1ad5c9c08f2318a97773a85e36f4130546b..98b306f989cde8743766b71b420fc47adb5283b0 100644 (file)
@@ -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 {