Skip to content

hostagent: unify requirement progress logging with (N/total) counter#4902

Open
mn-ram wants to merge 1 commit intolima-vm:masterfrom
mn-ram:improve-requirements-logging
Open

hostagent: unify requirement progress logging with (N/total) counter#4902
mn-ram wants to merge 1 commit intolima-vm:masterfrom
mn-ram:improve-requirements-logging

Conversation

@mn-ram
Copy link
Copy Markdown
Contributor

@mn-ram mn-ram commented Apr 28, 2026

Fixes #4553.

Pre-compute the total number of requirement steps (essential + optional + guest-agent wait + final) and thread a shared counter through waitForRequirements so each progress line is prefixed with (N/total). The description is no longer quoted, and the satisfied line drops the per-group label.

Sample output (k8s template; 10 total steps):

(1/10) Waiting for ssh (essential)
(1/10) Ssh is satisfied
(2/10) Waiting for user session is ready for ssh (essential)
(2/10) User session is ready for ssh is satisfied
(3/10) Waiting for systemd must be available
(3/10) Systemd must be available is satisfied
...
(9/10) Waiting for the guest agent to be running
(9/10) Guest agent is running
(10/10) Waiting for boot scripts must have finished
(10/10) Boot scripts must have finished is satisfied

go build ./..., go vet ./pkg/hostagent/..., go test ./pkg/hostagent/... all clean.

Today the hostagent emits three independently-numbered groups of
requirement logs (essential X of N, optional X of N, final X of N) plus
a separate "Waiting for the guest agent to be running" line, which makes
it hard to follow the sequence or build a progress indicator.

Pre-compute the total number of steps (essential + optional + guest
agent + final) and thread a shared counter through waitForRequirements
so each line is prefixed with `(N/total)`. The lead-in becomes the
important detail (`Waiting for ssh`), the requirement description is
no longer quoted, and the satisfied form drops the per-group label:

  (1/10) Waiting for ssh (essential)
  (1/10) Ssh is satisfied
  (3/10) Waiting for systemd must be available
  (3/10) Systemd must be available is satisfied
  (9/10) Waiting for the guest agent to be running
  (9/10) Guest agent is running

Fixes lima-vm#4553.

Signed-off-by: mn-ram <235066282+mn-ram@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve logging of essential and optional requirements in hostagent logs

1 participant