src/bin/proxmox-backup-client.rs: backup_image() - pass correct chunk size

This commit is contained in:
Dietmar Maurer 2019-05-30 12:52:12 +02:00
parent 202cadc29e
commit 49ef316bcd
1 changed files with 1 additions and 5 deletions

View File

@ -148,10 +148,6 @@ fn backup_image<P: AsRef<Path>>(
verbose: bool, verbose: bool,
) -> Result<(), Error> { ) -> Result<(), Error> {
if let Some(_size) = chunk_size {
unimplemented!();
}
let path = image_path.as_ref().to_owned(); let path = image_path.as_ref().to_owned();
let file = tokio::fs::File::open(path).wait()?; let file = tokio::fs::File::open(path).wait()?;
@ -159,7 +155,7 @@ fn backup_image<P: AsRef<Path>>(
let stream = tokio::codec::FramedRead::new(file, tokio::codec::BytesCodec::new()) let stream = tokio::codec::FramedRead::new(file, tokio::codec::BytesCodec::new())
.map_err(Error::from); .map_err(Error::from);
let stream = FixedChunkStream::new(stream, 4*1024*1024); let stream = FixedChunkStream::new(stream, chunk_size.unwrap_or(4*1024*1024) as usize);
client.upload_stream(archive_name, stream, "fixed", Some(image_size)).wait()?; client.upload_stream(archive_name, stream, "fixed", Some(image_size)).wait()?;