The 6.7.0 release of both libvirt and libvirt-python is tagged and
signed tarballs and source RPMs are available at
https://libvirt.org/sources/https://libvirt.org/sources/python/
Thanks everybody who helped with this release by sending patches,
reviewing, testing, or providing any other feedback. Your work is
greatly appreciated.
* Packaging changes
* Libvirt switch to Meson build system
Libvirt abandoned autotools and switched to Meson build system.
* New features
* qemu: Add support for initiator IQN configuration for iSCSI hostdevs
Similarly to iSCSI ``<disk>`` users can use an ``<initiator>`` element
inside ``<hostdev>`` with the same format to configure the ``IQN`` value
used by the qemu initiator when connecting to an iSCSI target.
* xen: Add support for device model command-line passthrough
Xen supports passing arbitrary arguments to the QEMU device model using
the ``device_model_args`` setting in xl.cfg(5). The libvirt xen driver now
supports this using ``<xen:commandline/>`` XML extensions.
* shmem: Add support for shmem-{plain, doorbell} ``role`` option
The ``role`` attribute controls how the domain behaves on migration. With
``role=master``, the guest will copy the shared memory on migration to
the destination host. With ``role=peer``, the migration is disabled.
* bhyve: Sound device support
This feature allows to configure guest sound device using
the ``<sound>`` element, and map it to the host sound device using
the ``<audio>`` element.
* Improvements
* Allow sparse streams for block devices
Sparse streams (e.g. ``virsh vol-download --sparse`` or ``virsh vol-upload
--sparse``) now handle if one of the stream ends is a block device.
* Remove NVDIMM auto-alignment for pSeries Guests
This feature was introduced in libvirt v6.2.0 as part of the overall
NVDIMM support for pSeries guests. The idea was to relieve the user
from knowing ppc64 alignment details, but the end result is that we
ended up with inconsistencies between domain XML and actual NVDIMM
size the guest is using. To promote consistency between domain XML
and the guest, unaligned NVDIMM sizes for pSeries guests will now be
forbidden and no size auto-alignment will be made. Instead, libvirt will
suggest an aligned round up size for the user.
* Bug fixes
* virdevmapper: Deal with kernels without DM support
In the previous release libvirt dropped libdevmapper in favor of its own
implementation. However, it failed to deal correctly with kernels that
either don't have device mapper enabled or where the dm-mod module is not
loaded yet. This is now fixed.
* resctrl: Use exclusive lock for /sys/fs/resctrl
When two or more domains were attempted to start at once, due to a bug in
implementation, resctrl was not locked properly and thus threads did not
mutually exclude with each other resulting in not setting requested
limitations.
* mdev: Fix daemon crash when reattaching mdevs on assignment conflict
If there's a list of mdevs to be assigned to a domain, but one of them (NOT
the first) is already assigned to a different domain then libvirtd would
crash. This is now fixed.
* Fix logic in setting COW flag on btrfs
When COW is not explicitly requested to be disabled or enabled, then
libvirt should do nothing on non-BTRFS file systems.
* Avoid crash due to race in glib event loop code
Libvirt switched to glib event loop in 6.1.0 but it was also tickling a bug
in glib code leading to the daemon crash. Libvirt way of calling glib was
changed so the daemon crashes no more.
* virdevmapper: Handle kernel without device-mapper support
In the previous release, Libvirt dropped libdevmapper in favor of its own
implementation. But the implementation did not handle kernels without
device-mapper support. This is now fixed.
* remove autogenerated macvtap names from migration XML
Autogenerated macvtap device names were being left in the
migration XML, which could result in libvirt erroneously deleting
the macvtap device of a different guest in the aftermath of
failing to restart the guest on the destination host. Removing the
autogenerated names avoids this.
Enjoy.
Jirka
Hello again libvirt community!
This summer, I once again worked on a GSoC project with libvirt. This
time, the goal of my project was to improve the libvirt integration with
SaltStack and, in particular, the support for VM migration.
SaltStack is an incredibly valuable tool that helps with automation and
infrastructure management. This is accomplished with master/minion
topology where a master acts as a central control bus for the clients
(minions), and the minions connect back to the master. The Salt virt
module provides support for core cloud operations such as VM lifecycle
management, including VM migration, by allowing minions to connect with
libvirt virtualization host.
The Salt virt.migrate interface allows users to migrate a VM from one
host to another. However, the implementation of this function used to be
based on the virsh command-line tool (instead of the libvirt Python API
bindings), which had resulted in an increased code complexity (e.g.,
string concatenation, invoking Popen.subprocess, etc) and had a limited
number of migration options exposed to users.
My project was roughly separated into three phases. The aim of the first
phase was to improve the test coverage of the virt module by increasing
the number of integration tests (i.e., before applying any major code
changes). However, SaltStack is designed to run on different platforms,
and it has been extended over the years to support many applications and
tools. Consequently, the SaltStack test suite has grown in complexity
and number of dependencies as well. As a result, not all of them (e.g.,
libvirt and qemu) are available in the Jenkins CI environment. In
addition, our goal was to only be able to effectively test VM lifecycle
management features (start, destroy, list, etc.) but also to test VM
migration. To achieve this we packaged libvirt, qemu, and all required
SaltStack minion dependencies in a container image that allows us to
spawn multiple virtualization host instances on a single machine (with
low virtualization overhead).
In the second phase of the project, now with a test environment in
place, we were able to refactor the virt.migrate implementation to
utilize the Python bindings of libvirt and add support for additional
migration options (described in the “What's new?” section below).
The third phase was primarily focused on refining the set patches,
resolving merge conflicts with upstream changes or other related PRs.
One of the major challenges was to revisit the set of tests to make them
compatible with pytest as well to collaborate with the SaltStack
community to ensure that all proposed changes will be easy to maintain
in the future.
Contributions
============
Although the development work was done in several iterations, with code
reviews on regular basis, the final result was consolidated in a single
GitHub pull request: https://github.com/saltstack/salt/pull/57947
What’s new?
===========
https://docs.saltstack.com/en/master/ref/modules/all/salt.modules.virt.html…
The virt.migrate interface of SaltStack has been extended to support
target URI format:
$ salt src virt.migrate guest qemu+ssh://dst/system
$ salt src virt.migrate guest qemu+tcp://dst/system
$ salt src virt.migrate guest qemu+tls://dst/system
with preserved backward compatibility:
$ salt src virt.migrate guest dst
$ salt src virt.migrate guest dst True
Support for the following migration options was introduced:
Disable live migration
$ salt src virt.migrate guest qemu+ssh://dst/system live=False
Leave the migrated VM transient on destination host
$ salt src virt.migrate guest qemu+ssh://dst/system persistent=False
Leave the domain defined on the source host
$ salt src virt.migrate guest qemu+ssh://dst/system undefinesource=False
Offline migration
$ salt src virt.migrate guest qemu+ssh://dst/system offline=False
Set maximum bandwidth (in MiB/s)
$ salt src virt.migrate guest qemu+tls://dst/system max_bandwidth=10
Set maximum tolerable downtime for live-migration (i.e. a number of
milliseconds the VM is allowed to be down at the end of live migration)
$ salt src virt.migrate guest qemu+tls://dst/system max_downtime=100
Set a number of parallel network connections for live migration
$ salt src virt.migrate guest qemu+tls://dst/system parallel_connections=10
Live migration with enabled compression
$ salt src virt.migrate guest qemu+tls://dst/system \
compressed=True \
comp_methods=mt \
comp_mt_level=5 \
comp_mt_threads=4 \
comp_mt_dthreads=4
$ salt src virt.migrate guest qemu+tls://dst/system \
compressed=True \
comp_methods=xbzrle \
comp_xbzrle_cache=1024
Migrate non-shared storage
(Full disk copy)
$ salt src virt.migrate guest qemu+tls://dst/system copy_storage=all
(Incremental copy)
$ salt src virt.migrate guest qemu+tls://dst/system copy_storage=inc
Using post-copy migration
$ salt src virt.migrate guest qemu+tls://dst/system postcopy=True
$ salt src virt.migrate_start_postcopy guest
Using post-copy migration with bandwidth limit (MiB/s)
$ salt src virt.migrate guest qemu+tls://dst/system \
postcopy=True \
postcopy_bandwidth=1
$ salt src virt.migrate_start_postcopy guest
Acknowledgments
===============
I would like to sincerely thank all those who provided me with their
time, assistance, and guidance during the course of this project, for
which I am enormously grateful.
I would like to thank Cedric Bosdonnat (cbosdo), Pedro Algarvio
(s0undt3ch), Wayne Werner (waynew), Charles McMarrow (cmcmarrow) and
Daniel Wozniak (dwoz) who offered a huge amount of support, expertise,
guidance and code reviews.
I would also like to thank Michal Privoznik (mprivozn), Martin
Kletzander (mkletzan) and the rest of the libvirt and SaltStack
communities who have been extremely supportive.
Best wishes,
Radostin