kata-types: Add pod_resource_api_sock configuration for GPU cold-plug

The Go runtime already exposes a [runtime] pod_resource_api_sock option
that tells the shim where to find the kubelet Pod Resources API socket.
The runtime-rs VFIO cold-plug code needs the same setting so it can
query assigned GPU devices before the VM starts.

Add the field to RuntimeConfig and wire it through deserialization so
that configuration-*.toml files can set it.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
This commit is contained in:
Alex Lyn
2026-04-04 11:29:46 +02:00
committed by Fabiano Fidêncio
parent 2d782adfe2
commit 408cfd4368
4 changed files with 1768 additions and 799 deletions

View File

@@ -181,6 +181,26 @@ pub struct Runtime {
/// If fd passthrough io is enabled, the runtime will attempt to use the specified port instead of the default port.
#[serde(default = "default_passfd_listener_port")]
pub passfd_listener_port: u32,
/// pod_resource_api_sock specifies the unix socket for the Kubelet's
/// PodResource API endpoint. If empty, kubernetes based cold plug
/// will not be attempted. In order for this feature to work, the
/// KubeletPodResourcesGet featureGate must be enabled in Kubelet,
/// if using Kubelet older than 1.34.
/// The pod resource API's socket is relative to the Kubelet's root-dir,
/// which is defined by the cluster admin, and its location is:
/// ${KubeletRootDir}/pod-resources/kubelet.sock
/// cold_plug_vfio(see hypervisor config) acts as a feature gate:
/// cold_plug_vfio = no_port (default) => no cold plug
/// cold_plug_vfio != no_port AND pod_resource_api_sock = "" => need
/// explicit CDI annotation for cold plug (applies mainly
/// to non-k8s cases)
/// cold_plug_vfio != no_port AND pod_resource_api_sock != "" => kubelet
/// based cold plug.
#[serde(default)]
pub pod_resource_api_sock: String,
}
fn default_passfd_listener_port() -> u32 {

View File

@@ -2176,6 +2176,7 @@ dependencies = [
"libc",
"logging",
"nix 0.26.4",
"once_cell",
"path-clean",
"persist",
"protocols",
@@ -2183,6 +2184,7 @@ dependencies = [
"qapi-qmp",
"qapi-spec",
"rand 0.8.5",
"regex",
"rust-ini",
"safe-path 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"seccompiler",
@@ -2545,9 +2547,9 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.94"
version = "0.3.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e04e2ef80ce82e13552136fabeef8a5ed1f985a96805761cbb9a2c34e7664d9"
checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca"
dependencies = [
"cfg-if 1.0.4",
"futures-util",
@@ -4021,7 +4023,7 @@ dependencies = [
"bytes",
"getrandom 0.3.4",
"lru-slab",
"rand 0.9.2",
"rand 0.9.3",
"ring",
"rustc-hash 2.1.2",
"rustls",
@@ -4087,9 +4089,9 @@ dependencies = [
[[package]]
name = "rand"
version = "0.9.2"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
checksum = "7ec095654a25171c2124e9e3393a930bddbffdc939556c914957a4c3e0a87166"
dependencies = [
"rand_chacha 0.9.0",
"rand_core 0.9.5",
@@ -4735,7 +4737,7 @@ dependencies = [
"p256",
"p384",
"p521",
"rand 0.9.2",
"rand 0.9.3",
"rand_core 0.6.4",
"regex",
"regex-syntax",
@@ -6046,9 +6048,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen"
version = "0.2.117"
version = "0.2.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0"
checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89"
dependencies = [
"cfg-if 1.0.4",
"once_cell",
@@ -6059,9 +6061,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.67"
version = "0.4.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03623de6905b7206edd0a75f69f747f134b7f0a2323392d664448bf2d3c5d87e"
checksum = "f371d383f2fb139252e0bfac3b81b265689bf45b6874af544ffa4c975ac1ebf8"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -6069,9 +6071,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.117"
version = "0.2.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be"
checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -6079,9 +6081,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.117"
version = "0.2.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2"
checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904"
dependencies = [
"bumpalo",
"proc-macro2",
@@ -6092,9 +6094,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.117"
version = "0.2.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b"
checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129"
dependencies = [
"unicode-ident",
]
@@ -6161,9 +6163,9 @@ dependencies = [
[[package]]
name = "web-sys"
version = "0.3.94"
version = "0.3.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd70027e39b12f0849461e08ffc50b9cd7688d942c1c8e3c7b22273236b4dd0a"
checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d"
dependencies = [
"js-sys",
"wasm-bindgen",

File diff suppressed because it is too large Load Diff

View File

@@ -70,11 +70,7 @@ pub fn get_distro_details(os_release: &str, os_release_clr: &str) -> Result<(Str
if e.kind() == std::io::ErrorKind::NotFound {
continue;
} else {
return Err(anyhow!(
"Error reading file {}: {}",
release_file,
e.to_string()
));
return Err(anyhow!("Error reading file {}: {}", release_file, e));
}
}
Ok(contents) => {
@@ -153,7 +149,7 @@ pub fn supports_vsocks(vsock_path: &str) -> Result<bool> {
let metadata = fs::metadata(vsock_path).map_err(|err| {
anyhow!(
"Host system does not support vhost-vsock (try running (`sudo modprobe vhost_vsock`) : {}",
err.to_string()
err
)
})?;
Ok(metadata.is_file())