]> git.proxmox.com Git - pve-storage.git/commitdiff
qcow2 : preallocate metadatas at file creation
authorAlexandre Derumier <aderumier@odiso.com>
Wed, 19 Sep 2012 10:20:21 +0000 (12:20 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 20 Sep 2012 05:11:43 +0000 (07:11 +0200)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/Storage/Plugin.pm

index 92a59781d8866727d67fcba50331a99db3226254..4e6cac7d08d6b961bb1d0c1be69e073116ae7c44 100644 (file)
@@ -427,7 +427,10 @@ sub alloc_image {
 
     die "disk image '$path' already exists\n" if -e $path;
 
-    run_command("/usr/bin/qemu-img create -f $fmt '$path' ${size}K", 
+    my $options = "";
+    $options = "-o preallocation=metadata" if $fmt eq 'qcow2';
+
+    run_command("/usr/bin/qemu-img create $options -f $fmt '$path' ${size}K", 
                errmsg => "unable to create image");
 
     return "$vmid/$name";