Skip to content

Commit c515440

Browse files
authored
Merge pull request #846 from Dstack-TEE/codex/fix-simulator-gcp-vtpm-readiness
fix(simulator): wait for GCP vTPM readiness
2 parents 931a055 + 26cc02c commit c515440

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

  • dstack/tee-simulator/src

dstack/tee-simulator/src/tpm.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,22 @@ pub fn start_gcp_vtpm(runtime_dir: &Path, config: &TeeSimulatorConfig) -> Result
115115
}
116116
thread::sleep(Duration::from_millis(20));
117117
}
118-
command("tpm2_startup", &["-c"])?;
118+
let mut startup_error = None;
119+
for _ in 0..100 {
120+
match command("tpm2_startup", &["-c"]) {
121+
Ok(()) => {
122+
startup_error = None;
123+
break;
124+
}
125+
Err(error) => {
126+
startup_error = Some(error);
127+
thread::sleep(Duration::from_millis(20));
128+
}
129+
}
130+
}
131+
if let Some(error) = startup_error {
132+
return Err(error).context("GCP vTPM did not become ready");
133+
}
119134
replay_fixture_event_log()?;
120135

121136
let template_with_size = state_dir.join("ak.tpm2b-public");

0 commit comments

Comments
 (0)