diff --git a/block/src/fixed_vhd_sync.rs b/block/src/fixed_vhd_sync.rs index ecb5e83ad..bf6c431fe 100644 --- a/block/src/fixed_vhd_sync.rs +++ b/block/src/fixed_vhd_sync.rs @@ -11,14 +11,17 @@ use crate::BlockBackend; use crate::async_io::{ AsyncIo, AsyncIoError, AsyncIoResult, BorrowedDiskFd, DiskFile, DiskFileError, DiskFileResult, }; +use crate::error::{BlockError, BlockResult, ErrorOp}; use crate::fixed_vhd::FixedVhd; use crate::raw_sync::RawFileSync; pub struct FixedVhdDiskSync(FixedVhd); impl FixedVhdDiskSync { - pub fn new(file: File) -> std::io::Result { - Ok(Self(FixedVhd::new(file)?)) + pub fn new(file: File) -> BlockResult { + Ok(Self( + FixedVhd::new(file).map_err(|e| BlockError::from(e).with_op(ErrorOp::Open))?, + )) } } diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index ea66cda9d..bdcd33602 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -573,7 +573,7 @@ pub enum DeviceManagerError { /// Failed to create FixedVhdDiskSync #[error("Failed to create FixedVhdDiskSync")] - CreateFixedVhdDiskSync(#[source] io::Error), + CreateFixedVhdDiskSync(#[source] BlockError), /// Failed to create QcowDiskSync #[error("Failed to create QcowDiskSync")]