-
Notifications
You must be signed in to change notification settings - Fork 650
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
[linux/qemu] Qemu bridging v2 #3573
Conversation
It is a stripped-down version of the QEMU bridge helper.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3573 +/- ##
==========================================
+ Coverage 88.83% 88.89% +0.05%
==========================================
Files 253 254 +1
Lines 14170 14250 +80
==========================================
+ Hits 12588 12667 +79
- Misses 1582 1583 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @sharder996, thank you for your work on this. I did a quick pass and I have a couple of questions.
src/platform/backends/qemu/linux/qemu_platform_detail_linux.cpp
Outdated
Show resolved
Hide resolved
src/platform/backends/qemu/linux/qemu_platform_detail_linux.cpp
Outdated
Show resolved
Hide resolved
@sharder996 |
Does clang-format format |
@sharder996 are you perhaps using a different version than CI? Different versions have different ideas of what the format should be. |
@sharder996 |
9f5875c
to
793d271
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sharder996
It looks very good. I only have a few minor comments. The unit test coverage is not high enough, it is easy to add these tests as well. However, on the other side, the uncovered part does not have any actual logic, so it is ok to skip them. I will leave it to you whether you want to push the test coverage up.
Funcitonal testing was done as well, it works fine on linux and macos.
@@ -192,27 +195,46 @@ QStringList mp::QemuPlatformDetail::vm_platform_args(const VirtualMachineDescrip | |||
<< QString::fromStdString(fmt::format("tap,ifname={},script=no,downscript=no,model=virtio-net-pci,mac={}", | |||
tap_device_name, vm_desc.default_mac_address)); | |||
|
|||
auto bridge_helper_path = QCoreApplication::applicationDirPath() + "/bridge_helper"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open for discussion:
we use the hardcoded executable name in CMake and here. It makes more sense to use a variable in CMake and pass it here. The idiom to do this is also simple. Just changing something in the cmake file multipass/src/platform/backends/qemu/linux/CMakeLists.txt
.
set(BRIDGE_HELPER_EXEC_NAME "bridge_helper")
add_library(qemu_platform_detail
dnsmasq_process_spec.cpp
dnsmasq_server.cpp
firewall_config.cpp
qemu_platform_detail_linux.cpp)
target_compile_definitions(qemu_platform_detail PRIVATE BRIDGE_HELPER_EXEC_NAME_CPP="${BRIDGE_HELPER_EXEC_NAME}")
...
and using BRIDGE_HELPER_EXEC_NAME
in the below cmake script and use BRIDGE_HELPER_EXEC_NAME_CPP in the c++ code here.
I know that we also have sshfs_server
in the pattern. So it is open for discussion whether we want to change them both, or whether we want it to be in a different PR or not. Maybe @ricab also has an opinion on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is not difficult to do, I would say yes. If you start running into trouble and needing to invest more time for any reason, I would say leave it.
@georgeliao As for the missing test line coverage. Having no logic to actually test was the reason why I didn't pursue it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff, well done!
Public side of #647
The spec for this feature can be found here.
This second version of QEMU network bridging was required because of the change in implementation of
find_bridge_with()
. Since most of bridged networks was already available on macOS/QEMU and implemented, this PR is mostly just for enabling and wiring up the function calls needed to create a network interface on Linux.The key difference on Linux is the presence of
bridge_helper.c
. Below is an excerpt from the spec on the purpose of the bridge helper: