Skip to content

Conversation

@tobe2098
Copy link
Contributor

The pull request removes from the multipass repo all components related to libvirt. This is part of the effort to restrict multipass to a single backend per platform.

There may still be driver specific logic that has been missed in the initial scan over the code.

Fixes #4364.

MULTI-1891

@tobe2098 tobe2098 self-assigned this Sep 17, 2025
@codecov
Copy link

codecov bot commented Sep 17, 2025

Codecov Report

❌ Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.77%. Comparing base (bc0d111) to head (3fde1f7).
⚠️ Report is 57 commits behind head on main.

Files with missing lines Patch % Lines
src/daemon/daemon.cpp 81.81% 2 Missing ⚠️
src/utils/utils.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4365      +/-   ##
==========================================
+ Coverage   89.24%   89.77%   +0.52%     
==========================================
  Files         260      256       -4     
  Lines       17329    16872     -457     
==========================================
- Hits        15465    15146     -319     
+ Misses       1864     1726     -138     

☔ 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should already be there, since daemon should link with libqemu.a. This absence caused problems when the CMakeLists.txt from libvirt, which contained daemon, was removed.

Copy link
Contributor Author

@tobe2098 tobe2098 left a comment

Choose a reason for hiding this comment

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

Tested locally both the build and the snap, both seem to work fine. All google tests also passed.

@tobe2098 tobe2098 marked this pull request as ready for review September 18, 2025 15:34
@tobe2098 tobe2098 force-pushed the backend/remove-libvirt branch 2 times, most recently from ea0e7aa to 49258bc Compare September 19, 2025 12:29
@tobe2098
Copy link
Contributor Author

Additionally to all the changes directly related to libvirt I have found the following backend-dependant functions that could warrant a change/adaptation when LXD is removed:

  • In BaseVirtualMachineFactory:
    • require_clone_support throws by default in virtual function, only not implemented in lxd and libvirt, otherwise does nothing. Can be removed entirely once both are gone.
    • require_suspend_support does nothing by default in virtual function and only implemented in lxd to throw. Can be removed entirely once lxd is gone.
    • require_snapshot_support throws by default in virtual function, only not implemented in lxd and libvirt, otherwise does nothing. Can be removed entirely once both are gone.
    • clone_vm_impl is the same but the derived virtual functions do not have empty body. Cannot be removed.
  • In BaseVirtualMachine:
    • require_snapshots_support, same as above.
    • add_network_interface (not impl by libvirt) and make_native_mount (not impl by vbox and libvirt) throw by default but have implementations in the other backends, so cannot be removed.

Should I add a comment in the removable functions post LXD removal?

@ricab
Copy link
Collaborator

ricab commented Sep 19, 2025

Yes please @tobe2098. Well spotted!

@ricab
Copy link
Collaborator

ricab commented Sep 23, 2025

Hey Antoni, I noticed src/platform/backends/shared/qemu_img_utils/ while browsing code and started wondering: is anything in there used anywhere other than QEMU and libvirt? Possibly LXD? Would you mind having a look, to see if we could consolidate into just QEMU? Thanks!

@tobe2098
Copy link
Contributor Author

tobe2098 commented Sep 24, 2025

On it

Hey Antoni, I noticed src/platform/backends/shared/qemu_img_utils/ while browsing code and started wondering: is anything in there used anywhere other than QEMU and libvirt? Possibly LXD? Would you mind having a look, to see if we could consolidate into just QEMU? Thanks!

Both LXD and libvirt (ofc also QEMU) use the functions on that folder.
There is one particular function that is used by libvirt and qemu only, which could be moved in this PR to the qemu backend, but I think that we should move all of them once we remove LXD, since the rest will have to be moved then.

@ricab
Copy link
Collaborator

ricab commented Sep 24, 2025

OK got it, that makes sense. I wouldn't object doing them together when removing LXD if you prefer. Up to you. You can also add TODO tags in the code if you think that's helpful.

@tobe2098 tobe2098 force-pushed the backend/remove-libvirt branch from e55c739 to 9a19181 Compare September 24, 2025 14:39
Copy link
Collaborator

@sharder996 sharder996 left a comment

Choose a reason for hiding this comment

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

Looks good! Just a few nitpicks

@tobe2098 tobe2098 force-pushed the backend/remove-libvirt branch from f39edbb to 301d713 Compare September 29, 2025 15:19
@tobe2098 tobe2098 requested a review from sharder996 October 1, 2025 07:37
sharder996
sharder996 previously approved these changes Oct 1, 2025
tobe2098 and others added 19 commits October 10, 2025 11:19
Reintroduced test that was removed due to inaccurate comments.
Added comments earmarking the functions that can be removed once
both libvirt and LXD have been removed as backends.
On LXD removal the qemu_img_utils can be moved to the qemu backend since
it is the only caller.
The ARP cache displays IP addresses that have recently been translated
from a MAC address. It can potentially contains stale IP addresses so
we return the most recent IP address (assuming IP addresses are assigned
in sequential order).
Ubuntu Core images initialize themselves in two stages separated by a
guest system reboot. An IP address is assigned to the guest during the
first phase even though networking is not fully initialized. We wait
until a fresh IP is assigned and the guest signals it is ready by
sending a response from a ping.
Copy link
Contributor

@jimporter jimporter left a comment

Choose a reason for hiding this comment

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

This looks good to me.

@tobe2098 tobe2098 added this pull request to the merge queue Oct 14, 2025
@tobe2098 tobe2098 removed this pull request from the merge queue due to a manual request Oct 14, 2025
@tobe2098 tobe2098 added this pull request to the merge queue Oct 14, 2025
Merged via the queue into main with commit f42cf65 Oct 14, 2025
21 of 22 checks passed
@tobe2098 tobe2098 deleted the backend/remove-libvirt branch October 14, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment