format => { optional => 1 },
mkdir => { optional => 1 },
bwlimit => { optional => 1 },
+ preallocation => { optional => 1 },
};
}
sub clone_image {
my ($class, $scfg, $storeid, $volname, $vmid, $snap) = @_;
- die "storage definintion has no path\n" if !$scfg->{path};
+ die "storage definition has no path\n" if !$scfg->{path};
my ($vtype, $basename, $basevmid, undef, undef, $isBase, $format) =
$class->parse_volname($volname);
my $cmd = ['/usr/bin/qemu-img', 'create'];
- push @$cmd, '-o', 'preallocation=metadata' if $fmt eq 'qcow2';
+ my $prealloc_opt = PVE::Storage::Plugin::preallocation_cmd_option($scfg, $fmt);
+ push @$cmd, '-o', $prealloc_opt if defined($prealloc_opt);
push @$cmd, '-f', $fmt, $volumepath, "${size}K";