Skip to content

Commit

Permalink
Add functionality for lazy pipette connections
Browse files Browse the repository at this point in the history
  • Loading branch information
smalis-msft authored and mingweishih committed Nov 21, 2024
1 parent d6e805c commit 1aa1019
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions petri/src/vm/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,16 @@ impl PetriVmConfig {
}

/// Run the VM, launching pipette and returning a client to it.
pub async fn run(mut self) -> anyhow::Result<(PetriVm, PipetteClient)> {
pub async fn run(self) -> anyhow::Result<(PetriVm, PipetteClient)> {
let mut vm = self.run_with_lazy_pipette().await?;
let client = vm.wait_for_agent().await?;
Ok((vm, client))
}

/// Run the VM, configuring pipette to automatically start, but do not wait
/// for it to connect. This is useful for tests where the first boot attempt
/// is expected to not succeed, but pipette functionality is still desired.
pub async fn run_with_lazy_pipette(mut self) -> anyhow::Result<PetriVm> {
const CIDATA_SCSI_INSTANCE: Guid =
Guid::from_static_str("766e96f8-2ceb-437e-afe3-a93169e48a7b");

Expand Down Expand Up @@ -227,9 +236,7 @@ impl PetriVmConfig {
vm.launch_linux_direct_pipette().await?;
}

let client = vm.wait_for_agent().await?;

Ok((vm, client))
Ok(vm)
}

fn start_watchdog_tasks(
Expand Down

0 comments on commit 1aa1019

Please sign in to comment.