-#!/usr/bin/perl -w
+#!/usr/bin/perl
use strict;
+use warnings;
use Getopt::Long;
use File::Path;
use IO::File;
use PVE::INotify;
use PVE::JSONSchema;
use PVE::Tools;
-use PVE::Cluster qw(cfs_read_file);
+use PVE::Cluster;
use PVE::RPCEnvironment;
+use PVE::Storage;
use PVE::QemuServer;
$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
$storeid = $info->{storeid} || 'local';
}
- my $cfg = cfs_read_file('storage.cfg');
+ my $cfg = PVE::Storage::config();
my $scfg = PVE::Storage::storage_config($cfg, $storeid);
- my $alloc_size = ($filesize + 1024 - 1)/1024;
+ my $alloc_size = int(($filesize + 1024 - 1)/1024);
if ($scfg->{type} eq 'dir' || $scfg->{type} eq 'nfs') {
# hack: we just alloc a small file (32K) - we overwrite it anyways
$alloc_size = 32;
exec 'dd', 'ibs=256K', 'obs=256K', "of=$path";
die "couldn't exec dd: $!\n";
} else {
- exec '/usr/lib/qemu-server/sparsecp', $path;
- die "couldn't exec sparsecp: $!\n";
+ exec '/bin/cp', '--sparse=always', '/dev/stdin', $path;
+ die "couldn't exec cp: $!\n";
}
}