Skip to content

Commit f76f3f4

Browse files
committed
refactor(driver): trim compute capability response
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 44e843e commit f76f3f4

8 files changed

Lines changed: 21 additions & 39 deletions

File tree

‎architecture/compute-runtimes.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Each runtime receives a sandbox spec from the gateway and is responsible for:
1616
- Reporting lifecycle and platform events back to the gateway.
1717
- Cleaning up runtime-owned resources.
1818

19+
The capability RPC reports driver identity, version, and the default sandbox
20+
image used by the gateway. GPU availability stays driver-local and is validated
21+
when a sandbox create request asks for GPU resources.
22+
1923
## Runtime Summary
2024

2125
| Runtime | Best fit | Sandbox boundary | Notes |

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,6 @@ impl DockerComputeDriver {
287287
driver_name: "docker".to_string(),
288288
driver_version: self.config.daemon_version.clone(),
289289
default_image: self.config.default_image.clone(),
290-
supports_gpu: self.config.supports_gpu,
291-
gpu_count: 0,
292290
}
293291
}
294292

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,11 @@ impl KubernetesComputeDriver {
154154
})
155155
}
156156

157-
pub async fn capabilities(&self) -> Result<GetCapabilitiesResponse, String> {
157+
pub fn capabilities(&self) -> Result<GetCapabilitiesResponse, String> {
158158
Ok(GetCapabilitiesResponse {
159159
driver_name: "kubernetes".to_string(),
160160
driver_version: openshell_core::VERSION.to_string(),
161161
default_image: self.config.default_image.clone(),
162-
supports_gpu: self.has_gpu_capacity().await.unwrap_or(false),
163-
gpu_count: 0,
164162
})
165163
}
166164

‎crates/openshell-driver-kubernetes/src/grpc.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ impl ComputeDriver for ComputeDriverService {
3636
) -> Result<Response<GetCapabilitiesResponse>, Status> {
3737
self.driver
3838
.capabilities()
39-
.await
4039
.map(Response::new)
4140
.map_err(Status::internal)
4241
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,10 @@ impl PodmanComputeDriver {
169169

170170
/// Report driver capabilities.
171171
pub fn capabilities(&self) -> Result<GetCapabilitiesResponse, ComputeDriverError> {
172-
let supports_gpu = Self::has_gpu_capacity();
173172
Ok(GetCapabilitiesResponse {
174173
driver_name: "podman".to_string(),
175174
driver_version: openshell_core::VERSION.to_string(),
176175
default_image: self.config.default_image.clone(),
177-
supports_gpu,
178-
gpu_count: 0,
179176
})
180177
}
181178

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

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -312,17 +312,10 @@ impl VmDriver {
312312

313313
#[must_use]
314314
pub fn capabilities(&self) -> GetCapabilitiesResponse {
315-
let gpu_count = self
316-
.gpu_inventory
317-
.as_ref()
318-
.and_then(|inv| inv.lock().ok())
319-
.map_or(0, |inv| inv.gpu_count());
320315
GetCapabilitiesResponse {
321316
driver_name: DRIVER_NAME.to_string(),
322317
driver_version: openshell_core::VERSION.to_string(),
323318
default_image: self.config.default_image.clone(),
324-
supports_gpu: self.gpu_inventory.is_some(),
325-
gpu_count,
326319
}
327320
}
328321

@@ -1522,25 +1515,23 @@ fn parse_registry_reference(image_ref: &str) -> Result<Reference, Status> {
15221515
/// `DOCKER_HOST`). If Docker is unavailable, falls back to the Podman
15231516
/// socket, which exposes a Docker-compatible API.
15241517
async fn connect_local_container_engine() -> Option<Docker> {
1525-
if let Ok(docker) = Docker::connect_with_local_defaults() {
1526-
if docker.ping().await.is_ok() {
1527-
return Some(docker);
1528-
}
1518+
if let Ok(docker) = Docker::connect_with_local_defaults()
1519+
&& docker.ping().await.is_ok()
1520+
{
1521+
return Some(docker);
15291522
}
15301523

15311524
let podman_socket = podman_socket_path();
1532-
if podman_socket.exists() {
1533-
if let Ok(docker) =
1525+
if podman_socket.exists()
1526+
&& let Ok(docker) =
15341527
Docker::connect_with_unix(podman_socket.to_str()?, 120, bollard::API_DEFAULT_VERSION)
1535-
{
1536-
if docker.ping().await.is_ok() {
1537-
info!(
1538-
socket = %podman_socket.display(),
1539-
"vm driver: connected to Podman (Docker-compatible API)"
1540-
);
1541-
return Some(docker);
1542-
}
1543-
}
1528+
&& docker.ping().await.is_ok()
1529+
{
1530+
info!(
1531+
socket = %podman_socket.display(),
1532+
"vm driver: connected to Podman (Docker-compatible API)"
1533+
);
1534+
return Some(docker);
15441535
}
15451536

15461537
None

‎crates/openshell-server/src/compute/mod.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,8 +1541,6 @@ impl ComputeDriver for NoopTestDriver {
15411541
driver_name: "noop-test-driver".to_string(),
15421542
driver_version: "test".to_string(),
15431543
default_image: "openshell/sandbox:test".to_string(),
1544-
supports_gpu: false,
1545-
gpu_count: 0,
15461544
},
15471545
))
15481546
}
@@ -1690,8 +1688,6 @@ mod tests {
16901688
driver_name: "test-driver".to_string(),
16911689
driver_version: "test".to_string(),
16921690
default_image: "openshell/sandbox:test".to_string(),
1693-
supports_gpu: true,
1694-
gpu_count: 0,
16951691
}))
16961692
}
16971693

‎proto/compute_driver.proto‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,15 @@ service ComputeDriver {
4545
message GetCapabilitiesRequest {}
4646

4747
message GetCapabilitiesResponse {
48+
reserved 4, 5;
49+
reserved "supports_gpu", "gpu_count";
50+
4851
// Human-readable driver name.
4952
string driver_name = 1;
5053
// Driver implementation version string.
5154
string driver_version = 2;
5255
// Default sandbox image recommended by the driver.
5356
string default_image = 3;
54-
// True when the driver can provision GPU-backed sandboxes.
55-
bool supports_gpu = 4;
56-
// Number of GPUs available for sandbox assignment.
57-
uint32 gpu_count = 5;
5857
}
5958

6059
// Driver-owned sandbox model used for create requests and platform observations.

0 commit comments

Comments
 (0)