kvm: set LIBVIRTD_ARGS so libvirtd listens on Debian and Ubuntu hosts - #14153
Open
nagaboinaramgopal wants to merge 1 commit into
Open
kvm: set LIBVIRTD_ARGS so libvirtd listens on Debian and Ubuntu hosts#14153nagaboinaramgopal wants to merge 1 commit into
nagaboinaramgopal wants to merge 1 commit into
Conversation
cloudstack-setup-agent sets up live migration on Debian and Ubuntu by writing libvirtd_opts='-l' to /etc/default/libvirtd and masking the libvirtd sockets. The libvirtd.service unit on current releases reads LIBVIRTD_ARGS from that file instead (Debian 12 and 13 run "libvirtd $LIBVIRTD_ARGS" with "--timeout 120" as the default), so after adding a host libvirtd runs without --listen, nothing listens on the migration ports and live migration fails with "unable to connect to server". Also set LIBVIRTD_ARGS="--listen", and keep libvirtd_opts for older units that still read it.
weizhouapache
approved these changes
Sep 12, 2026
weizhouapache
left a comment
Member
There was a problem hiding this comment.
code lgtm
we have not faced this issue in Trillian tests, as we have already applied it via ansible
- name: Update /etc/default/libvirtd in Ubuntu 22.04
lineinfile:
dest: "/etc/default/libvirtd"
regexp: '^LIBVIRTD_ARGS=*'
line: 'LIBVIRTD_ARGS="-l"'
when: ansible_distribution_version is version('22.04','>=')
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.20 #14153 +/- ##
============================================
- Coverage 16.38% 16.38% -0.01%
+ Complexity 13615 13614 -1
============================================
Files 5669 5669
Lines 501561 501561
Branches 60922 60922
============================================
- Hits 82168 82167 -1
- Misses 410185 410186 +1
Partials 9208 9208
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
cloudstack-setup-agent sets up live migration on Debian and Ubuntu by writing
libvirtd_opts='-l'to /etc/default/libvirtd and masking the libvirtd sockets. The libvirtd.service unit on current releases readsLIBVIRTD_ARGSfrom that file instead (Debian 12 and 13:ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGSwith--timeout 120as the default), so after adding a host libvirtd runs without--listen, nothing listens on 16509/16514 and live migration fails. This also setsLIBVIRTD_ARGS="--listen", and keepslibvirtd_optsfor older units that still read it.Related: #9802 and #12374.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
N/A
How Has This Been Tested?
Live tested on two fresh Debian 13 KVM hosts (libvirt 11.3, QEMU 10.0) added to a cluster with addHost, with NFS primary storage, and a VM live migrated between them with migrateVirtualMachine.
Before this change, right after addHost:
With this change, same hosts reset to the distro defaults and added again:
Debian 12 (libvirt 9.0) uses the same unit layout.
How did you try to break this feature and the system with this change?
Older units that read libvirtd_opts still get it. replace_or_add_line replaces an existing or commented LIBVIRTD_ARGS line, so adding a host again does not duplicate it. The RHEL and SUSE paths are unchanged.