[feat] Add wait-ready command to check Multipass daemon readiness #4145
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature: Add
multipass wait-ready
commandDescription:
This PR introduces a new CLI command,
multipass wait-ready
. This command allows users and scripts to pause execution until the Multipass daemon is fully initialized and ready to accept requests. This is particularly beneficial for automation workflows that need to ensure the daemon is operational before proceeding with other Multipass operations.The
wait-ready
command works by:WaitReady
request to the daemon.--timeout
option (in seconds). If the daemon isn't ready within the specified timeout, the command exits with an error. If no timeout is given, it waits indefinitely.Motivation:
Related Issues:
Fixes #452
Fixes #3723
Key Implementation Changes:
wait_ready.cpp
): New command logic, including retry for socket connection, timeout handling (reusingmp::cmd::parse_timeout
), and spinner integration.multipass.proto
): AddedWaitReadyRequest
/WaitReadyReply
messages andWaitReady
RPC method.daemon_rpc.cpp
,daemon.cpp
):daemon_rpc.cpp
.daemon.cpp
leverages the existingwait_update_manifests_all_and_optionally_applied_force()
function.How to Test:
$ cd build
.--timeout
, simply run thewait-ready
command with the--timeout
option:wait-ready
), start up the daemon and immediately usemultipass launch
:wait-ready
command solves the issue, fit thewait-ready
command between daemon startup andmultipass launch
:multipass launch
process. You may Ctrl+C here to terminate the launch process.Points for Reviewers:
wait_update_manifests_all_and_optionally_applied_force(true)
is an appropriate and robust proxy for overall daemon readiness.