Skip to content

Commit 79aa355

Browse files
authored
refactor(driver): trim compute capability response (#1402)
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent d990822 commit 79aa355

9 files changed

Lines changed: 9 additions & 25 deletions

File tree

architecture/compute-runtimes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ drive client provisioning UI, the driver attaches the shared
2222
clients to parse Kubernetes reasons, VM cache states, or other driver-local
2323
reason strings.
2424

25+
The capability RPC reports driver identity, version, and the default sandbox
26+
image used by the gateway. GPU availability stays driver-local and is validated
27+
when a sandbox create request asks for GPU resources.
28+
2529
## Runtime Summary
2630

2731
| Runtime | Best fit | Sandbox boundary | Notes |

crates/openshell-core/src/driver_utils.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,16 @@ pub fn sandbox_token_path(
6363
/// Build a [`GetCapabilitiesResponse`] from the common driver capability fields.
6464
///
6565
/// Every compute driver constructs this response with the same fields. Shared
66-
/// here to avoid repeating the struct literal (and the always-zero `gpu_count`
67-
/// default) in each driver crate.
66+
/// here to avoid repeating the struct literal in each driver crate.
6867
pub fn build_capabilities_response(
6968
driver_name: &str,
7069
driver_version: impl Into<String>,
7170
default_image: impl Into<String>,
72-
supports_gpu: bool,
7371
) -> GetCapabilitiesResponse {
7472
GetCapabilitiesResponse {
7573
driver_name: driver_name.to_string(),
7674
driver_version: driver_version.into(),
7775
default_image: default_image.into(),
78-
supports_gpu,
79-
gpu_count: 0,
8076
}
8177
}
8278

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ impl DockerComputeDriver {
354354
"docker",
355355
&self.config.daemon_version,
356356
&self.config.default_image,
357-
self.config.supports_gpu,
358357
)
359358
}
360359

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,11 @@ impl KubernetesComputeDriver {
159159
})
160160
}
161161

162-
pub async fn capabilities(&self) -> Result<GetCapabilitiesResponse, String> {
162+
pub fn capabilities(&self) -> Result<GetCapabilitiesResponse, String> {
163163
Ok(openshell_core::driver_utils::build_capabilities_response(
164164
"kubernetes",
165165
openshell_core::VERSION,
166166
&self.config.default_image,
167-
self.has_gpu_capacity().await.unwrap_or(false),
168167
))
169168
}
170169

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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ impl PodmanComputeDriver {
258258
"podman",
259259
openshell_core::VERSION,
260260
&self.config.default_image,
261-
Self::has_gpu_capacity(),
262261
))
263262
}
264263

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,17 +373,10 @@ impl VmDriver {
373373

374374
#[must_use]
375375
pub fn capabilities(&self) -> GetCapabilitiesResponse {
376-
let gpu_count = self
377-
.gpu_inventory
378-
.as_ref()
379-
.and_then(|inv| inv.lock().ok())
380-
.map_or(0, |inv| inv.gpu_count());
381376
GetCapabilitiesResponse {
382377
driver_name: DRIVER_NAME.to_string(),
383378
driver_version: openshell_core::VERSION.to_string(),
384379
default_image: self.config.default_image.clone(),
385-
supports_gpu: self.gpu_inventory.is_some(),
386-
gpu_count,
387380
}
388381
}
389382

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,8 +1684,6 @@ impl ComputeDriver for NoopTestDriver {
16841684
driver_name: "noop-test-driver".to_string(),
16851685
driver_version: "test".to_string(),
16861686
default_image: "openshell/sandbox:test".to_string(),
1687-
supports_gpu: false,
1688-
gpu_count: 0,
16891687
},
16901688
))
16911689
}
@@ -1834,8 +1832,6 @@ mod tests {
18341832
driver_name: "test-driver".to_string(),
18351833
driver_version: "test".to_string(),
18361834
default_image: "openshell/sandbox:test".to_string(),
1837-
supports_gpu: true,
1838-
gpu_count: 0,
18391835
}))
18401836
}
18411837

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)