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:
Anatol Belski
2026-03-23 23:30:08 +01:00
committed by Bo Chen
parent 6e36932e90
commit 24e9049280
2 changed files with 6 additions and 3 deletions

View File

@@ -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))?,
))
}
}

View File

@@ -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")]