mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: vhdx: Switch VhdxDiskSync::new to BlockResult
Wrap VhdxError via BlockError::new(Io, e).with_op(Open). Update VMM CreateFixedVhdxDiskSync error variant from VhdxError to BlockError. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
@@ -12,7 +12,8 @@ use vmm_sys_util::eventfd::EventFd;
|
|||||||
use crate::async_io::{
|
use crate::async_io::{
|
||||||
AsyncIo, AsyncIoError, AsyncIoResult, BorrowedDiskFd, DiskFile, DiskFileError, DiskFileResult,
|
AsyncIo, AsyncIoError, AsyncIoResult, BorrowedDiskFd, DiskFile, DiskFileError, DiskFileResult,
|
||||||
};
|
};
|
||||||
use crate::vhdx::{Result as VhdxResult, Vhdx};
|
use crate::error::{BlockError, BlockErrorKind, BlockResult, ErrorOp};
|
||||||
|
use crate::vhdx::Vhdx;
|
||||||
use crate::{AsyncAdaptor, BlockBackend, Error};
|
use crate::{AsyncAdaptor, BlockBackend, Error};
|
||||||
|
|
||||||
pub struct VhdxDiskSync {
|
pub struct VhdxDiskSync {
|
||||||
@@ -28,9 +29,11 @@ pub struct VhdxDiskSync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VhdxDiskSync {
|
impl VhdxDiskSync {
|
||||||
pub fn new(f: File) -> VhdxResult<Self> {
|
pub fn new(f: File) -> BlockResult<Self> {
|
||||||
Ok(VhdxDiskSync {
|
Ok(VhdxDiskSync {
|
||||||
vhdx_file: Arc::new(Mutex::new(Vhdx::new(f)?)),
|
vhdx_file: Arc::new(Mutex::new(Vhdx::new(f).map_err(|e| {
|
||||||
|
BlockError::new(BlockErrorKind::Io, e).with_op(ErrorOp::Open)
|
||||||
|
})?)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ use block::raw_sync::RawFileDiskSync;
|
|||||||
use block::vhdx_sync::VhdxDiskSync;
|
use block::vhdx_sync::VhdxDiskSync;
|
||||||
use block::{
|
use block::{
|
||||||
ImageType, block_aio_is_supported, block_io_uring_is_supported, detect_image_type,
|
ImageType, block_aio_is_supported, block_io_uring_is_supported, detect_image_type,
|
||||||
open_disk_image, preallocate_disk, vhdx,
|
open_disk_image, preallocate_disk,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "io_uring")]
|
#[cfg(feature = "io_uring")]
|
||||||
use block::{fixed_vhd_async::FixedVhdDiskAsync, raw_async::RawFileDisk};
|
use block::{fixed_vhd_async::FixedVhdDiskAsync, raw_async::RawFileDisk};
|
||||||
@@ -581,7 +581,7 @@ pub enum DeviceManagerError {
|
|||||||
|
|
||||||
/// Failed to create FixedVhdxDiskSync
|
/// Failed to create FixedVhdxDiskSync
|
||||||
#[error("Failed to create FixedVhdxDiskSync")]
|
#[error("Failed to create FixedVhdxDiskSync")]
|
||||||
CreateFixedVhdxDiskSync(#[source] vhdx::VhdxError),
|
CreateFixedVhdxDiskSync(#[source] BlockError),
|
||||||
|
|
||||||
/// Failed to add DMA mapping handler to virtio-mem device.
|
/// Failed to add DMA mapping handler to virtio-mem device.
|
||||||
#[error("Failed to add DMA mapping handler to virtio-mem device")]
|
#[error("Failed to add DMA mapping handler to virtio-mem device")]
|
||||||
|
|||||||
Reference in New Issue
Block a user