From 1a06bd1f0800468b0f3632a4357b8c2b4bf2cb15 Mon Sep 17 00:00:00 2001 From: "alex.lyn" Date: Mon, 30 Dec 2024 20:31:53 +0800 Subject: [PATCH] kata-types: Introduce annotation *_RUNTIME_CREATE_CONTAINTER_TIMEOUT It's used to indicate timeout value set for image pulling in guest during creating container. This allows users to set this timeout with annotation according to the size of image to be pulled. Fixes #10692 Signed-off-by: alex.lyn --- src/libs/kata-types/src/annotations/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libs/kata-types/src/annotations/mod.rs b/src/libs/kata-types/src/annotations/mod.rs index f44834486..f1b3d1a97 100644 --- a/src/libs/kata-types/src/annotations/mod.rs +++ b/src/libs/kata-types/src/annotations/mod.rs @@ -315,6 +315,9 @@ pub const KATA_ANNO_CFG_DISABLE_NEW_NETNS: &str = pub const KATA_ANNO_CFG_VFIO_MODE: &str = "io.katacontainers.config.runtime.vfio_mode"; /// An annotation to declare shared mount points, which is a set of mount points that directly share mounted objects between containers. pub const KATA_ANNO_CFG_SHARED_MOUNTS: &str = "io.katacontainers.config.runtime.shared_mounts"; +/// An annotation to set timeout value in second when do create container +pub const KATA_ANNO_CFG_RUNTIME_CREATE_CONTAINTER_TIMEOUT: &str = + "io.katacontainers.config.runtime.create_container_timeout"; /// A sandbox annotation used to specify prefetch_files.list host path container image /// being used, @@ -989,6 +992,14 @@ impl Annotation { return Err(u32_err); } }, + KATA_ANNO_CFG_RUNTIME_CREATE_CONTAINTER_TIMEOUT => match self.get_value::(key) { + Ok(v) => { + ag.request_timeout_ms = v.unwrap_or_default() * 1000; + } + Err(_e) => { + return Err(u32_err); + } + }, // update runtime config KATA_ANNO_CFG_RUNTIME_NAME => { let runtime = vec!["virt-container", "linux-container", "wasm-container"];