Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ repository = "https://github.com/NVIDIA/OpenShell"
# OpenShell platform crates, pinned to one commit of ai-openshell/openshell: a main commit (v0.1.11 plus later changes).
# It has the driver launch protocol and SDK (PR 5914), which the drivers here build on, and the
# openshell-container-runtime crate (PR 6023).
openshell-core = { git = "https://github.com/ai-openshell/openshell", rev = "9972314fa89320860e734f533e08d6994407d5fe", default-features = false }
openshell-isolation-interface = { git = "https://github.com/ai-openshell/openshell", rev = "9972314fa89320860e734f533e08d6994407d5fe" }
openshell-sandbox-backend = { git = "https://github.com/ai-openshell/openshell", rev = "9972314fa89320860e734f533e08d6994407d5fe" }
openshell-otel = { git = "https://github.com/ai-openshell/openshell", rev = "9972314fa89320860e734f533e08d6994407d5fe" }
openshell-driver-sdk = { git = "https://github.com/ai-openshell/openshell", rev = "9972314fa89320860e734f533e08d6994407d5fe" }
openshell-driver-launch = { git = "https://github.com/ai-openshell/openshell", rev = "9972314fa89320860e734f533e08d6994407d5fe" }
openshell-otel-test-support = { git = "https://github.com/ai-openshell/openshell", rev = "9972314fa89320860e734f533e08d6994407d5fe" }
openshell-policy = { git = "https://github.com/ai-openshell/openshell", rev = "9972314fa89320860e734f533e08d6994407d5fe" }
openshell-vfio = { git = "https://github.com/ai-openshell/openshell", rev = "9972314fa89320860e734f533e08d6994407d5fe" }
openshell-crypto = { git = "https://github.com/ai-openshell/openshell", rev = "9972314fa89320860e734f533e08d6994407d5fe", default-features = false, features = ["aws-lc"] }
openshell-core = { git = "https://github.com/ai-openshell/openshell", rev = "bbb10834c874a57a034a01b2b117e79b6e3c1ab8", default-features = false }
openshell-isolation-interface = { git = "https://github.com/ai-openshell/openshell", rev = "bbb10834c874a57a034a01b2b117e79b6e3c1ab8" }
openshell-sandbox-backend = { git = "https://github.com/ai-openshell/openshell", rev = "bbb10834c874a57a034a01b2b117e79b6e3c1ab8" }
openshell-otel = { git = "https://github.com/ai-openshell/openshell", rev = "bbb10834c874a57a034a01b2b117e79b6e3c1ab8" }
openshell-driver-sdk = { git = "https://github.com/ai-openshell/openshell", rev = "bbb10834c874a57a034a01b2b117e79b6e3c1ab8" }
openshell-driver-launch = { git = "https://github.com/ai-openshell/openshell", rev = "bbb10834c874a57a034a01b2b117e79b6e3c1ab8" }
openshell-otel-test-support = { git = "https://github.com/ai-openshell/openshell", rev = "bbb10834c874a57a034a01b2b117e79b6e3c1ab8" }
openshell-policy = { git = "https://github.com/ai-openshell/openshell", rev = "bbb10834c874a57a034a01b2b117e79b6e3c1ab8" }
openshell-vfio = { git = "https://github.com/ai-openshell/openshell", rev = "bbb10834c874a57a034a01b2b117e79b6e3c1ab8" }
openshell-crypto = { git = "https://github.com/ai-openshell/openshell", rev = "bbb10834c874a57a034a01b2b117e79b6e3c1ab8", default-features = false, features = ["aws-lc"] }
openshell-container-runtime = { path = "crates/openshell-container-runtime" }

tokio = { version = "1.53.3", features = ["full"] }
Expand Down
31 changes: 6 additions & 25 deletions crates/openshell-driver-docker/src/image_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,33 +931,14 @@ pub fn pending_snapshots(config: &DockerDriverRuntimeConfig) -> Result<Vec<Drive
pub fn pending_snapshot(
config: &DockerDriverRuntimeConfig,
id: &str,
name: &str,
) -> Result<Option<DriverSandbox>, Status> {
if !id.is_empty() {
if !valid_native_id(id) {
return Ok(None);
}
let Some(intent) = read(config, id)? else {
return Ok(None);
};
if !name.is_empty() && name != intent.sandbox_name {
return Err(invalid(
"Docker update name does not match its native identity",
));
}
return Ok((intent.phase != Phase::Applied).then(|| snapshot(&intent)));
}
let matches = pending_snapshots(config)?
.into_iter()
.filter(|value| value.name == name)
.collect::<Vec<_>>();
match matches.len() {
0 => Ok(None),
1 => Ok(matches.into_iter().next()),
_ => Err(invalid(
"Docker pending update name is ambiguous; use its native ID",
)),
if !valid_native_id(id) {
return Ok(None);
}
let Some(intent) = read(config, id)? else {
return Ok(None);
};
Ok((intent.phase != Phase::Applied).then(|| snapshot(&intent)))
}

pub fn require_settled(config: &DockerDriverRuntimeConfig, id: &str) -> Result<(), Status> {
Expand Down
48 changes: 19 additions & 29 deletions crates/openshell-driver-docker/src/image_update/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,23 +786,20 @@ async fn pending_update_survives_driver_restart_and_blocks_start_by_id_or_name()
let mut reopened = test_driver_with_config(fixture.config.clone());
reopened.docker = Arc::new(docker);
let observed = reopened
.get_sandbox_snapshot("", &fixture.p().name)
.get_sandbox_snapshot(&fixture.p().sandbox_id)
.await
.unwrap()
.unwrap();
assert_eq!(observed.id, fixture.p().sandbox_id);
for id in [fixture.p().sandbox_id.as_str(), ""] {
let error = Box::pin(reopened.start_sandbox(
id,
&fixture.p().name,
"generation-2",
&test_launch_authentication(),
None,
))
.await
.unwrap_err();
assert_eq!(error.code(), tonic::Code::FailedPrecondition);
}
let error = Box::pin(reopened.start_sandbox(
&fixture.p().sandbox_id,
"generation-2",
&test_launch_authentication(),
None,
))
.await
.unwrap_err();
assert_eq!(error.code(), tonic::Code::FailedPrecondition);
server.await.unwrap();
assert!(
read(&fixture.config, &fixture.p().sandbox_id)
Expand All @@ -823,7 +820,7 @@ async fn completed_update_clears_pending_inventory_and_keeps_start_bound_to_targ
.unwrap();
assert!(pending_ids(&fixture.config).unwrap().is_empty());
assert!(
pending_snapshot(&fixture.config, &fixture.p().sandbox_id, &fixture.p().name)
pending_snapshot(&fixture.config, &fixture.p().sandbox_id)
.unwrap()
.is_none()
);
Expand Down Expand Up @@ -886,15 +883,10 @@ async fn stopped_start_repairs_interrupted_launch_rotation_before_staging() {
authentication.supervisor.runtime_generation =
openshell_core::sandbox_generation::SandboxGenerationId::parse("generation-retry").unwrap();
let encoded = serde_json::to_vec(&authentication).unwrap();
let error = Box::pin(driver.start_sandbox(
&fixture.p().sandbox_id,
&fixture.p().name,
"generation-retry",
&encoded,
None,
))
.await
.unwrap_err();
let error =
Box::pin(driver.start_sandbox(&fixture.p().sandbox_id, "generation-retry", &encoded, None))
.await
.unwrap_err();
server.await.unwrap();
// Deliberately omit the workspace-root staging input: reaching this gate
// proves the real Start path repaired publication, without starting a fake
Expand Down Expand Up @@ -957,7 +949,6 @@ async fn interrupted_launch_pair_requires_stopped_workload_and_fresh_authenticat
};
let error = Box::pin(driver.start_sandbox(
&fixture.p().sandbox_id,
&fixture.p().name,
"generation-1",
&authentication,
None,
Expand Down Expand Up @@ -1027,7 +1018,6 @@ async fn launch_repair_never_adopts_changed_immutable_bindings() {
driver.docker = Arc::new(docker);
let error = Box::pin(driver.start_sandbox(
&fixture.p().sandbox_id,
&fixture.p().name,
"generation-1",
&test_launch_authentication(),
None,
Expand Down Expand Up @@ -1103,8 +1093,8 @@ async fn startup_cleanup_and_stop_preserve_pending_update_without_a_workload() {
ComputeDriver::stop_sandbox(
&reopened,
Request::new(StopSandboxRequest {
sandbox_id: String::new(),
name: fixture.p().name.clone(),
sandbox_id: fixture.p().sandbox_id.clone(),
name: String::new(),
}),
)
.await
Expand Down Expand Up @@ -1149,8 +1139,8 @@ async fn explicit_delete_clears_pending_gap_and_reports_the_deleted_native_resou
let response = ComputeDriver::delete_sandbox(
&reopened,
Request::new(DeleteSandboxRequest {
sandbox_id: String::new(),
name: fixture.p().name.clone(),
sandbox_id: fixture.p().sandbox_id.clone(),
name: String::new(),
}),
)
.await
Expand Down
Loading
Loading