]> git.proxmox.com Git - qemu-server.git/commitdiff
importovf: die with error when disk file is missing
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 23 Apr 2020 10:46:49 +0000 (12:46 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 27 Apr 2020 11:13:10 +0000 (13:13 +0200)
Also add missing '\n' at the end of error messages

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/QemuServer/OVF.pm

index 536e0eb85c1ab217ebcda082ccd8886eab8e679e..dbcc361d53def81fffd0508a4e16fb4633a1b449 100644 (file)
@@ -213,12 +213,16 @@ ovf:Item[rasd:InstanceID='%s']/rasd:ResourceType", $controller_id);
        my $ovf_dir = realpath(dirname(File::Spec->rel2abs($ovf)));
        my $backing_file_path = realpath(join ('/', $ovf_dir, $filepath));
        if ($backing_file_path !~ /^\Q${ovf_dir}\E/) {
-           die "error parsing $filepath, are you using a symlink ?";
+           die "error parsing $filepath, are you using a symlink ?\n";
+       }
+
+       if (!-e $backing_file_path) {
+           die "error parsing $filepath, file seems not to exist at $backing_file_path\n";
        }
 
        my $virtual_size;
        if ( !($virtual_size = PVE::Storage::file_size_info($backing_file_path)) ) {
-           die "error parsing $backing_file_path, size seems to be $virtual_size";
+           die "error parsing $backing_file_path, size seems to be $virtual_size\n";
        }
 
        $pve_disk = {