From 45c0364d4c09c6fd58c2963899c5e3e39ba3b953 Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Mon, 4 Dec 2023 14:16:13 +0000 Subject: [PATCH 1/2] runtime-rs: Fix typo in task service "failed to handler message" -> "failed to handle message". Signed-off-by: James O. D. Hunt --- src/runtime-rs/crates/service/src/task_service.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime-rs/crates/service/src/task_service.rs b/src/runtime-rs/crates/service/src/task_service.rs index 9db1bcbe4d..630d6493c8 100644 --- a/src/runtime-rs/crates/service/src/task_service.rs +++ b/src/runtime-rs/crates/service/src/task_service.rs @@ -43,7 +43,7 @@ impl TaskService { debug!(logger, "====> task service {:?}", &r); let resp = self.handler.handler_message(r).await.map_err(|err| { - ttrpc::Error::Others(format!("failed to handler message {:?}", err)) + ttrpc::Error::Others(format!("failed to handle message {:?}", err)) })?; debug!(logger, "<==== task service {:?}", &resp); resp.try_into() From d627893975a3c5b2f446d931540bfcb20f83ad6d Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Mon, 4 Dec 2023 14:14:10 +0000 Subject: [PATCH 2/2] runtime-rs: Show config files attempted on config load failure PR #8483 changed the location of the rust runtime config files to `/etc/kata-containers/runtime-rs/`. However, if you haven't updated your system to create that directory, attempting to create a container using the rust runtime was giving the following cryptic message (formatted for easier reading): ``` failed to handler message try init runtime instance Caused by: 0: load config 1: load toml config 2: entity not found ``` Now, the message is as follows (again, reformatted for easier reading): ``` failed to handle message try init runtime instance Caused by: 0: load config 1: load TOML config failed (tried [ \"/etc/kata-containers/runtime-rs/configuration.toml\", \"/usr/share/defaults/kata-containers/runtime-rs/configuration.toml\", \"/opt/kata/share/defaults/kata-containers/runtime-rs/configuration.toml\" ]) ``` Fixes: #8557. Signed-off-by: James O. D. Hunt --- src/libs/kata-types/src/config/mod.rs | 8 ++++++++ src/runtime-rs/crates/runtimes/src/manager.rs | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libs/kata-types/src/config/mod.rs b/src/libs/kata-types/src/config/mod.rs index 52b621d12c..dcfbadf3fa 100644 --- a/src/libs/kata-types/src/config/mod.rs +++ b/src/libs/kata-types/src/config/mod.rs @@ -216,6 +216,14 @@ impl TomlConfig { Err(io::Error::from(io::ErrorKind::NotFound)) } + + /// Return a list of default config file paths. + pub fn get_default_config_file_list() -> Vec { + default::DEFAULT_RUNTIME_CONFIGURATIONS + .iter() + .map(|s| PathBuf::from(*s)) + .collect() + } } /// Validate the `path` matches one of the pattern in `patterns`. diff --git a/src/runtime-rs/crates/runtimes/src/manager.rs b/src/runtime-rs/crates/runtimes/src/manager.rs index 51b0985751..04ccf6c011 100644 --- a/src/runtime-rs/crates/runtimes/src/manager.rs +++ b/src/runtime-rs/crates/runtimes/src/manager.rs @@ -489,8 +489,10 @@ fn load_config(spec: &oci::Spec, option: &Option>) -> Result let logger = slog::Logger::clone(&slog_scope::logger()); info!(logger, "get config path {:?}", &config_path); - let (mut toml_config, _) = - TomlConfig::load_from_file(&config_path).context("load toml config")?; + let (mut toml_config, _) = TomlConfig::load_from_file(&config_path).context(format!( + "load TOML config failed (tried {:?})", + TomlConfig::get_default_config_file_list() + ))?; annotation.update_config_by_annotation(&mut toml_config)?; update_agent_kernel_params(&mut toml_config)?;