diff --git a/src/libs/kata-types/src/mount.rs b/src/libs/kata-types/src/mount.rs index 339cce05f6..f66e828bd1 100644 --- a/src/libs/kata-types/src/mount.rs +++ b/src/libs/kata-types/src/mount.rs @@ -5,7 +5,7 @@ // use anyhow::{anyhow, Context, Result}; -use std::path::PathBuf; +use std::{collections::HashMap, path::PathBuf}; /// Prefix to mark a volume as Kata special. pub const KATA_VOLUME_TYPE_PREFIX: &str = "kata:"; @@ -19,6 +19,12 @@ pub const KATA_EPHEMERAL_VOLUME_TYPE: &str = "ephemeral"; /// KATA_HOST_DIR_TYPE use for host empty dir pub const KATA_HOST_DIR_VOLUME_TYPE: &str = "kata:hostdir"; +/// KATA_MOUNT_INFO_FILE_NAME is used for the file that holds direct-volume mount info +pub const KATA_MOUNT_INFO_FILE_NAME: &str = "mountInfo.json"; + +/// KATA_DIRECT_VOLUME_ROOT_PATH is the root path used for concatenating with the direct-volume mount info file path +pub const KATA_DIRECT_VOLUME_ROOT_PATH: &str = "/run/kata-containers/shared/direct-volumes"; + /// Information about a mount. #[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] pub struct Mount { @@ -49,6 +55,22 @@ impl Mount { } } +/// DirectVolumeMountInfo contains the information needed by Kata +/// to consume a host block device and mount it as a filesystem inside the guest VM. +#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] +pub struct DirectVolumeMountInfo { + /// The type of the volume (ie. block) + pub volume_type: String, + /// The device backing the volume. + pub device: String, + /// The filesystem type to be mounted on the volume. + pub fs_type: String, + /// Additional metadata to pass to the agent regarding this volume. + pub metadata: HashMap, + /// Additional mount options. + pub options: Vec, +} + /// Check whether a mount type is a marker for Kata specific volume. pub fn is_kata_special_volume(ty: &str) -> bool { ty.len() > KATA_VOLUME_TYPE_PREFIX.len() && ty.starts_with(KATA_VOLUME_TYPE_PREFIX) diff --git a/src/libs/shim-interface/src/shim_mgmt/client.rs b/src/libs/shim-interface/src/shim_mgmt/client.rs index 5c6a67f101..ace72c1d60 100644 --- a/src/libs/shim-interface/src/shim_mgmt/client.rs +++ b/src/libs/shim-interface/src/shim_mgmt/client.rs @@ -35,7 +35,7 @@ impl MgmtClient { let unix_socket_path = mgmt_socket_addr(sid).context("Failed to get unix socket path")?; let s_addr = unix_socket_path .strip_prefix("unix:") - .context("failed to strix prefix")?; + .context("failed to strip prefix")?; let sock_path = Path::new("/").join(s_addr).as_path().to_owned(); let client = Client::unix(); Ok(Self { @@ -49,32 +49,52 @@ impl MgmtClient { /// Parameter uri should be like "/agent-url" etc. pub async fn get(&self, uri: &str) -> Result> { let url: hyper::Uri = Uri::new(&self.sock_path, uri).into(); - let work = self.client.get(url); - match self.timeout { - Some(timeout) => match tokio::time::timeout(timeout, work).await { - Ok(result) => result.map_err(|e| anyhow!(e)), - Err(_) => Err(anyhow!("TIMEOUT")), - }, - // if timeout not set, work executes directly - None => work.await.context("failed to GET"), - } + let req = Request::builder() + .method(Method::GET) + .uri(url) + .body(Body::empty())?; + return self.send_request(req).await; + } + + /// The HTTP Post method for client + pub async fn post( + &self, + uri: &str, + content_type: &str, + content: &str, + ) -> Result> { + let url: hyper::Uri = Uri::new(&self.sock_path, uri).into(); + + // build body from content + let body = Body::from(content.to_string()); + let req = Request::builder() + .method(Method::POST) + .uri(url) + .header("content-type", content_type) + .body(body)?; + return self.send_request(req).await; } /// The http PUT method for client pub async fn put(&self, uri: &str, data: Vec) -> Result> { let url: hyper::Uri = Uri::new(&self.sock_path, uri).into(); - let request = Request::builder() + let req = Request::builder() .method(Method::PUT) .uri(url) - .body(Body::from(data)) - .unwrap(); - let work = self.client.request(request); + .body(Body::from(data))?; + return self.send_request(req).await; + } + + async fn send_request(&self, req: Request) -> Result> { + let msg = format!("Request ({:?}) to uri {:?}", req.method(), req.uri()); + let resp = self.client.request(req); match self.timeout { - Some(timeout) => match tokio::time::timeout(timeout, work).await { + Some(timeout) => match tokio::time::timeout(timeout, resp).await { Ok(result) => result.map_err(|e| anyhow!(e)), - Err(_) => Err(anyhow!("TIMEOUT")), + Err(_) => Err(anyhow!("{:?} timeout after {:?}", msg, self.timeout)), }, - None => work.await.context("failed to PUT"), + // if client timeout is not set, request waits with no deadline + None => resp.await.context(format!("{:?} failed", msg)), } } } diff --git a/src/runtime-rs/crates/agent/src/lib.rs b/src/runtime-rs/crates/agent/src/lib.rs index 8ef76ebbe2..a3d1da72ac 100644 --- a/src/runtime-rs/crates/agent/src/lib.rs +++ b/src/runtime-rs/crates/agent/src/lib.rs @@ -20,8 +20,8 @@ pub use types::{ GetIPTablesResponse, GuestDetailsResponse, HealthCheckResponse, IPAddress, IPFamily, Interface, Interfaces, ListProcessesRequest, MemHotplugByProbeRequest, OnlineCPUMemRequest, OomEventResponse, ReadStreamRequest, ReadStreamResponse, RemoveContainerRequest, - ReseedRandomDevRequest, Route, Routes, SetGuestDateTimeRequest, SetIPTablesRequest, - SetIPTablesResponse, SignalProcessRequest, StatsContainerResponse, Storage, + ReseedRandomDevRequest, ResizeVolumeRequest, Route, Routes, SetGuestDateTimeRequest, + SetIPTablesRequest, SetIPTablesResponse, SignalProcessRequest, StatsContainerResponse, Storage, TtyWinResizeRequest, UpdateContainerRequest, UpdateInterfaceRequest, UpdateRoutesRequest, VersionCheckResponse, WaitProcessRequest, WaitProcessResponse, WriteStreamRequest, WriteStreamResponse, diff --git a/src/runtime-rs/crates/agent/src/types.rs b/src/runtime-rs/crates/agent/src/types.rs index 4c71534ecf..b8e79589ad 100644 --- a/src/runtime-rs/crates/agent/src/types.rs +++ b/src/runtime-rs/crates/agent/src/types.rs @@ -7,7 +7,7 @@ use anyhow::{anyhow, Result}; use std::convert::TryFrom; -use serde::Deserialize; +use serde::{Deserialize, Serialize}; #[derive(PartialEq, Clone, Default)] pub struct Empty {} @@ -561,6 +561,14 @@ pub struct OomEventResponse { pub container_id: String, } +// ResizeVolumeRequest is also the common struct for serialization and deserialization with json +// between shim-client HTTP calls to the shim-mgmt-server +#[derive(Serialize, Deserialize, PartialEq, Clone, Default, Debug)] +pub struct ResizeVolumeRequest { + pub volume_guest_path: String, + pub size: u64, +} + #[cfg(test)] mod test { use std::convert::TryFrom; diff --git a/src/tools/kata-ctl/Cargo.lock b/src/tools/kata-ctl/Cargo.lock index e1c794294b..0db5779e96 100644 --- a/src/tools/kata-ctl/Cargo.lock +++ b/src/tools/kata-ctl/Cargo.lock @@ -2,42 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "actix-macros" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "actix-rt" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000" -dependencies = [ - "actix-macros", - "futures-core", - "tokio", -] - -[[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "agent" version = "0.1.0" @@ -69,15 +33,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "anyhow" version = "1.0.65" @@ -86,141 +41,21 @@ checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" [[package]] name = "arc-swap" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "async-channel" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" -dependencies = [ - "concurrent-queue 1.2.4", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" -dependencies = [ - "async-lock", - "async-task", - "concurrent-queue 2.0.0", - "fastrand", - "futures-lite", - "slab", -] - -[[package]] -name = "async-global-executor" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" -dependencies = [ - "async-channel", - "async-executor", - "async-io", - "async-lock", - "blocking", - "futures-lite", - "once_cell", -] - -[[package]] -name = "async-io" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" -dependencies = [ - "async-lock", - "autocfg", - "concurrent-queue 2.0.0", - "futures-lite", - "libc", - "log", - "parking", - "polling", - "slab", - "socket2", - "waker-fn", - "windows-sys 0.42.0", -] - -[[package]] -name = "async-lock" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" -dependencies = [ - "event-listener", - "futures-lite", -] - -[[package]] -name = "async-std" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" -dependencies = [ - "async-channel", - "async-global-executor", - "async-io", - "async-lock", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "once_cell", - "pin-project-lite", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-task" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "atomic-waker" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" - [[package]] name = "atty" version = "0.2.14" @@ -238,27 +73,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "awaitgroup" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc17ab023b4091c10ff099f9deebaeeb59b5189df07e554c4fef042b70745d68" - -[[package]] -name = "backtrace" -version = "0.3.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" -dependencies = [ - "addr2line", - "cc", - "cfg-if 1.0.0", - "libc", - "miniz_oxide 0.5.4", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.13.0" @@ -281,43 +95,6 @@ dependencies = [ "syn", ] -[[package]] -name = "blake3" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if 1.0.0", - "constant_time_eq", - "digest", -] - -[[package]] -name = "block-buffer" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" -dependencies = [ - "generic-array", -] - -[[package]] -name = "blocking" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" -dependencies = [ - "async-channel", - "async-lock", - "async-task", - "atomic-waker", - "fastrand", - "futures-lite", -] - [[package]] name = "bumpalo" version = "3.11.0" @@ -352,36 +129,11 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - -[[package]] -name = "caps" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190baaad529bcfbde9e1a19022c42781bdb6ff9de25721abdb8fd98c0807730b" -dependencies = [ - "libc", - "thiserror", -] - [[package]] name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" @@ -389,33 +141,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cgroups-rs" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3845d8ddaca63e9975f07b7a32262afe284561c2f0f620aa968913a65f671fd2" -dependencies = [ - "libc", - "log", - "nix 0.24.2", - "regex", -] - -[[package]] -name = "chrono" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-integer", - "num-traits", - "time 0.1.43", - "wasm-bindgen", - "winapi", -] - [[package]] name = "clap" version = "3.2.22" @@ -455,81 +180,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "common" -version = "0.1.0" -dependencies = [ - "agent", - "anyhow", - "async-trait", - "containerd-shim-protos", - "kata-sys-util", - "kata-types", - "lazy_static", - "nix 0.24.2", - "oci", - "persist", - "protobuf", - "serde_json", - "slog", - "slog-scope", - "strum", - "thiserror", - "tokio", - "ttrpc", -] - -[[package]] -name = "common-path" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" - -[[package]] -name = "concurrent-queue" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" -dependencies = [ - "cache-padded", -] - -[[package]] -name = "concurrent-queue" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "constant_time_eq" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" - -[[package]] -name = "containerd-shim-protos" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "077ec778a0835d9d85502e8535362130187759b69eddabe2bdb3a68ffb575bd0" -dependencies = [ - "async-trait", - "protobuf", - "ttrpc", -] - [[package]] name = "core-foundation" version = "0.9.3" @@ -546,31 +196,13 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" -[[package]] -name = "cpufeatures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "crossbeam-channel" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -580,228 +212,7 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "ctor" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "cxx" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dashmap" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" -dependencies = [ - "cfg-if 1.0.0", - "num_cpus", -] - -[[package]] -name = "dbs-address-space" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bcc37dc0b8ffae1c5911d13ae630dc7a9020fa0de0edd178d6ab71daf56c8fc" -dependencies = [ - "arc-swap", - "libc", - "nix 0.23.1", - "thiserror", - "vm-memory", - "vmm-sys-util 0.11.0", -] - -[[package]] -name = "dbs-allocator" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "543711b94b4bc1437d2ebb45f856452e96a45a67ab39f8dcf8c887c2a3701004" -dependencies = [ - "thiserror", -] - -[[package]] -name = "dbs-arch" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f89357fc97fb3608473073be037ea0b22787b1fa4c68b8eb3dd51f3c5fd6b41" -dependencies = [ - "kvm-bindings", - "kvm-ioctls", - "libc", - "memoffset", - "vm-memory", - "vmm-sys-util 0.11.0", -] - -[[package]] -name = "dbs-boot" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6930547e688d8527705d1b7c4163c090c8535b8dd526d8251aa4dfdcbf2f82" -dependencies = [ - "dbs-arch", - "kvm-bindings", - "kvm-ioctls", - "lazy_static", - "libc", - "thiserror", - "vm-fdt", - "vm-memory", -] - -[[package]] -name = "dbs-device" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ecea44b4bc861c0c2ccb51868bea781286dc70e40ae46b54d4511e690a654a" -dependencies = [ - "thiserror", -] - -[[package]] -name = "dbs-interrupt" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f217820329cea9d8d2870f9cdda426c5ca4379e33283c39338841a86bdc36c" -dependencies = [ - "dbs-device", - "kvm-bindings", - "kvm-ioctls", - "libc", - "vmm-sys-util 0.11.0", -] - -[[package]] -name = "dbs-legacy-devices" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d089ac1c4d186c8133be59de09462e9793f7add10017c5b040318a3a7f431f" -dependencies = [ - "dbs-device", - "dbs-utils", - "log", - "serde", - "vm-superio", - "vmm-sys-util 0.11.0", -] - -[[package]] -name = "dbs-uhttp" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcab9b457bf9cac784c38ad87a37eb15dad06e72751acdd556e442b3aa4b7248" -dependencies = [ - "libc", - "mio", -] - -[[package]] -name = "dbs-utils" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb6ff873451b76e22789af7fbe1d0478c42c717f817e66908be7a3a2288068c" -dependencies = [ - "anyhow", - "event-manager", - "libc", - "log", - "serde", - "thiserror", - "timerfd", - "vmm-sys-util 0.11.0", -] - -[[package]] -name = "dbs-virtio-devices" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f70cc3a62fa1c169beca6921ef0d3cf38fdfe7cd732ac76c8517bc8a3df9338" -dependencies = [ - "byteorder", - "caps", - "dbs-device", - "dbs-interrupt", - "dbs-utils", - "epoll", - "fuse-backend-rs", - "io-uring", - "kvm-bindings", - "kvm-ioctls", - "libc", - "log", - "nix 0.23.1", - "nydus-blobfs", - "nydus-rafs", - "rlimit", - "serde", - "serde_json", - "thiserror", - "threadpool", - "virtio-bindings", - "virtio-queue", - "vm-memory", - "vmm-sys-util 0.11.0", + "cfg-if", ] [[package]] @@ -815,51 +226,6 @@ dependencies = [ "syn", ] -[[package]] -name = "digest" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "dragonball" -version = "0.1.0" -dependencies = [ - "arc-swap", - "bytes 1.2.1", - "dbs-address-space", - "dbs-allocator", - "dbs-arch", - "dbs-boot", - "dbs-device", - "dbs-interrupt", - "dbs-legacy-devices", - "dbs-utils", - "dbs-virtio-devices", - "kvm-bindings", - "kvm-ioctls", - "lazy_static", - "libc", - "linux-loader", - "log", - "nix 0.24.2", - "seccompiler", - "serde", - "serde_derive", - "serde_json", - "slog", - "slog-scope", - "thiserror", - "virtio-queue", - "vm-memory", - "vmm-sys-util 0.11.0", -] - [[package]] name = "either" version = "1.8.0" @@ -872,65 +238,7 @@ version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "epoll" -version = "4.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20df693c700404f7e19d4d6fae6b15215d2913c27955d2b9d6f2c0f537511cd0" -dependencies = [ - "bitflags", - "libc", -] - -[[package]] -name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "event-manager" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377fa591135fbe23396a18e2655a6d5481bf7c5823cdfa3cc81b01a229cbe640" -dependencies = [ - "libc", - "vmm-sys-util 0.11.0", -] - -[[package]] -name = "fail" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe5e43d0f78a42ad591453aedb1d7ae631ce7ee445c7643691055a9ed8d3b01c" -dependencies = [ - "log", - "once_cell", - "rand 0.8.5", + "cfg-if", ] [[package]] @@ -948,16 +256,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" -[[package]] -name = "flate2" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" -dependencies = [ - "crc32fast", - "miniz_oxide 0.6.2", -] - [[package]] name = "fnv" version = "1.0.7" @@ -988,37 +286,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - -[[package]] -name = "fuse-backend-rs" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "994a3bfb694ee52bf8f3bca80d784b723f150810998219337e429cc5dbe92717" -dependencies = [ - "arc-swap", - "bitflags", - "caps", - "core-foundation-sys", - "io-uring", - "lazy_static", - "libc", - "log", - "mio", - "nix 0.24.2", - "scoped-tls", - "slab", - "socket2", - "tokio-uring", - "virtio-queue", - "vm-memory", - "vmm-sys-util 0.10.0", -] - [[package]] name = "futures" version = "0.3.25" @@ -1067,21 +334,6 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" -[[package]] -name = "futures-lite" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-macro" version = "0.3.25" @@ -1105,12 +357,6 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" - [[package]] name = "futures-util" version = "0.3.25" @@ -1129,88 +375,12 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.14.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "gimli" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" - [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -[[package]] -name = "gloo-timers" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "go-flag" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4a40c9ca507513f573aabaf6a8558173a1ac9aa1363d8de30c7f89b34f8d2b" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "governor" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7df0ee4b237afb71e99f7e2fbd840ffec2d6c4bb569f69b2af18aa1f63077d38" -dependencies = [ - "dashmap", - "futures", - "futures-timer", - "no-std-compat", - "nonzero_ext", - "parking_lot 0.11.2", - "quanta", - "rand 0.8.5", - "smallvec", -] - [[package]] name = "h2" version = "0.3.14" @@ -1440,23 +610,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "io-lifetimes" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9448015e586b611e5d322f6703812bbca2f1e709d5773ecd38ddb4e3bb649504" - -[[package]] -name = "io-uring" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba34abb5175052fc1a2227a10d2275b7386c9990167de9786c0b88d8b062330" -dependencies = [ - "bitflags", - "libc", + "cfg-if", ] [[package]] @@ -1489,15 +643,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" -[[package]] -name = "jobserver" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.60" @@ -1511,42 +656,26 @@ dependencies = [ name = "kata-ctl" version = "0.0.1" dependencies = [ + "agent", "anyhow", + "base64", "clap", + "futures", + "kata-types", "nix 0.25.0", "privdrop", "reqwest", - "runtimes", + "safe-path", "semver", "serde", "serde_json", + "shim-interface", "strum", "strum_macros", "tempfile", + "test-utils", "thiserror", -] - -[[package]] -name = "kata-sys-util" -version = "0.1.0" -dependencies = [ - "byteorder", - "cgroups-rs", - "chrono", - "common-path", - "fail", - "kata-types", - "lazy_static", - "libc", - "nix 0.24.2", - "oci", - "once_cell", - "rand 0.7.3", - "serde_json", - "slog", - "slog-scope", - "subprocess", - "thiserror", + "url", ] [[package]] @@ -1567,36 +696,7 @@ dependencies = [ "slog", "slog-scope", "thiserror", - "toml 0.5.9", -] - -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - -[[package]] -name = "kvm-bindings" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78c049190826fff959994b7c1d8a2930d0a348f1b8f3aa4f9bb34cd5d7f2952" -dependencies = [ - "vmm-sys-util 0.11.0", -] - -[[package]] -name = "kvm-ioctls" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97422ba48d7ffb66fd4d18130f72ab66f9bbbf791fb7a87b9291cdcfec437593" -dependencies = [ - "kvm-bindings", - "libc", - "vmm-sys-util 0.11.0", + "toml", ] [[package]] @@ -1611,48 +711,13 @@ version = "0.2.135" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" -[[package]] -name = "link-cplusplus" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" -dependencies = [ - "cc", -] - -[[package]] -name = "linux-loader" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62a2f912deca034ec34b0a43a390059ea98daac40e440ebe8bea88f3315fe168" -dependencies = [ - "vm-memory", -] - -[[package]] -name = "linux-raw-sys" -version = "0.0.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" - -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - [[package]] name = "log" version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", - "value-bag", + "cfg-if", ] [[package]] @@ -1666,25 +731,6 @@ dependencies = [ "slog-scope", ] -[[package]] -name = "lz4-sys" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - [[package]] name = "memchr" version = "2.5.0" @@ -1706,24 +752,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "miniz_oxide" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" -dependencies = [ - "adler", -] - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - [[package]] name = "mio" version = "0.8.4" @@ -1732,8 +760,8 @@ checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.36.1", + "wasi", + "windows-sys", ] [[package]] @@ -1760,81 +788,15 @@ dependencies = [ "tempfile", ] -[[package]] -name = "netlink-packet-core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" -dependencies = [ - "anyhow", - "byteorder", - "libc", - "netlink-packet-utils", -] - -[[package]] -name = "netlink-packet-route" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5dee5ed749373c298237fe694eb0a51887f4cc1a27370c8464bac4382348f1a" -dependencies = [ - "anyhow", - "bitflags", - "byteorder", - "libc", - "netlink-packet-core", - "netlink-packet-utils", -] - -[[package]] -name = "netlink-packet-utils" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" -dependencies = [ - "anyhow", - "byteorder", - "paste", - "thiserror", -] - -[[package]] -name = "netlink-proto" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" -dependencies = [ - "bytes 1.2.1", - "futures", - "log", - "netlink-packet-core", - "netlink-sys", - "thiserror", - "tokio", -] - -[[package]] -name = "netlink-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b654097027250401127914afb37cb1f311df6610a9891ff07a757e94199027" -dependencies = [ - "bytes 1.2.1", - "futures", - "libc", - "log", - "tokio", -] - [[package]] name = "nix" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" +checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" dependencies = [ "bitflags", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", ] @@ -1846,7 +808,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", ] @@ -1859,43 +821,12 @@ checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb" dependencies = [ "autocfg", "bitflags", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", "pin-utils", ] -[[package]] -name = "no-std-compat" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" - -[[package]] -name = "nonzero_ext" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - [[package]] name = "num_cpus" version = "1.13.1" @@ -1906,144 +837,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nydus-api" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61fbfbdb58ff07bed50b412d4315b3c5808979bb5decb56706ac66d53daf2cf3" -dependencies = [ - "dbs-uhttp", - "http", - "lazy_static", - "libc", - "log", - "mio", - "nydus-error", - "nydus-utils", - "serde", - "serde_derive", - "serde_json", - "url", - "vmm-sys-util 0.10.0", -] - -[[package]] -name = "nydus-blobfs" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef818ecadc217f49ce8d48506b885d8d26f877d26b0108d90d8b82547663d95" -dependencies = [ - "fuse-backend-rs", - "libc", - "log", - "nydus-error", - "nydus-rafs", - "nydus-storage", - "serde", - "serde_json", - "vm-memory", -] - -[[package]] -name = "nydus-error" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90960fb7268286328d11f18e747bed58d8e3bbea6f401bd316e91fe39f4f7213" -dependencies = [ - "backtrace", - "httpdate", - "libc", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "nydus-rafs" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a06e8b0b4a90acc2d128d2f3b1ab6ae5d325116f1f69754bd3628dbd4499f4" -dependencies = [ - "anyhow", - "arc-swap", - "bitflags", - "blake3", - "fuse-backend-rs", - "futures", - "lazy_static", - "libc", - "log", - "lz4-sys", - "nix 0.24.2", - "nydus-api", - "nydus-error", - "nydus-storage", - "nydus-utils", - "serde", - "serde_json", - "sha2", - "spmc", - "vm-memory", -] - -[[package]] -name = "nydus-storage" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5dd10c443f47a0ac7d71021f7658a605c2be5b46576a91f3238babbaf3f459e" -dependencies = [ - "anyhow", - "arc-swap", - "bitflags", - "dbs-uhttp", - "fuse-backend-rs", - "futures", - "governor", - "lazy_static", - "libc", - "log", - "nix 0.24.2", - "nydus-api", - "nydus-error", - "nydus-utils", - "serde", - "serde_json", - "sha2", - "tokio", - "vm-memory", - "vmm-sys-util 0.10.0", -] - -[[package]] -name = "nydus-utils" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7e976c67052c3ff63372e2a07701923796d25a77eac605824b26d406ab0918" -dependencies = [ - "blake3", - "flate2", - "lazy_static", - "libc", - "log", - "lz4-sys", - "nix 0.24.2", - "nydus-error", - "serde", - "serde_json", - "sha2", - "tokio", - "zstd", -] - -[[package]] -name = "object" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" -dependencies = [ - "memchr", -] - [[package]] name = "oci" version = "0.1.0" @@ -2067,7 +860,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -2111,66 +904,6 @@ version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" -[[package]] -name = "parking" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.5", -] - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core 0.9.4", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if 1.0.0", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall", - "smallvec", - "windows-sys 0.42.0", -] - -[[package]] -name = "paste" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" - [[package]] name = "percent-encoding" version = "2.2.0" @@ -2240,26 +973,6 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" -[[package]] -name = "polling" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7d73f1eaed1ca1fb37b54dcc9b38e3b17d6c7b8ecb7abfffcac8d0351f17d4" -dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "libc", - "log", - "wepoll-ffi", - "windows-sys 0.42.0", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - [[package]] name = "privdrop" version = "0.5.2" @@ -2404,22 +1117,6 @@ dependencies = [ "ttrpc-codegen", ] -[[package]] -name = "quanta" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20afe714292d5e879d8b12740aa223c6a88f118af41870e8b6196e39a02238a8" -dependencies = [ - "crossbeam-utils", - "libc", - "mach", - "once_cell", - "raw-cpuid", - "wasi 0.10.2+wasi-snapshot-preview1", - "web-sys", - "winapi", -] - [[package]] name = "quote" version = "1.0.21" @@ -2429,133 +1126,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" -dependencies = [ - "libc", - "rand 0.4.6", -] - -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.8", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "raw-cpuid" -version = "10.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6823ea29436221176fe662da99998ad3b4db2c7f31e7b6f5fe43adccd6320bb" -dependencies = [ - "bitflags", -] - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -2633,39 +1203,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "resource" -version = "0.1.0" -dependencies = [ - "actix-rt", - "agent", - "anyhow", - "async-trait", - "bitflags", - "cgroups-rs", - "futures", - "hypervisor", - "kata-sys-util", - "kata-types", - "lazy_static", - "libc", - "logging", - "netlink-packet-route", - "netlink-sys", - "nix 0.24.2", - "oci", - "persist", - "rand 0.7.3", - "rtnetlink", - "scopeguard", - "serde", - "serde_json", - "slog", - "slog-scope", - "tokio", - "uuid", -] - [[package]] name = "ring" version = "0.16.20" @@ -2793,27 +1330,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys 0.36.1", + "windows-sys", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "scratch" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" - [[package]] name = "sct" version = "0.7.0" @@ -2824,15 +1343,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "seccompiler" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01d1292a1131b22ccea49f30bd106f1238b5ddeec1a98d39268dcc31d540e68" -dependencies = [ - "libc", -] - [[package]] name = "security-framework" version = "2.7.0" @@ -2971,7 +1481,7 @@ dependencies = [ "serde", "serde_json", "slog", - "time 0.3.17", + "time", ] [[package]] @@ -2985,12 +1495,6 @@ dependencies = [ "slog", ] -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - [[package]] name = "socket2" version = "0.4.7" @@ -3007,12 +1511,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -[[package]] -name = "spmc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02a8428da277a8e3a15271d79943e80ccc2ef254e78813a166a08d65e4c3ece5" - [[package]] name = "strsim" version = "0.10.0" @@ -3024,9 +1522,6 @@ name = "strum" version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" -dependencies = [ - "strum_macros", -] [[package]] name = "strum_macros" @@ -3041,22 +1536,6 @@ dependencies = [ "syn", ] -[[package]] -name = "subprocess" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c2e86926081dda636c546d8c5e641661049d7562a68f5488be4a1f7f66f6086" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - [[package]] name = "syn" version = "1.0.105" @@ -3080,7 +1559,7 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", @@ -3097,6 +1576,13 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "test-utils" +version = "0.1.0" +dependencies = [ + "nix 0.24.2", +] + [[package]] name = "textwrap" version = "0.15.1" @@ -3132,25 +1618,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "time" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "time" version = "0.3.17" @@ -3178,15 +1645,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "timerfd" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f85a7c965b8e7136952f59f2a359694c78f105b2d2ff99cf6c2c404bf7e33f" -dependencies = [ - "rustix", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -3214,9 +1672,7 @@ dependencies = [ "memchr", "mio", "num_cpus", - "parking_lot 0.12.1", "pin-project-lite", - "signal-hook-registry", "socket2", "tokio-macros", "winapi", @@ -3224,9 +1680,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.8.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", @@ -3254,20 +1710,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "tokio-uring" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3ad494f39874984d990ade7f6319dafbcd3301ff0b1841f8a55a1ebb3e742c8" -dependencies = [ - "io-uring", - "libc", - "scoped-tls", - "slab", - "socket2", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.4" @@ -3297,18 +1739,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.4.10" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" -dependencies = [ - "serde", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "serde", ] @@ -3325,7 +1758,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-core", ] @@ -3356,7 +1789,7 @@ dependencies = [ "futures", "libc", "log", - "nix 0.23.1", + "nix 0.23.2", "protobuf", "protobuf-codegen-pure", "thiserror", @@ -3391,12 +1824,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - [[package]] name = "unicode-bidi" version = "0.3.8" @@ -3424,12 +1851,6 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - [[package]] name = "untrusted" version = "0.7.1" @@ -3447,25 +1868,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "uuid" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cfec50b0842181ba6e713151b72f4ec84a6a7e2c9c8a8a3ffc37bb1cd16b231" -dependencies = [ - "rand 0.3.23", -] - -[[package]] -name = "value-bag" -version = "1.0.0-alpha.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" -dependencies = [ - "ctor", - "version_check", -] - [[package]] name = "vcpkg" version = "0.2.15" @@ -3478,99 +1880,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "virt_container" -version = "0.1.0" -dependencies = [ - "agent", - "anyhow", - "async-std", - "async-trait", - "awaitgroup", - "common", - "containerd-shim-protos", - "futures", - "hypervisor", - "kata-sys-util", - "kata-types", - "lazy_static", - "libc", - "logging", - "nix 0.24.2", - "oci", - "persist", - "protobuf", - "resource", - "serde", - "serde_derive", - "serde_json", - "slog", - "slog-scope", - "tokio", - "toml 0.4.10", - "url", -] - -[[package]] -name = "virtio-bindings" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff512178285488516ed85f15b5d0113a7cdb89e9e8a760b269ae4f02b84bd6b" - -[[package]] -name = "virtio-queue" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "519c0a333c871650269cba303bc108075d52a0c0d64f9b91fae61829b53725af" -dependencies = [ - "log", - "vm-memory", - "vmm-sys-util 0.11.0", -] - -[[package]] -name = "vm-fdt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43fb5a6bd1a7d423ad72802801036719b7546cf847a103f8fe4575f5b0d45a6" - -[[package]] -name = "vm-memory" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583f213899e8a5eea23d9c507252d4bed5bc88f0ecbe0783262f80034630744b" -dependencies = [ - "arc-swap", - "libc", - "winapi", -] - -[[package]] -name = "vm-superio" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b5231d334edbc03b22704caa1a022e4c07491d6df736593f26094df8b04a51" - -[[package]] -name = "vmm-sys-util" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08604d7be03eb26e33b3cee3ed4aef2bf550b305d1cca60e84da5d28d3790b62" -dependencies = [ - "bitflags", - "libc", -] - -[[package]] -name = "vmm-sys-util" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc06a16ee8ebf0d9269aed304030b0d20a866b8b3dd3d4ce532596ac567a0d24" -dependencies = [ - "bitflags", - "libc", -] - [[package]] name = "vsock" version = "0.2.6" @@ -3578,15 +1887,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e32675ee2b3ce5df274c0ab52d19b28789632406277ca26bffee79a8e27dc133" dependencies = [ "libc", - "nix 0.23.1", + "nix 0.23.2", ] -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - [[package]] name = "want" version = "0.3.0" @@ -3597,18 +1900,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3621,7 +1912,7 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -3646,7 +1937,7 @@ version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -3710,15 +2001,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "wepoll-ffi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" -dependencies = [ - "cc", -] - [[package]] name = "which" version = "4.3.0" @@ -3767,100 +2049,43 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", ] -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" - [[package]] name = "windows_aarch64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" - [[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" -[[package]] -name = "windows_i686_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" - [[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" -[[package]] -name = "windows_i686_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" - [[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" - [[package]] name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" - [[package]] name = "winreg" version = "0.10.1" @@ -3869,32 +2094,3 @@ checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ "winapi", ] - -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.4+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fa202f2ef00074143e219d15b62ffc317d17cc33909feac471c044087cad7b0" -dependencies = [ - "cc", - "libc", -] diff --git a/src/tools/kata-ctl/Cargo.toml b/src/tools/kata-ctl/Cargo.toml index 31c230f336..cc32054d29 100644 --- a/src/tools/kata-ctl/Cargo.toml +++ b/src/tools/kata-ctl/Cargo.toml @@ -21,9 +21,15 @@ privdrop = "0.5.2" nix = "0.25.0" strum = "0.24.1" strum_macros = "0.24.3" +serde = { version = "1.0.149", features = ["derive"] } +url = "2.3.1" +futures = "0.3.24" +base64 = "0.13.0" -runtimes = { path = "../../runtime-rs/crates/runtimes" } -serde = "1.0.149" +shim-interface = { path = "../../libs/shim-interface"} +kata-types = { path = "../../libs/kata-types" } +safe-path = { path = "../../libs/safe-path" } +agent = { path = "../../runtime-rs/crates/agent"} [target.'cfg(target_arch = "s390x")'.dependencies] reqwest = { version = "0.11", default-features = false, features = ["json", "blocking", "native-tls"] } @@ -34,3 +40,4 @@ reqwest = { version = "0.11", default-features = false, features = ["json", "blo [dev-dependencies] semver = "1.0.12" tempfile = "3.1.0" +test-utils = { path = "../../libs/test-utils" } diff --git a/src/tools/kata-ctl/src/args.rs b/src/tools/kata-ctl/src/args.rs index 86ffe07054..f5a1cd4f29 100644 --- a/src/tools/kata-ctl/src/args.rs +++ b/src/tools/kata-ctl/src/args.rs @@ -20,7 +20,7 @@ pub enum Commands { Check(CheckArgument), /// Directly assign a volume to Kata Containers to manage - DirectVolume, + DirectVolume(DirectVolumeCommand), /// Display settings Env, @@ -93,3 +93,46 @@ pub enum IpTablesArguments { /// Configure iptables Metrics, } + +#[derive(Debug, Args)] +pub struct DirectVolumeCommand { + #[clap(subcommand)] + pub directvol_cmd: DirectVolSubcommand, +} + +#[derive(Debug, Subcommand)] +pub enum DirectVolSubcommand { + /// Add a direct assigned block volume device to the Kata Containers runtime + Add(DirectVolAddArgs), + + /// Remove a direct assigned block volume device from the Kata Containers runtime + Remove(DirectVolRemoveArgs), + + /// Get the filesystem stat of a direct assigned volume + Stats(DirectVolStatsArgs), + + /// Resize a direct assigned block volume + Resize(DirectVolResizeArgs), +} + +#[derive(Debug, Args)] +pub struct DirectVolAddArgs { + pub volume_path: String, + pub mount_info: String, +} + +#[derive(Debug, Args)] +pub struct DirectVolRemoveArgs { + pub volume_path: String, +} + +#[derive(Debug, Args)] +pub struct DirectVolStatsArgs { + pub volume_path: String, +} + +#[derive(Debug, Args)] +pub struct DirectVolResizeArgs { + pub volume_path: String, + pub resize_size: u64, +} diff --git a/src/tools/kata-ctl/src/check.rs b/src/tools/kata-ctl/src/check.rs index 28499da103..9748bd52bd 100644 --- a/src/tools/kata-ctl/src/check.rs +++ b/src/tools/kata-ctl/src/check.rs @@ -42,7 +42,7 @@ pub fn get_single_cpu_info(cpu_info_file: &str, substring: &str) -> Result = contents.split(substring).collect(); @@ -60,7 +60,7 @@ pub fn get_single_cpu_info(cpu_info_file: &str, substring: &str) -> Result Result { if cpu_info.is_empty() { - return Err(anyhow!("cpu_info string is empty"))?; + return Err(anyhow!("cpu_info string is empty")); } let subcontents: Vec<&str> = cpu_info.split('\n').collect(); diff --git a/src/tools/kata-ctl/src/main.rs b/src/tools/kata-ctl/src/main.rs index f283781b95..cb943e694b 100644 --- a/src/tools/kata-ctl/src/main.rs +++ b/src/tools/kata-ctl/src/main.rs @@ -17,16 +17,17 @@ use std::process::exit; use args::{Commands, KataCtlCli}; use ops::check_ops::{ - handle_check, handle_check_volume, handle_env, handle_exec, handle_factory, handle_iptables, - handle_metrics, handle_version, + handle_check, handle_env, handle_exec, handle_factory, handle_iptables, handle_metrics, + handle_version, }; +use ops::volume_ops::handle_direct_volume; fn real_main() -> Result<()> { let args = KataCtlCli::parse(); match args.command { Commands::Check(args) => handle_check(args), - Commands::DirectVolume => handle_check_volume(), + Commands::DirectVolume(args) => handle_direct_volume(args), Commands::Env => handle_env(), Commands::Exec => handle_exec(), Commands::Factory => handle_factory(), diff --git a/src/tools/kata-ctl/src/ops.rs b/src/tools/kata-ctl/src/ops.rs index 3e0f9a4e32..e33539bce4 100644 --- a/src/tools/kata-ctl/src/ops.rs +++ b/src/tools/kata-ctl/src/ops.rs @@ -5,3 +5,4 @@ pub mod check_ops; pub mod version; +pub mod volume_ops; diff --git a/src/tools/kata-ctl/src/ops/check_ops.rs b/src/tools/kata-ctl/src/ops/check_ops.rs index 414e499fcd..1b4fd59920 100644 --- a/src/tools/kata-ctl/src/ops/check_ops.rs +++ b/src/tools/kata-ctl/src/ops/check_ops.rs @@ -114,10 +114,6 @@ pub fn handle_check(checkcmd: CheckArgument) -> Result<()> { Ok(()) } -pub fn handle_check_volume() -> Result<()> { - Ok(()) -} - pub fn handle_env() -> Result<()> { Ok(()) } diff --git a/src/tools/kata-ctl/src/ops/volume_ops.rs b/src/tools/kata-ctl/src/ops/volume_ops.rs new file mode 100644 index 0000000000..a9df9ce78d --- /dev/null +++ b/src/tools/kata-ctl/src/ops/volume_ops.rs @@ -0,0 +1,293 @@ +// Copyright (c) 2022 Boston University +// +// SPDX-License-Identifier: Apache-2.0 +// + +use crate::args::{DirectVolSubcommand, DirectVolumeCommand}; + +use anyhow::{anyhow, Ok, Result}; +use futures::executor; +use kata_types::mount::{ + DirectVolumeMountInfo, KATA_DIRECT_VOLUME_ROOT_PATH, KATA_MOUNT_INFO_FILE_NAME, +}; +use nix; +use reqwest::StatusCode; +use safe_path; +use std::{fs, path::PathBuf, time::Duration}; +use url; + +use agent::ResizeVolumeRequest; +use shim_interface::shim_mgmt::client::MgmtClient; +use shim_interface::shim_mgmt::{ + DIRECT_VOLUME_PATH_KEY, DIRECT_VOLUME_RESIZE_URL, DIRECT_VOLUME_STATS_URL, +}; + +const TIMEOUT: Duration = Duration::from_millis(2000); +const CONTENT_TYPE_JSON: &str = "application/json"; + +pub fn handle_direct_volume(vol_cmd: DirectVolumeCommand) -> Result<()> { + if !nix::unistd::Uid::effective().is_root() { + return Err(anyhow!( + "super-user privileges are required for the direct-volume subcommand" + )); + } + let command = vol_cmd.directvol_cmd; + let cmd_result: Option = match command { + DirectVolSubcommand::Add(args) => add(&args.volume_path, &args.mount_info)?, + DirectVolSubcommand::Remove(args) => remove(&args.volume_path)?, + DirectVolSubcommand::Stats(args) => executor::block_on(stats(&args.volume_path))?, + DirectVolSubcommand::Resize(args) => { + executor::block_on(resize(&args.volume_path, args.resize_size))? + } + }; + if let Some(cmd_result) = cmd_result { + println!("{:?}", cmd_result); + } + + Ok(()) +} + +async fn resize(volume_path: &str, size: u64) -> Result> { + let sandbox_id = get_sandbox_id_for_volume(volume_path)?; + let mount_info = get_volume_mount_info(volume_path)?; + let resize_req = ResizeVolumeRequest { + size, + volume_guest_path: mount_info.device, + }; + let encoded = serde_json::to_string(&resize_req)?; + let shim_client = MgmtClient::new(&sandbox_id, Some(TIMEOUT))?; + + let url = DIRECT_VOLUME_RESIZE_URL; + let response = shim_client + .post(url, &String::from(CONTENT_TYPE_JSON), &encoded) + .await?; + let status = response.status(); + if status != StatusCode::OK { + let body = format!("{:?}", response.into_body()); + return Err(anyhow!( + "failed to resize volume ({:?}): {:?}", + status, + body + )); + } + + Ok(None) +} + +async fn stats(volume_path: &str) -> Result> { + let sandbox_id = get_sandbox_id_for_volume(volume_path)?; + let mount_info = get_volume_mount_info(volume_path)?; + + let req_url = url::form_urlencoded::Serializer::new(String::from(DIRECT_VOLUME_STATS_URL)) + .append_pair(DIRECT_VOLUME_PATH_KEY, &mount_info.device) + .finish(); + + let shim_client = MgmtClient::new(&sandbox_id, Some(TIMEOUT))?; + let response = shim_client.get(&req_url).await?; + // turn body into string + let body = format!("{:?}", response.into_body()); + + Ok(Some(body)) +} + +// join_path joins user provided volumepath with kata direct-volume root path +// the volume_path is base64-encoded and then safely joined to the end of path prefix +fn join_path(prefix: &str, volume_path: &str) -> Result { + if volume_path.is_empty() { + return Err(anyhow!("volume path must not be empty")); + } + let b64_encoded_path = base64::encode(volume_path.as_bytes()); + + Ok(safe_path::scoped_join(prefix, b64_encoded_path)?) +} + +// add writes the mount info (json string) of a direct volume into a filesystem path known to Kata Containers. +pub fn add(volume_path: &str, mount_info: &str) -> Result> { + let mount_info_dir_path = join_path(KATA_DIRECT_VOLUME_ROOT_PATH, volume_path)?; + + // create directory if missing + fs::create_dir_all(&mount_info_dir_path)?; + + // This behavior of deserializing and serializing comes from + // https://github.com/kata-containers/kata-containers/blob/cd27ad144e1a111cb606015c5c9671431535e644/src/runtime/pkg/direct-volume/utils.go#L57-L79 + // Assuming that this is for the purpose of validating the json schema. + let unserialized_mount_info: DirectVolumeMountInfo = serde_json::from_str(mount_info)?; + + let mount_info_file_path = mount_info_dir_path.join(KATA_MOUNT_INFO_FILE_NAME); + let serialized_mount_info = serde_json::to_string(&unserialized_mount_info)?; + fs::write(mount_info_file_path, serialized_mount_info)?; + + Ok(None) +} + +// remove deletes the direct volume path including all the files inside it. +pub fn remove(volume_path: &str) -> Result> { + let path = join_path(KATA_DIRECT_VOLUME_ROOT_PATH, volume_path)?; + // removes path and any children it contains. + fs::remove_dir_all(path)?; + + Ok(None) +} + +pub fn get_volume_mount_info(volume_path: &str) -> Result { + let mount_info_file_path = + join_path(KATA_DIRECT_VOLUME_ROOT_PATH, volume_path)?.join(KATA_MOUNT_INFO_FILE_NAME); + let mount_info_file = fs::read_to_string(mount_info_file_path)?; + let mount_info: DirectVolumeMountInfo = serde_json::from_str(&mount_info_file)?; + + Ok(mount_info) +} + +// get_sandbox_id_for_volume finds the id of the first sandbox found in the dir. +// We expect a direct-assigned volume is associated with only a sandbox at a time. +pub fn get_sandbox_id_for_volume(volume_path: &str) -> Result { + let dir_path = join_path(KATA_DIRECT_VOLUME_ROOT_PATH, volume_path)?; + let paths = fs::read_dir(dir_path)?; + for path in paths { + let path = path?; + // compare with MOUNT_INFO_FILE_NAME + if path.file_name() == KATA_MOUNT_INFO_FILE_NAME { + continue; + } + + let file_name = path.file_name(); + // turn file_name into String and return it + let file_name = file_name.to_str().ok_or_else(|| { + anyhow!( + "failed to convert file_name {:?} to string", + file_name.to_string_lossy() + ) + })?; + + return Ok(String::from(file_name)); + } + + return Err(anyhow!("no sandbox found for {}", volume_path)); +} + +#[cfg(test)] +mod tests { + use super::*; + use kata_types::mount::DirectVolumeMountInfo; + use std::{collections::HashMap, fs}; + use tempfile::tempdir; + use test_utils::skip_if_not_root; + + #[test] + fn test_get_sandbox_id_for_volume() { + // this test has to run as root, so has to manually cleanup afterwards + skip_if_not_root!(); + + // create KATA_DIRECT_VOLUME_ROOT_PATH first as safe_path::scoped_join + // requires prefix dir to exist + fs::create_dir_all(KATA_DIRECT_VOLUME_ROOT_PATH) + .expect("create kata direct volume root path failed"); + + let test_sandbox_id = "sandboxid_test_file"; + let test_volume_path = String::from("a/b/c"); + let joined_volume_path = + join_path(KATA_DIRECT_VOLUME_ROOT_PATH, &test_volume_path).unwrap(); + + let test_file_dir = joined_volume_path.join(test_sandbox_id); + fs::create_dir_all(&joined_volume_path).expect("failed to mkdir -p"); + fs::write(&test_file_dir, "teststring").expect("failed to write"); + + // test that get_sandbox_id gets the correct sandboxid it sees + let got = get_sandbox_id_for_volume(&test_volume_path).unwrap(); + assert!(got.eq(test_sandbox_id)); + + // test that get_sandbox_id returns error if no sandboxid found + fs::remove_file(&test_file_dir).expect("failed to remove"); + get_sandbox_id_for_volume(&test_volume_path).expect_err("error expected"); + + // cleanup test directory + fs::remove_dir_all(&joined_volume_path).expect("failed to cleanup test") + } + + #[test] + fn test_path_join() { + #[derive(Debug)] + struct TestData<'a> { + rootfs: &'a str, + volume_path: &'a str, + result: Result, + } + // the safe_path::scoped_join requires the prefix path to exist on testing machine + let root_fs = tempdir().expect("failed to create tmpdir").into_path(); + let root_fs_str = root_fs.to_str().unwrap(); + + let relative_secret_path = "../../etc/passwd"; + let b64_relative_secret_path = base64::encode(relative_secret_path); + + // this byte array b64encodes to "/abcdddd" + let b64_abs_path = vec![253, 166, 220, 117, 215, 93]; + let converted_relative_path = "abcdddd"; + + let tests = &[ + TestData { + rootfs: root_fs_str, + volume_path: "", + result: Err(anyhow!("volume path must not be empty")), + }, + TestData { + rootfs: root_fs_str, + volume_path: relative_secret_path, + result: Ok(root_fs.join(b64_relative_secret_path)), + }, + TestData { + rootfs: root_fs_str, + volume_path: unsafe { std::str::from_utf8_unchecked(&b64_abs_path) }, + result: Ok(root_fs.join(converted_relative_path)), + }, + ]; + for (i, d) in tests.iter().enumerate() { + let msg = format!("test[{}]: {:?}", i, d); + let result = join_path(d.rootfs, d.volume_path); + let msg = format!("{}, result: {:?}", msg, result); + if d.result.is_ok() { + assert!( + result.as_ref().unwrap() == d.result.as_ref().unwrap(), + "{}", + msg + ); + continue; + } + let expected_error = format!("{}", d.result.as_ref().unwrap_err()); + let actual_error = format!("{}", result.unwrap_err()); + assert!(actual_error == expected_error, "{}", msg); + } + } + + #[test] + fn test_add_remove() { + skip_if_not_root!(); + // example volume dir is a/b/c, note the behavior of join would take "/a" as absolute path. + // testing with isn't really viable here since the path is then b64 encoded, + // so this test had to run as root and call `remove()` to manully cleanup afterwards. + + fs::create_dir_all(KATA_DIRECT_VOLUME_ROOT_PATH) + .expect("create kata direct volume root path failed"); + + let base_dir = tempdir().expect("failed to create tmpdir"); + let dir_name = base_dir.path().join("a/b/c"); + let volume_path = String::from(dir_name.to_str().unwrap()); + let actual: DirectVolumeMountInfo = DirectVolumeMountInfo { + volume_type: String::from("block"), + device: String::from("/dev/sda"), + fs_type: String::from("ext4"), + metadata: HashMap::new(), + options: vec![String::from("journal_dev"), String::from("noload")], + }; + // serialize volumemountinfo into json string + let mount_info = serde_json::to_string(&actual).unwrap(); + add(&volume_path, &mount_info).expect("add failed"); + let expected_file_path = volume_path; + let expected: DirectVolumeMountInfo = get_volume_mount_info(&expected_file_path).unwrap(); + remove(&expected_file_path).expect("remove failed"); + assert_eq!(actual.device, expected.device); + assert_eq!(actual.fs_type, expected.fs_type); + assert_eq!(actual.metadata, expected.metadata); + assert_eq!(actual.options, expected.options); + assert_eq!(actual.volume_type, expected.volume_type); + } +}