mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: qcow: Migrate convert() to BlockResult
Switch the public convert() entry point to BlockResult. Inner calls to functions already returning BlockResult propagate naturally; those still returning qcow::Error get map_err bridges. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
4930d93090
commit
1accf47db4
@@ -2142,20 +2142,20 @@ pub fn convert(
|
||||
dst_file: RawFile,
|
||||
dst_type: ImageType,
|
||||
src_max_nesting_depth: u32,
|
||||
) -> Result<()> {
|
||||
let src_type = detect_image_type(&mut src_file)?;
|
||||
) -> BlockResult<()> {
|
||||
let src_type =
|
||||
detect_image_type(&mut src_file).map_err(|e| BlockError::new(BlockErrorKind::Io, e))?;
|
||||
match src_type {
|
||||
ImageType::Qcow2 => {
|
||||
let mut src_reader =
|
||||
QcowFile::from_with_nesting_depth(src_file, src_max_nesting_depth, true)?;
|
||||
QcowFile::from_with_nesting_depth(src_file, src_max_nesting_depth, true)
|
||||
.map_err(|e| BlockError::new(BlockErrorKind::Io, e))?;
|
||||
convert_reader(&mut src_reader, dst_file, dst_type)
|
||||
.map_err(|e| Error::ReadingData(io::Error::other(e)))
|
||||
}
|
||||
ImageType::Raw => {
|
||||
// src_file is a raw file.
|
||||
let mut src_reader = src_file;
|
||||
convert_reader(&mut src_reader, dst_file, dst_type)
|
||||
.map_err(|e| Error::ReadingData(io::Error::other(e)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user