Skip to content

Conversation

@levkropp
Copy link
Contributor

@levkropp levkropp commented Mar 27, 2025

$     multipass list
No instances found.
$     multipass launch
Launched: frisky-sturgeon in zone zone1
$     multipass launch --zone zone1,zone3
launch failed: Invalid arguments supplied
$     multipass launch --zone zone1,
launch failed: Invalid arguments supplied
$     multipass launch --zone zone
launch failed: Invalid arguments supplied
$     multipass launch --zone zone3
Launched: quiet-lapwing in zone zone3
$     multipass list
Name                    State             IPv4             Image               Zone
frisky-sturgeon         Running           10.127.101.158   Ubuntu 24.04 LTS    zone1(a)
quiet-lapwing           Running           10.127.101.19    Ubuntu 24.04 LTS    zone3(a)

This pull request includes several changes to improve the launch command functionality in the src/client/cli/cmd/launch.cpp file, focusing on code formatting and adding a new --zone option. Additionally, it includes updates to the daemon and tests to support the new functionality.

New --zone option:

  • src/client/cli/cmd/launch.cpp: Added a new --zone option to specify the availability zone during the launch command. This includes parsing the new option and setting the zone in the request. [1] [2]
  • src/daemon/daemon.cpp: Updated the daemon to handle the new zone information and include it in the response. [1] [2]
  • src/rpc/multipass.proto: Added a new zone_name field to the LaunchReply message to communicate the zone information.

Test updates:

  • tests/test_cli_client.cpp: Added new tests to verify the functionality of the --zone option, including tests for valid, empty, and nonexistent zone values.

@levkropp levkropp force-pushed the az-launch-command branch from 25fc219 to a4bb060 Compare March 27, 2025 16:48
@codecov
Copy link

codecov bot commented Mar 27, 2025

Codecov Report

❌ Patch coverage is 75.67568% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.46%. Comparing base (badabe0) to head (5c7a9b6).
⚠️ Report is 3188 commits behind head on az-enable-disable-commands.

Files with missing lines Patch % Lines
src/client/cli/cmd/launch.cpp 30.76% 9 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##           az-enable-disable-commands    #4011      +/-   ##
==============================================================
- Coverage                       87.51%   87.46%   -0.05%     
==============================================================
  Files                             268      268              
  Lines                           15149    15162      +13     
==============================================================
+ Hits                            13258    13262       +4     
- Misses                           1891     1900       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@levkropp levkropp force-pushed the az-launch-command branch 5 times, most recently from 16ac95a to 882f19a Compare March 31, 2025 17:52
@levkropp levkropp marked this pull request as ready for review March 31, 2025 17:56
@levkropp levkropp force-pushed the az-launch-command branch 3 times, most recently from 8c3639e to 51b2112 Compare April 1, 2025 16:20
@andrei-toterman andrei-toterman force-pushed the az-enable-disable-commands branch from 043edde to d91dc99 Compare April 2, 2025 14:06
@ricab ricab self-requested a review April 4, 2025 15:14
@andrei-toterman andrei-toterman force-pushed the az-enable-disable-commands branch 2 times, most recently from 7ec3ba7 to fa9880f Compare April 8, 2025 14:53
@levkropp levkropp force-pushed the az-launch-command branch from 51b2112 to 3b065cc Compare April 8, 2025 17:55
@andrei-toterman andrei-toterman force-pushed the az-enable-disable-commands branch from fa9880f to badabe0 Compare April 9, 2025 10:41
Copy link
Contributor

@andrei-toterman andrei-toterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @levkropp! I have just a few small comments. Besides those, I see that some of the changes are just formatting changes to code that you did not touch, perhaps it was formatted automatically. Could you make sure that you only format code that actually changed?

@levkropp levkropp force-pushed the az-launch-command branch 6 times, most recently from d619572 to b86caf2 Compare April 9, 2025 16:06
@levkropp levkropp requested a review from andrei-toterman April 9, 2025 16:16
Copy link
Contributor

@andrei-toterman andrei-toterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better. But during functional testing I saw some small issues.
If I pass an invalid/unavailable zone to --zone, I get a generic error message launch failed: Invalid arguments supplied. So you'll need to add extra checks for the type of error we get back. The grpc reply should contain the error codes already, you just need to turn them into nice messages. You could add something like

else if (error == LaunchError::INVALID_ZONE)
{
    error_details = fmt::format("Invalid zone name supplied: {}", request.zone());
}
else if (error == LaunchError::ZONE_UNAVAILABLE)
{
    error_details = fmt::format("Unavailable zone name supplied: {}", request.zone());
}

to the existing if-else chain that checks other LaunchError codes.

@levkropp levkropp force-pushed the az-launch-command branch from b86caf2 to 5c7a9b6 Compare April 9, 2025 17:40
@levkropp levkropp requested a review from andrei-toterman April 9, 2025 17:53
Copy link
Contributor

@andrei-toterman andrei-toterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, looks good to me now! Thanks, @levkropp!

@levkropp levkropp merged commit 479d1b2 into az-enable-disable-commands May 1, 2025
10 of 15 checks passed
@levkropp levkropp deleted the az-launch-command branch May 1, 2025 15:41
@ricab
Copy link
Collaborator

ricab commented May 2, 2025

Hey @levkropp, I still meant to review this - sorry for taking so long. I guess I'll review within #3926 now. Let's try to merge stacked PRs sequentially into the feature branch.

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.

3 participants