fix #3004: show progress of offline migration in task log
dd supports a 'status' flag, which enables it to show the copied bytes, duration, and the transfer rate, which then get printed to stderr. Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
122ccde412
commit
aa82ad5c25
@ -645,7 +645,7 @@ sub volume_export {
|
||||
$size = int($1);
|
||||
});
|
||||
PVE::Storage::Plugin::write_common_header($fh, $size);
|
||||
run_command(['dd', "if=$file", "bs=64k"], output => '>&'.fileno($fh));
|
||||
run_command(['dd', "if=$file", "bs=64k", "status=progress"], output => '>&'.fileno($fh));
|
||||
}
|
||||
|
||||
sub volume_import_formats {
|
||||
|
||||
@ -1577,7 +1577,7 @@ sub volume_export {
|
||||
goto unsupported if $with_snapshots || $file_format eq 'subvol';
|
||||
write_common_header($fh, $size);
|
||||
if ($file_format eq 'raw') {
|
||||
run_command(['dd', "if=$file", "bs=4k"], output => '>&'.fileno($fh));
|
||||
run_command(['dd', "if=$file", "bs=4k", "status=progress"], output => '>&'.fileno($fh));
|
||||
} else {
|
||||
run_command(['qemu-img', 'convert', '-f', $file_format, '-O', 'raw', $file, '/dev/stdout'],
|
||||
output => '>&'.fileno($fh));
|
||||
@ -1587,7 +1587,7 @@ sub volume_export {
|
||||
my $data_format = $1;
|
||||
goto unsupported if !$with_snapshots || $file_format ne $data_format;
|
||||
write_common_header($fh, $size);
|
||||
run_command(['dd', "if=$file", "bs=4k"], output => '>&'.fileno($fh));
|
||||
run_command(['dd', "if=$file", "bs=4k", "status=progress"], output => '>&'.fileno($fh));
|
||||
return;
|
||||
} elsif ($format eq 'tar+size') {
|
||||
goto unsupported if $file_format ne 'subvol';
|
||||
|
||||
Reference in New Issue
Block a user