Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add network bridges #3195

Merged
merged 54 commits into from
Jan 5, 2024
Merged

Add network bridges #3195

merged 54 commits into from
Jan 5, 2024

Conversation

luis4a0
Copy link
Contributor

@luis4a0 luis4a0 commented Aug 17, 2023

No description provided.

@codecov
Copy link

codecov bot commented Aug 17, 2023

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (4b38e63) 83.92% compared to head (89f1b78) 84.05%.

Files Patch % Lines
src/daemon/daemon.cpp 94.25% 5 Missing ⚠️
src/client/cli/cmd/launch.cpp 0.00% 4 Missing ⚠️
src/client/cli/cmd/delete.cpp 0.00% 3 Missing ⚠️
src/daemon/instance_settings_handler.cpp 89.65% 3 Missing ⚠️
...rc/platform/backends/qemu/qemu_virtual_machine.cpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3195      +/-   ##
==========================================
+ Coverage   83.92%   84.05%   +0.13%     
==========================================
  Files         251      251              
  Lines       13678    13793     +115     
==========================================
+ Hits        11479    11594     +115     
  Misses       2199     2199              

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

@luis4a0 luis4a0 force-pushed the add-network-bridges branch from 4a943ee to eb421ee Compare September 6, 2023 12:10
@luis4a0 luis4a0 force-pushed the add-network-bridges branch 2 times, most recently from c722db6 to 3c0ab54 Compare September 26, 2023 14:59
@luis4a0 luis4a0 force-pushed the add-network-bridges branch from 6f3b12d to 9d23fef Compare October 6, 2023 14:47
@georgeliao georgeliao force-pushed the add-network-bridges branch from 008aa0f to da8fc75 Compare October 9, 2023 11:01
@luis4a0 luis4a0 force-pushed the add-network-bridges branch 2 times, most recently from 50cfcfc to b47e35d Compare October 18, 2023 12:37
@townsend2010 townsend2010 mentioned this pull request Oct 24, 2023
@luis4a0 luis4a0 force-pushed the add-network-bridges branch from 75cb878 to e9f1c2d Compare October 28, 2023 21:58
@luis4a0 luis4a0 marked this pull request as ready for review October 31, 2023 13:24
georgeliao
georgeliao previously approved these changes Oct 31, 2023
@townsend2010 townsend2010 added this to the 1.13.0 milestone Nov 6, 2023
@luis4a0 luis4a0 force-pushed the add-network-bridges branch 3 times, most recently from 4e4fdfe to 74f81e2 Compare November 7, 2023 12:45
@luis4a0 luis4a0 force-pushed the add-network-bridges branch from 74f81e2 to 15875b5 Compare November 8, 2023 13:32
Copy link
Collaborator

@ricab ricab left a comment

Choose a reason for hiding this comment

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

Hey @luis4a0, thank you for your work on this. This is a light review only and I did not try the feature myself. I have a few requests that shouldn't be very difficult to implement.

include/multipass/cli/prompters.h Outdated Show resolved Hide resolved
src/client/cli/cmd/launch.cpp Outdated Show resolved Hide resolved
src/client/cli/cmd/start.cpp Outdated Show resolved Hide resolved
include/multipass/cli/prompters.h Outdated Show resolved Hide resolved
src/utils/utils.cpp Outdated Show resolved Hide resolved
src/daemon/daemon.cpp Outdated Show resolved Hide resolved
src/daemon/daemon.cpp Show resolved Hide resolved
}
catch (const mp::NotImplementedOnThisBackendException&)
{
run_at_boot.erase(name);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this rethrow? And actually, couldn't this be structured such that we only add run_at_booy[name] after (if) everything else succeeds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rethrowing would mean to abort the execution of the start command. The problem with adding commands to the vector if everything succeeds would be possible, but the daemon would have to carry a lot of information about interfaces. Rolling back this way is much simpler.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh I didn't realize this was called at start. We should instead detect that bridging isn't implemented when the user tries to set bridged=true and refuse it at that point. What happens now in that case?

For adding only after success, I was probably not very clear. What I mean is that this should compose the commands var but only add them to run_at_boot at the end, when we know everything succeeded. That would avoid having to catch and erase, or leaving lingering commands behind if other exceptions are thrown.

@townsend2010 townsend2010 linked an issue Nov 9, 2023 that may be closed by this pull request
@luis4a0 luis4a0 force-pushed the add-network-bridges branch 2 times, most recently from d5411be to 0f495b4 Compare November 10, 2023 09:38
@luis4a0
Copy link
Contributor Author

luis4a0 commented Nov 17, 2023

Hey @ricab and @georgeliao! I addressed your comments, thanks for taking the time to review! This is ready for another review pass. Thanks!

Copy link
Collaborator

@ricab ricab left a comment

Choose a reason for hiding this comment

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

Hey @luis4a0, there are a couple of things that I think still need to be addressed (one tiny the other more important).

}
catch (const mp::NotImplementedOnThisBackendException&)
{
run_at_boot.erase(name);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh I didn't realize this was called at start. We should instead detect that bridging isn't implemented when the user tries to set bridged=true and refuse it at that point. What happens now in that case?

For adding only after success, I was probably not very clear. What I mean is that this should compose the commands var but only add them to run_at_boot at the end, when we know everything succeeded. That would avoid having to catch and erase, or leaving lingering commands behind if other exceptions are thrown.

@ricab ricab self-requested a review November 21, 2023 16:50
@luis4a0
Copy link
Contributor Author

luis4a0 commented Nov 23, 2023

Hey @ricab! I implemented, as you proposed, refusing adding the bridged interface just in the moment the user issues the set command. So this PR might be ready for another round of review. Thanks!

@luis4a0 luis4a0 force-pushed the add-network-bridges branch from 2ffe7ca to cebe251 Compare November 27, 2023 18:04
@luis4a0
Copy link
Contributor Author

luis4a0 commented Nov 27, 2023

Hey @georgeliao @ricab! Done the changes. I also added some tweaks for this to look like what I imagined :) And I finally rebased upong the latest main. So this is ready for reviewing.

Note: the private side will not yet compile, I still need to do the rebase on the private branch, but I'll do it after this gets merged.

Thanks!

@townsend2010 townsend2010 linked an issue Nov 28, 2023 that may be closed by this pull request
luis4a0 added 23 commits January 4, 2024 15:14
If the execution of the commands to configure the new interfaces through
SSH fails, an annoying message is shown. This commit makes that message
appear only when the execution failed; as opposed to show it in case of
any failure.
…aces

Add bridged interfaces in macOS QEMU
This assures persistence in the data structure. This means that commands
to be run at boot will be executed even if the daemon is restarted.
Copy link
Collaborator

@ricab ricab left a comment

Choose a reason for hiding this comment

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

Alright, LGTM now (modulo issues we agreed to deal with separately).

Thank you for all your work @luis4a0!

@ricab ricab merged commit d84f8f7 into main Jan 5, 2024
11 of 12 checks passed
@ricab ricab deleted the add-network-bridges branch January 5, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants