vmm: Error for vsock::unix::Error

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster 2025-05-13 16:18:01 +02:00 committed by Rob Bradford
parent 8d11bf7979
commit b2993fb2fa
2 changed files with 23 additions and 11 deletions

View file

@ -13,6 +13,7 @@ mod muxer;
mod muxer_killq;
mod muxer_rxq;
use thiserror::Error;
pub use muxer::VsockMuxer as VsockUnixBackend;
pub use Error as VsockUnixError;
@ -27,29 +28,40 @@ mod defs {
pub const MUXER_KILLQ_SIZE: usize = 128;
}
#[derive(Debug)]
#[derive(Error, Debug)]
pub enum Error {
/// Error converting from UTF-8
ConvertFromUtf8(std::str::Utf8Error),
#[error("Error converting from UTF-8: {0}")]
ConvertFromUtf8(#[source] std::str::Utf8Error),
/// Error registering a new epoll-listening FD.
EpollAdd(std::io::Error),
#[error("Error registering a new epoll-listening FD: {0}")]
EpollAdd(#[source] std::io::Error),
/// Error creating an epoll FD.
EpollFdCreate(std::io::Error),
#[error("Error creating an epoll FD: {0}")]
EpollFdCreate(#[source] std::io::Error),
/// The host made an invalid vsock port connection request.
#[error("The host made an invalid vsock port connection request")]
InvalidPortRequest,
/// Error parsing integer.
ParseInteger(std::num::ParseIntError),
#[error("Error parsing integer: {0}")]
ParseInteger(#[source] std::num::ParseIntError),
/// Error reading stream port.
ReadStreamPort(Box<Error>),
#[error("Error reading stream port: {0}")]
ReadStreamPort(#[source] Box<Error>),
/// Error accepting a new connection from the host-side Unix socket.
UnixAccept(std::io::Error),
#[error("Error accepting a new connection from the host-side Unix socket: {0}")]
UnixAccept(#[source] std::io::Error),
/// Error binding to the host-side Unix socket.
UnixBind(std::io::Error),
#[error("Error binding to the host-side Unix socket: {0}")]
UnixBind(#[source] std::io::Error),
/// Error connecting to a host-side Unix socket.
UnixConnect(std::io::Error),
#[error("Error connecting to a host-side Unix socket: {0}")]
UnixConnect(#[source] std::io::Error),
/// Error reading from host-side Unix socket.
UnixRead(std::io::Error),
#[error("Error reading from host-side Unix socket: {0}")]
UnixRead(#[source] std::io::Error),
/// Muxer connection limit reached.
#[error("Muxer connection limit reached")]
TooManyConnections,
}

View file

@ -216,7 +216,7 @@ pub enum DeviceManagerError {
/// Cannot create virtio-vsock backend
#[error("Cannot create virtio-vsock backend")]
CreateVsockBackend(virtio_devices::vsock::VsockUnixError),
CreateVsockBackend(#[source] virtio_devices::vsock::VsockUnixError),
/// Cannot create virtio-iommu device
#[error("Cannot create virtio-iommu device: {0}")]