]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/API2/Storage/Content.pm
auto-detect format for files with vmdk extension
[pve-storage.git] / PVE / API2 / Storage / Content.pm
index ac784bd19f5507c4945ad58a86ed46c89386069a..c8261d4886ec9b213cd32618cf63e28ede79fa7e 100644 (file)
@@ -152,7 +152,7 @@ __PACKAGE__->register_method ({
        }
 
        # extract FORMAT from name
-       if ($name =~ m/\.(raw|qcow2)$/) {
+       if ($name =~ m/\.(raw|qcow2|vmdk)$/) {
            my $fmt = $1;
 
            raise_param_exc({ format => "different storage formats ($param->{format} != $fmt)" }) 
@@ -233,13 +233,15 @@ __PACKAGE__->register_method ({
        $rpcenv->check_volume_access($authuser, $cfg, undef, $volid);
 
        my $path = PVE::Storage::path($cfg, $volid);
-       my ($size, $format, $used) = PVE::Storage::file_size_info ($path);
+       my ($size, $format, $used, $parent) =  PVE::Storage::file_size_info($path);
+       die "file_size_info on '$volid' failed\n" if !($format && $size);
 
        # fixme: return more attributes?
        return {
            path => $path,
            size => $size,
             used => $used,
+           format => $format,
        };
     }});