Skip to content

Commit 569c274

Browse files
authored
refactor(drivers): remove reverse dependencies on the VM and Podman drivers (#6023)
* refactor(drivers): remove reverse dependencies on the VM and Podman drivers Move Podman socket discovery into a new openshell-container-runtime crate for code used only by the desktop drivers, so the VM driver no longer depends on openshell-driver-podman. Move the counting test allocator into openshell-supervisor-network so it no longer depends on openshell-driver-vm. Nothing outside crates/openshell-driver-* and the container-runtime crate now depends on the Docker, Podman or VM driver crates. Signed-off-by: Evan Lezar <elezar@nvidia.com> * docs(supervisor-network): refresh README for the test-only allocator and exclude the container-runtime crate on Windows Signed-off-by: Evan Lezar <elezar@nvidia.com> --------- Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 81db9d2 commit 569c274

19 files changed

Lines changed: 76 additions & 31 deletions

File tree

‎AGENTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Do not rely on this file for a full inventory. The detailed public and contribut
5858
| `crates/openshell-driver-vault/` | Vault credential driver | In-process `CredentialDriver` backend for Vault-compatible KV storage |
5959
| `crates/openshell-driver-db-credstore/` | Database credential driver | In-process `CredentialDriver` backend for gateway database credential storage |
6060
| `crates/openshell-driver-kubernetes/` | Kubernetes compute driver | In-process `ComputeDriver` backend for K8s sandbox pods |
61+
| `crates/openshell-container-runtime/` | Container runtime helpers | Code used only by the desktop compute drivers (Docker, Podman, VM), starting with Podman socket discovery; moves with the drivers |
6162
| `crates/openshell-driver-docker/` | Docker compute driver | Gateway-launched `ComputeDriver` subprocess for local Docker sandbox containers |
6263
| `crates/openshell-driver-podman/` | Podman compute driver | Gateway-launched `ComputeDriver` subprocess for local Podman sandbox containers |
6364
| `crates/openshell-driver-vm/` | VM compute driver | Standalone libkrun-backed `ComputeDriver` subprocess (embeds its own rootfs + runtime) |

‎Cargo.lock‎

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
[package]
5+
name = "openshell-container-runtime"
6+
description = "Code shared by the OpenShell desktop compute drivers (Docker, Podman, VM)"
7+
version.workspace = true
8+
edition.workspace = true
9+
rust-version.workspace = true
10+
license.workspace = true
11+
repository.workspace = true
12+
13+
[dependencies]
14+
openshell-core = { path = "../openshell-core", default-features = false }
15+
serde_json = { workspace = true }
16+
17+
[target.'cfg(unix)'.dependencies]
18+
nix = { workspace = true }
19+
20+
[target.'cfg(target_os = "linux")'.dependencies]
21+
rustix = { workspace = true }
22+
23+
[lints]
24+
workspace = true
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# openshell-container-runtime
2+
3+
Code used only by the desktop compute drivers (Docker, Podman, and VM). It
4+
moves with those drivers when they leave this repository. Code that the
5+
gateway, supervisor, or Kubernetes driver also uses does not belong here.
6+
7+
## Contents
8+
9+
- `podman_socket`: Podman API socket discovery for native and machine-backed
10+
installations.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//! Code shared by the `OpenShell` desktop compute drivers.
5+
//!
6+
//! Everything here is used only by the Docker, Podman, and VM drivers, so the
7+
//! crate moves with them when they leave this repository.
8+
9+
pub mod podman_socket;

crates/openshell-driver-podman/src/socket_discovery.rs renamed to crates/openshell-container-runtime/src/podman_socket.rs

File renamed without changes.

‎crates/openshell-driver-podman/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ path = "src/main.rs"
1616

1717
[dependencies]
1818
openshell-core = { path = "../openshell-core", default-features = false, features = ["driver-extraction", "otel", "clap"] }
19+
openshell-container-runtime = { path = "../openshell-container-runtime" }
1920
openshell-driver-sdk = { path = "../openshell-driver-sdk" }
2021
openshell-otel = { path = "../openshell-otel" }
2122
openshell-isolation-interface = { path = "../openshell-isolation-interface" }

‎crates/openshell-driver-podman/src/driver.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ fn podman_gpu_selection_error(err: CdiGpuSelectionError) -> ComputeDriverError {
437437
/// Return the first responsive local Podman API socket.
438438
#[must_use]
439439
pub fn detect_socket() -> Option<PathBuf> {
440-
crate::socket_discovery::detect_socket()
440+
openshell_container_runtime::podman_socket::detect_socket()
441441
}
442442

443443
#[must_use]

‎crates/openshell-driver-podman/src/lib.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub mod driver;
88
pub mod grpc;
99
mod isolation;
1010
pub mod otel_tracing;
11-
mod socket_discovery;
1211
#[cfg(test)]
1312
pub(crate) mod test_utils;
1413
pub(crate) mod watcher;

‎crates/openshell-driver-vm/Cargo.toml‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ openshell-core = { path = "../openshell-core", default-features = false, feature
2828
openshell-isolation-interface = { path = "../openshell-isolation-interface" }
2929
openshell-sandbox-backend = { path = "../openshell-sandbox-backend" }
3030
openshell-driver-launch = { path = "../openshell-driver-launch", optional = true }
31+
openshell-container-runtime = { path = "../openshell-container-runtime", optional = true }
3132
openshell-driver-sdk = { path = "../openshell-driver-sdk", optional = true }
3233
openshell-otel = { path = "../openshell-otel", optional = true }
3334
openshell-policy = { path = "../openshell-policy", optional = true }
34-
openshell-driver-podman = { path = "../openshell-driver-podman", optional = true }
3535
openshell-vfio = { path = "../openshell-vfio", optional = true }
3636

3737
base64 = { workspace = true, optional = true }
@@ -67,8 +67,6 @@ toml = { workspace = true, optional = true }
6767
zstd = { version = "0.14", optional = true }
6868

6969
[features]
70-
# Portable test instrumentation, independent of the compute runtime.
71-
allocation-tracking = []
7270
default = ["compute-driver", "telemetry"]
7371
## Build the standalone compute driver and its host runtime implementation.
7472
compute-driver = [
@@ -83,12 +81,12 @@ compute-driver = [
8381
"dep:nix",
8482
"dep:oci-client",
8583
"dep:openshell-driver-launch",
84+
"dep:openshell-container-runtime",
8685
"dep:openshell-driver-sdk",
8786
"dep:openshell-otel",
8887
"dep:toml",
8988
"openshell-core/otel",
9089
"dep:openshell-policy",
91-
"dep:openshell-driver-podman",
9290
"dep:openshell-vfio",
9391
"dep:opentelemetry",
9492
"dep:opentelemetry_sdk",

0 commit comments

Comments
 (0)