Skip to content

Commit a642a14

Browse files
committed
to-disk: Log ssh connection timeout
Signed-off-by: Colin Walters <[email protected]>
1 parent ad60562 commit a642a14

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

crates/kit/src/run_ephemeral_ssh.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub fn wait_for_ssh_ready(
110110
container_name: &str,
111111
timeout: Option<Duration>,
112112
progress: ProgressBar,
113-
) -> Result<ProgressBar> {
113+
) -> Result<(std::time::Duration, ProgressBar)> {
114114
let timeout = timeout.unwrap_or(SSH_TIMEOUT);
115115
let (_, progress) = wait_for_vm_ssh(container_name, Some(timeout), progress)?;
116116

@@ -135,7 +135,7 @@ pub fn wait_for_ssh_ready(
135135
if let Ok(exit_status) = status {
136136
if exit_status.success() {
137137
debug!("SSH connection successful, VM is ready");
138-
return Ok(progress);
138+
return Ok((start_time.elapsed(), progress));
139139
}
140140
}
141141

@@ -165,7 +165,7 @@ pub fn run_ephemeral_ssh(opts: RunEphemeralSshOpts) -> Result<()> {
165165
debug!("Using container ID: {}", container_name);
166166

167167
let progress_bar = crate::boot_progress::create_boot_progress_bar();
168-
let progress_bar = wait_for_ssh_ready(&container_name, None, progress_bar)?;
168+
let (_duration, progress_bar) = wait_for_ssh_ready(&container_name, None, progress_bar)?;
169169
progress_bar.finish_and_clear();
170170

171171
// Execute SSH connection directly (no thread needed for this)

crates/kit/src/to_disk.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ use camino::Utf8PathBuf;
8484
use clap::{Parser, ValueEnum};
8585
use color_eyre::eyre::{eyre, Context};
8686
use color_eyre::Result;
87+
use indicatif::HumanDuration;
8788
use indoc::indoc;
8889
use tracing::debug;
8990

@@ -432,8 +433,12 @@ pub fn run(opts: ToDiskOpts) -> Result<()> {
432433
let result = (|| -> Result<()> {
433434
// Wait for SSH to be ready
434435
let progress_bar = crate::boot_progress::create_boot_progress_bar();
435-
let progress_bar = wait_for_ssh_ready(&container_id, None, progress_bar)?;
436+
let (duration, progress_bar) = wait_for_ssh_ready(&container_id, None, progress_bar)?;
436437
progress_bar.finish_and_clear();
438+
println!(
439+
"Connected ({} elapsed), beginning installation...",
440+
HumanDuration(duration)
441+
);
437442

438443
// Connect via SSH and execute the installation command
439444
debug!(

0 commit comments

Comments
 (0)