[pve-devel] [PATCH 2/2] parse_drive : return correct format

Alexandre Derumier aderumier at odiso.com
Tue Apr 30 06:17:50 CEST 2013


Currently format is always empty, we need to parse file extension

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 1e2a97e..3725807 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -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)$/;
-- 
1.7.10.4




More information about the pve-devel mailing list