diff --git a/block/src/fixed_vhd_async.rs b/block/src/fixed_vhd_async.rs index 6e858f74a..141435420 100644 --- a/block/src/fixed_vhd_async.rs +++ b/block/src/fixed_vhd_async.rs @@ -10,6 +10,7 @@ use vmm_sys_util::eventfd::EventFd; 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_async::RawFileAsync; use crate::{BatchRequest, BlockBackend}; @@ -17,8 +18,10 @@ use crate::{BatchRequest, BlockBackend}; pub struct FixedVhdDiskAsync(FixedVhd); impl FixedVhdDiskAsync { - 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 342f99b37..26bc24dbc 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -569,7 +569,7 @@ pub enum DeviceManagerError { /// Failed to create FixedVhdDiskAsync #[error("Failed to create FixedVhdDiskAsync")] - CreateFixedVhdDiskAsync(#[source] io::Error), + CreateFixedVhdDiskAsync(#[source] BlockError), /// Failed to create FixedVhdDiskSync #[error("Failed to create FixedVhdDiskSync")]