code cleanup

This commit is contained in:
Dietmar Maurer
2012-09-20 07:18:59 +02:00
parent 1e679ac591
commit 045ae0a7fe
2 changed files with 24 additions and 22 deletions

View File

@ -1,4 +1,4 @@
RELEASE=2.1 RELEASE=2.2
VERSION=2.0 VERSION=2.0
PACKAGE=libpve-storage-perl PACKAGE=libpve-storage-perl

View File

@ -427,11 +427,13 @@ sub alloc_image {
die "disk image '$path' already exists\n" if -e $path; die "disk image '$path' already exists\n" if -e $path;
my $options = ""; my $cmd = ['/usr/bin/qemu-img', 'create'];
$options = "-o preallocation=metadata" if $fmt eq 'qcow2';
run_command("/usr/bin/qemu-img create $options -f $fmt '$path' ${size}K", push @$cmd, '-o', 'preallocation=metadata' if $fmt eq 'qcow2';
errmsg => "unable to create image");
push @$cmd, '-f', $fmt, $path, "${size}K";
run_command($cmd, errmsg => "unable to create image");
return "$vmid/$name"; return "$vmid/$name";
} }