From 78b379831b99d7ad7674bb6890af833816d472e5 Mon Sep 17 00:00:00 2001 From: EMachin3 <95111563+EMachin3@users.noreply.github.com> Date: Sat, 28 Dec 2024 14:41:28 -0500 Subject: [PATCH 1/2] Log fallback due to lack of resources as info rather than error. Attempting to resolve issue #499. --- .../disk_nvme/nvme_driver/src/driver.rs | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs b/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs index ffc79bce8..e0e394d37 100644 --- a/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs +++ b/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs @@ -98,6 +98,12 @@ pub enum RestoreError { InvalidData, } +#[derive(Debug, Error)] +pub enum IOError { + #[error("no more io queues available")] + NoMoreIoQueues, +} + #[derive(Inspect)] struct IoQueue { queue: QueuePair, @@ -797,12 +803,23 @@ impl DriverWorkerTask { .find_map(|(i, issuer)| issuer.get().map(|issuer| (i, issuer))) .unwrap(); - tracing::error!( - cpu, - fallback_cpu, - error = err.as_ref() as &dyn std::error::Error, - "failed to create io queue, falling back" - ); + // Error due to running out of IO queues as a result of + // lack of hardware resources should be logged as INFO + if err.downcast_ref::().is_some() { + tracing::info!( + cpu, + fallback_cpu, + error = err.as_ref() as &dyn std::error::Error, + "failed to create io queue, falling back" + ); + } else { + tracing::error!( + cpu, + fallback_cpu, + error = err.as_ref() as &dyn std::error::Error, + "failed to create io queue, falling back" + ); + } fallback.clone() } }; @@ -819,7 +836,7 @@ impl DriverWorkerTask { cpu: u32, ) -> anyhow::Result { if self.io.len() >= state.max_io_queues as usize { - anyhow::bail!("no more io queues available"); + anyhow::bail!(IOError::NoMoreIoQueues); } let qid = self.io.len() as u16 + 1; @@ -1109,3 +1126,4 @@ pub mod save_restore { pub identify_ns: nvme_spec::nvm::IdentifyNamespace, } } + From b9a23b98052a774b593272d911330e551e6c748d Mon Sep 17 00:00:00 2001 From: EMachin3 <95111563+EMachin3@users.noreply.github.com> Date: Sat, 28 Dec 2024 14:55:53 -0500 Subject: [PATCH 2/2] small newline linting fix --- vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs b/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs index e0e394d37..e3bdf29b7 100644 --- a/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs +++ b/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs @@ -1126,4 +1126,3 @@ pub mod save_restore { pub identify_ns: nvme_spec::nvm::IdentifyNamespace, } } -