file restore: scale per-round delay up dynamically
Avoids latency for restore-VMs that are finished fast but not ready yet the first round while not checking to often for slower ones, iow, we assume that the start up distribution is looking like a chi-square Χ² with k=3. With 25*round we get at max 45 rounds totalling to 25.875 s delay and 1.125 max between-round delay, which still provides an ok reaction time. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
48ce3d00a4
commit
1f8b29f578
|
@ -305,6 +305,7 @@ pub async fn start_vm(
|
||||||
let pid_t = Pid::from_raw(pid);
|
let pid_t = Pid::from_raw(pid);
|
||||||
|
|
||||||
let start_poll = Instant::now();
|
let start_poll = Instant::now();
|
||||||
|
let mut round = 1;
|
||||||
loop {
|
loop {
|
||||||
let client = VsockClient::new(cid as i32, DEFAULT_VSOCK_PORT, Some(ticket.to_owned()));
|
let client = VsockClient::new(cid as i32, DEFAULT_VSOCK_PORT, Some(ticket.to_owned()));
|
||||||
if let Ok(Ok(_)) =
|
if let Ok(Ok(_)) =
|
||||||
|
@ -324,7 +325,8 @@ pub async fn start_vm(
|
||||||
if Instant::now().duration_since(start_poll) > Duration::from_secs(25) {
|
if Instant::now().duration_since(start_poll) > Duration::from_secs(25) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
time::sleep(Duration::from_millis(200)).await;
|
time::sleep(Duration::from_millis(round * 25)).await;
|
||||||
|
round += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// start failed
|
// start failed
|
||||||
|
|
Loading…
Reference in New Issue