From aaf6d69089b0ca7c95ef6fcc1acf99ec4614f171 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Tue, 6 Sep 2022 16:39:42 +0800 Subject: [PATCH] runtime-rs: call TomlConfig's validate function after load Call TomlConfig's validate function after it is loaded and adjusted by annotations. Fixes: #5112 Signed-off-by: Bin Liu --- src/runtime-rs/Makefile | 2 +- src/runtime-rs/crates/runtimes/src/manager.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runtime-rs/Makefile b/src/runtime-rs/Makefile index e8358b6760..5a593ac9e7 100644 --- a/src/runtime-rs/Makefile +++ b/src/runtime-rs/Makefile @@ -84,7 +84,7 @@ DEFMEMSZ := 2048 # - hugepage memory DEFMEMSLOTS := 10 #Default number of bridges -DEFBRIDGES := 1 +DEFBRIDGES := 0 DEFENABLEANNOTATIONS := [] DEFDISABLEGUESTSECCOMP := true DEFDISABLEGUESTEMPTYDIR := false diff --git a/src/runtime-rs/crates/runtimes/src/manager.rs b/src/runtime-rs/crates/runtimes/src/manager.rs index 390cbac159..a21bc1847d 100644 --- a/src/runtime-rs/crates/runtimes/src/manager.rs +++ b/src/runtime-rs/crates/runtimes/src/manager.rs @@ -313,6 +313,9 @@ fn load_config(spec: &oci::Spec) -> Result { TomlConfig::load_from_file(&config_path).context("load toml config")?; annotation.update_config_by_annotation(&mut toml_config)?; + // validate configuration and return the error + toml_config.validate()?; + // Sandbox sizing information *may* be provided in two scenarios: // 1. The upper layer runtime (ie, containerd or crio) provide sandbox sizing information as an annotation // in the 'sandbox container's' spec. This would typically be a scenario where as part of a create sandbox