]> git.proxmox.com Git - qemu-server.git/commitdiff
parse_drive : return correct format
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 30 Apr 2013 04:17:50 +0000 (06:17 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 30 Apr 2013 04:55:33 +0000 (06:55 +0200)
Currently format is always empty, we need to parse file extension

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/QemuServer.pm

index f478892f26863a64d13806c01ee2eb82d8bdbf7a..c71cb69b3a86a611b7d9c0c5851bc3dc20c773d4 100644 (file)
@@ -900,6 +900,10 @@ sub parse_drive {
 
     return undef if !$res->{file};
 
+    if($res->{file} =~ m/\.(raw|cow|qcow|qcow2|vmdk|cloop)$/){
+       $res->{format} = $1;
+    }
+
     return undef if $res->{cache} &&
        $res->{cache} !~ m/^(off|none|writethrough|writeback|unsafe|directsync)$/;
     return undef if $res->{snapshot} && $res->{snapshot} !~ m/^(on|off)$/;