From e7b7344dbaa82b28c84127c9f5919bf3c6759bb1 Mon Sep 17 00:00:00 2001 From: Aditya R Date: Thu, 20 Apr 2023 13:46:06 +0530 Subject: [PATCH] rust: sync runtime-spec and image-spec * `runtime-spec` - `linux` add support for `time_offsets` - `cpu` add `burst` - `LinuxUidMapping` add `time` Signed-off-by: Aditya R --- src/image/mod.rs | 9 ++++++--- src/runtime/mod.rs | 48 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/image/mod.rs b/src/image/mod.rs index b0208122..5375c7d5 100644 --- a/src/image/mod.rs +++ b/src/image/mod.rs @@ -4,14 +4,14 @@ // extern crate serde_derive; // extern crate serde_json; // -// use generated_module::[object Object]; +// use generated_module::ImageSpec; // // fn main() { // let json = r#"{"answer": 42}"#; -// let model: [object Object] = serde_json::from_str(&json).unwrap(); +// let model: ImageSpec = serde_json::from_str(&json).unwrap(); // } -extern crate serde_derive; +use serde::{Serialize, Deserialize}; use std::collections::HashMap; /// OpenContainer Config Specification @@ -50,6 +50,9 @@ pub struct ImageSpec { #[derive(Serialize, Deserialize)] pub struct Config { + #[serde(rename = "ArgsEscaped")] + pub args_escaped: Option, + #[serde(rename = "Cmd")] pub cmd: Option>, diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs index 7236df8e..fbf12f54 100644 --- a/src/runtime/mod.rs +++ b/src/runtime/mod.rs @@ -4,14 +4,14 @@ // extern crate serde_derive; // extern crate serde_json; // -// use generated_module::[object Object]; +// use generated_module::Spec; // // fn main() { // let json = r#"{"answer": 42}"#; -// let model: [object Object] = serde_json::from_str(&json).unwrap(); +// let model: Spec = serde_json::from_str(&json).unwrap(); // } -extern crate serde_derive; +use serde::{Serialize, Deserialize}; use std::collections::HashMap; /// Open Container Initiative Runtime Specification Container Configuration Schema @@ -218,6 +218,9 @@ pub struct Linux { #[serde(rename = "sysctl")] pub sysctl: Option>>, + #[serde(rename = "timeOffsets")] + pub time_offsets: Option, + #[serde(rename = "uidMappings")] pub uid_mappings: Option>, } @@ -427,6 +430,9 @@ pub struct WeightDevice { #[derive(Serialize, Deserialize)] pub struct PurpleCpu { + #[serde(rename = "burst")] + pub burst: Option, + #[serde(rename = "cpus")] pub cpus: Option, @@ -483,6 +489,9 @@ pub struct HugepageLimit { #[derive(Serialize, Deserialize)] pub struct PurpleMemory { + #[serde(rename = "checkBeforeUpdate")] + pub check_before_update: Option, + #[serde(rename = "disableOOMKiller")] pub disable_oom_killer: Option, @@ -595,6 +604,33 @@ pub struct Arg { pub value_two: Option, } +#[derive(Serialize, Deserialize)] +pub struct TimeOffsets { + #[serde(rename = "boottime")] + pub boottime: Option, + + #[serde(rename = "monotonic")] + pub monotonic: Option, +} + +#[derive(Serialize, Deserialize)] +pub struct Boottime { + #[serde(rename = "nanosecs")] + pub nanosecs: Option, + + #[serde(rename = "secs")] + pub secs: Option, +} + +#[derive(Serialize, Deserialize)] +pub struct Monotonic { + #[serde(rename = "nanosecs")] + pub nanosecs: Option, + + #[serde(rename = "secs")] + pub secs: Option, +} + #[derive(Serialize, Deserialize)] pub struct LinuxUidMapping { #[serde(rename = "containerID")] @@ -1026,6 +1062,9 @@ pub enum Type { #[serde(rename = "pid")] Pid, + #[serde(rename = "time")] + Time, + #[serde(rename = "user")] User, @@ -1157,6 +1196,9 @@ pub enum Flag { #[serde(rename = "SECCOMP_FILTER_FLAG_TSYNC")] SeccompFilterFlagTsync, + + #[serde(rename = "SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV")] + SeccompFilterFlagWaitKillableRecv, } #[derive(Serialize, Deserialize)]