vmm: streamline error messages

In [0] we agreed on the current format.

[0] https://github.com/cloud-hypervisor/cloud-hypervisor/pull/7066

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
Philipp Schuster
2026-06-25 13:29:23 +02:00
committed by Bo Chen
parent 40d8f9ee51
commit 90429c56c8
6 changed files with 12 additions and 14 deletions

View File

@@ -313,7 +313,7 @@ pub enum VmReceiveMigrationConfigError {
#[error("Error parsing receive migration parameters")]
ParseError(#[source] OptionParserError),
#[error("Error validating receive migration parameters")]
#[error("Error validating receive migration parameters: {0}")]
ValidationError(String),
}
@@ -422,7 +422,7 @@ pub enum VmSendMigrationConfigError {
)]
InvalidDestinationUrl(#[source] TcpAddressParseError),
#[error("Error validating send migration parameters")]
#[error("Error validating send migration parameters: {0}")]
ValidationError(String),
}

View File

@@ -394,18 +394,18 @@ pub enum ValidationError {
#[error("Path {0:?} provided in landlock-rules does not exist")]
LandlockPathDoesNotExist(PathBuf),
/// Access provided in landlock-rules in invalid
#[error("access provided in landlock-rules in invalid")]
#[error("Invalid landlock access: {0}")]
InvalidLandlockAccess(String),
/// Invalid block device serial length
#[error("Block device serial length ({0}) exceeds maximum allowed length ({1})")]
InvalidSerialLength(usize, usize),
#[cfg(feature = "ivshmem")]
/// Invalid Ivshmem input size
#[error("Invalid ivshmem input size")]
#[error("Invalid ivshmem input size: {0}")]
InvalidIvshmemInputSize(u64),
#[cfg(feature = "ivshmem")]
/// Invalid Ivshmem backend file size
#[error("Invalid ivshmem backend file size")]
#[error("Invalid ivshmem backend file size: {0}")]
InvalidIvshmemSize(u64),
#[cfg(feature = "ivshmem")]
/// Invalid Ivshmem backend file path
@@ -418,7 +418,7 @@ pub enum ValidationError {
#[error("IP provided without a mask")]
IpProvidedWithoutMask,
/// Invalid NUMA Configuration
#[error("NUMA Configuration is invalid")]
#[error("Invalid NUMA configuration: {0}")]
InvalidNumaConfig(String),
/// The supplied PCI ID was greater then the max. supported number
/// of devices per Bus

View File

@@ -493,7 +493,7 @@ pub enum DeviceManagerError {
RemoveDeviceFromMmioBus(#[source] vm_device::BusError),
/// Failed to find the device corresponding to a specific PCI b/d/f.
#[error("Failed to find the device corresponding to a specific PCI b/d/f")]
#[error("Failed to find the device corresponding to a specific PCI b/d/f: {0:#x}")]
UnknownPciBdf(u32),
/// Not allowed to remove this type of device from the VM.
@@ -501,7 +501,7 @@ pub enum DeviceManagerError {
RemovalNotAllowed(vm_virtio::VirtioDeviceType),
/// Failed to find device corresponding to the given identifier.
#[error("Failed to find device corresponding to the given identifier")]
#[error("Failed to find device corresponding to the given identifier: {0}")]
UnknownDeviceId(String),
/// Failed to find an available PCI device ID.
@@ -649,7 +649,7 @@ pub enum DeviceManagerError {
InvalidIdentifier(String),
/// vfio-user socket path already in use by another user device.
#[error("vfio-user socket path already in use: {0:?}")]
#[error("VFIO-user socket path already in use: {0:?}")]
UserDeviceSocketInUse(path::PathBuf),
/// Failed retrieving device state from snapshot

View File

@@ -104,7 +104,7 @@ pub enum Error {
#[error("Error decoding host data")]
FailedToDecodeHostData(#[source] hex::FromHexError),
#[error("Error allocating address space")]
MemoryManager(MemoryManagerError),
MemoryManager(#[source] MemoryManagerError),
#[error("IGVM file not provided")]
MissingIgvm,
#[error("Error applying VMSA to vCPU registers: {0}")]

View File

@@ -37,8 +37,6 @@ pub enum Error {
MemoryUnavailable,
#[error("failed to import pages")]
ImportPagesFailed,
#[error("invalid vp context memory")]
InvalidVpContextMemory(&'static str),
#[error("data larger than imported region")]
DataTooLarge,
}

View File

@@ -90,11 +90,11 @@ pub enum Error {
/// Cannot create seccomp filter.
#[error("Error creating seccomp filter")]
CreateSeccompFilter(seccompiler::Error),
CreateSeccompFilter(#[source] seccompiler::Error),
/// Cannot apply seccomp filter.
#[error("Error applying seccomp filter")]
ApplySeccompFilter(seccompiler::Error),
ApplySeccompFilter(#[source] seccompiler::Error),
}
pub type Result<T> = result::Result<T, Error>;