mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: vhd: Switch FixedVhdDiskAsync::new to BlockResult
Map FixedVhd::new io::Error to BlockError with ErrorOp::Open. Update vmm CreateFixedVhdDiskAsync source type accordingly. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
@@ -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<Self> {
|
||||
Ok(Self(FixedVhd::new(file)?))
|
||||
pub fn new(file: File) -> BlockResult<Self> {
|
||||
Ok(Self(
|
||||
FixedVhd::new(file).map_err(|e| BlockError::from(e).with_op(ErrorOp::Open))?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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")]
|
||||
|
||||
Reference in New Issue
Block a user