diff --git a/PVE/Storage/LVMPlugin.pm b/PVE/Storage/LVMPlugin.pm index 72d7464..9ad7979 100644 --- a/PVE/Storage/LVMPlugin.pm +++ b/PVE/Storage/LVMPlugin.pm @@ -620,8 +620,8 @@ sub volume_import { } my $file = $class->path($scfg, $volname, $storeid) or die "internal error: failed to get path to newly allocated volume $volname\n"; - run_command(['dd', "of=$file", 'conv=sparse', 'bs=64k'], - input => '<&'.fileno($fh)); + + $class->volume_import_write($fh, $file); }; if (my $err = $@) { eval { $class->free_image($storeid, $scfg, $volname, 0) }; @@ -630,4 +630,10 @@ sub volume_import { } } +sub volume_import_write { + my ($class, $input_fh, $output_file) = @_; + run_command(['dd', "of=$output_file", 'bs=64k'], + input => '<&'.fileno($input_fh)); +} + 1; diff --git a/PVE/Storage/LvmThinPlugin.pm b/PVE/Storage/LvmThinPlugin.pm index 122fb37..aafc202 100644 --- a/PVE/Storage/LvmThinPlugin.pm +++ b/PVE/Storage/LvmThinPlugin.pm @@ -374,4 +374,11 @@ sub volume_has_feature { return undef; } +# used in LVMPlugin->volume_import +sub volume_import_write { + my ($class, $input_fh, $output_file) = @_; + run_command(['dd', "of=$output_file", 'conv=sparse', 'bs=64k'], + input => '<&'.fileno($input_fh)); +} + 1;