From 80cc980d05b734545410f3d86b2c76cb654d7979 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 19 Jun 2026 14:31:19 +0200 Subject: [PATCH] performance-metrics: Detect boot via the cloud-init callback The boot time tests inferred guest readiness from the two debug I/O port markers on stderr. Heavier boots could miss the fixed sleep window, capture a single marker, and panic. Wait on the cloud-init injected notify-booted callback through guest.wait_vm_boot() instead. Once the callback fires, both markers are guaranteed present, so they are parsed only for the metric. The host side keeps an overall timeout, so a guest that never boots is still reaped. Signed-off-by: Anatol Belski --- performance-metrics/src/performance_tests.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/performance-metrics/src/performance_tests.rs b/performance-metrics/src/performance_tests.rs index 8706c1fb4..c8fe1e305 100644 --- a/performance-metrics/src/performance_tests.rs +++ b/performance-metrics/src/performance_tests.rs @@ -295,7 +295,7 @@ fn parse_boot_time_output(output: &[u8]) -> Result { }) } -fn measure_boot_time(cmd: &mut GuestCommand, test_timeout: u32) -> Result { +fn measure_boot_time(cmd: &mut GuestCommand, guest: &Guest) -> Result { let mut child = cmd .capture_output() .verbosity(VerbosityLevel::Warn) @@ -303,9 +303,10 @@ fn measure_boot_time(cmd: &mut GuestCommand, test_timeout: u32) -> Result f64 { .args(["--memory", "size=1G"]) .default_kernel_cmdline() .args(["--console", "off"]) + .default_net() .default_disks(); - measure_boot_time(c, control.test_timeout).unwrap() + measure_boot_time(c, &guest).unwrap() }); match r { @@ -348,12 +350,15 @@ pub fn performance_boot_time_pmem(control: &PerformanceTestControl) -> f64 { let jammy = UbuntuDiskConfig::new(JAMMY_IMAGE_NAME.to_string()); let guest = performance_test_new_guest(Box::new(jammy), control); let mut cmd = GuestCommand::new(&guest); + let cloud_init = guest.disk_config.disk(DiskType::CloudInit).unwrap(); let c = cmd .default_cpus() .args(["--memory", "size=1G,hugepages=on"]) .args(["--kernel", direct_kernel_boot_path().to_str().unwrap()]) .args(["--cmdline", "root=/dev/pmem0p1 console=ttyS0 quiet rw"]) .args(["--console", "off"]) + .default_net() + .args(["--disk", format!("path={cloud_init}").as_str()]) .args([ "--pmem", format!( @@ -363,7 +368,7 @@ pub fn performance_boot_time_pmem(control: &PerformanceTestControl) -> f64 { .as_str(), ]); - measure_boot_time(c, control.test_timeout).unwrap() + measure_boot_time(c, &guest).unwrap() }); match r {