mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: vhd: Switch FixedVhdDiskSync::new to BlockResult
Classify the io::Error as BlockErrorKind::Io with ErrorOp::Open. Update vmm CreateFixedVhdDiskSync to take BlockError. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
@@ -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<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))?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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")]
|
||||
|
||||
Reference in New Issue
Block a user