[libvirt PATCH v2] meson: avoid bogus warnings from clang and g_autoptr
by Daniel P. Berrangé
Clang has previously had trouble with G_DEFINE_AUTOPTR_CLEANUP_FUNC
generated code, thinking it was unused. We turn off -Wunused-function
to avoid tripping up on that with CLang.
New Clang has started having trouble with g_autoptr now too. In usage
scenarios where the variable is set, but never again read, it thinks
it is unused not realizing the destructor has useful side effects.
For this we have to skip -Wunused-but-set-variable on CLang.
Reviewed-by: Pavel Hrdina <phrdina(a)redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
build-aux/syntax-check.mk | 2 +-
meson.build | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 2058af0b77..5c5a2a8771 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -1589,7 +1589,7 @@ exclude_file_name_regexp--sc_prohibit_canonicalize_file_name = \
^(build-aux/syntax-check\.mk|tests/virfilemock\.c)$$
exclude_file_name_regexp--sc_prohibit_raw_allocation = \
- ^(docs/advanced-tests\.rst|src/util/viralloc\.[ch]|examples/.*|tests/(securityselinuxhelper|(vircgroup|nss)mock|commandhelper)\.c|tools/wireshark/src/packet-libvirt\.c|tools/nss/libvirt_nss(_leases|_macs)?\.c)$$
+ ^(meson\.build|docs/advanced-tests\.rst|src/util/viralloc\.[ch]|examples/.*|tests/(securityselinuxhelper|(vircgroup|nss)mock|commandhelper)\.c|tools/wireshark/src/packet-libvirt\.c|tools/nss/libvirt_nss(_leases|_macs)?\.c)$$
exclude_file_name_regexp--sc_prohibit_readlink = \
^src/(util/virutil|lxc/lxc_container)\.c$$
diff --git a/meson.build b/meson.build
index 5af09d319a..ae2e672c1d 100644
--- a/meson.build
+++ b/meson.build
@@ -470,6 +470,27 @@ if get_option('warning_level') == '2'
supported_cc_flags += [ '-Wno-unused-function' ]
endif
+ if supported_cc_flags.contains('-Wunused-but-set-variable')
+ # Clang complains about unused variables in many scenarios related
+ # to attribute((cleanup)) aka g_auto*
+ w_unused_but_set_var_args = [ '-Wunused-but-set-variable', '-Werror' ]
+ w_unused_but_set_var_code = '''
+ static inline void free_pointer (void *p) {
+ void **pp = (void**)p;
+ free (*pp);
+ }
+
+ int main(void) {
+ __attribute__((cleanup(free_pointer))) char *buffer = 0x0;
+ buffer = 0x1;
+ }
+ '''
+ # We previously turned on unused-but-set-variable, so we must turn
+ # it off again explicitly now.
+ if not cc.compiles(w_unused_but_set_var_code, args: w_unused_but_set_var_args)
+ supported_cc_flags += [ '-Wno-unused-but-set-variable' ]
+ endif
+ endif
endif
add_project_arguments(supported_cc_flags, language: 'c')
--
2.31.1
3 years, 2 months
Release of libvirt-7.7.0
by Jiri Denemark
The 7.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.
* New features
* Add support for Fibre Channel VMID
New VM element ``<fibrechannel appid=''/>`` was added to allow users to set
their ``appid`` for each VM which will be used by kernel to create Fibre
Channel VMID. This allows various QoS levels, access control or collecting
telemetry data per VM.
* Improvements
* virsh: Allow XML validation for define of: storage pool, network, secret,
nwfilter, interface
* Add flag ``VIR_STORAGE_POOL_DEFINE_VALIDATE`` to validate storage pool
input xml. For virsh, users can use it as ``virsh pool-define --validate``.
* Add flag ``VIR_NETWORK_DEFINE_VALIDATE`` to validate network input xml. For
virsh, users can use it as ``net-define --validate``.
* Add flag ``VIR_SECRET_DEFINE_VALIDATE`` to validate secret input xml. For
virsh, users can use it as ``secret-define --validate``.
* Add flag ``VIR_NWFILTER_DEFINE_VALIDATE`` to validate nwfilter input xml.
For virsh, users can use it as ``nwfilter-define --validate``.
* Add flag ``VIR_INTERFACE_DEFINE_VALIDATE`` to validate interface input xml.
For virsh, users can use it as ``iface-define --validate``.
* Add SecurityManager APIs for labeling network devices
New ``virSecurityManagerSetNetdevLabel`` and ``virSecurityManagerSetNetdevLabel``
APIs are introduced and implemented in the Apparmor security driver.
The qemu driver uses the APIs to label vhostuser ports on hotplug and
restore labeling on unplug.
* vmx: Parse vm.genid and support super wide SCSI bus
The genid attribute is now reported for VMX guests. Libvirt can now
properly process super wide SCSI bus (64 units).
* qemu: Lifecycle action (``on_poweroff``/``on_reboot``) handling improvements
The handling of lifecycle actions was fixed and improved in multiple ways:
- ``restart-rename`` action was forbidden
The action was never properly implemented in the qemu driver and didn't
actually result in a restart of the VM but rather termination. The qemu
driver now rejects such configurations.
- ``preserve`` action was forbidden
Similarly to the previous case this never worked as the intended semantics
of the actions dictate. It's better to not allow it at all until there's a
proper implementation
- ``reboot`` action of ``on_poweroff`` now actually works
The guest OS is now rebooted instead of terminating the VM when the
``reboot`` action is used and the guest OS powers down. Note that it's
incompatible with ``on_reboot`` set to ``destroy``.
- Changes in action action of ``on_reboot`` are now updated with qemu
Libvirtd can now properly update the ``on_reboot`` action in qemu which
allows proper handling when changing between ``reboot`` and ``destroy``
actions. In addition, switching from ``reboot`` to ``destroy`` was
forbidden for older qemus which don't support the update API as the guest
could still reboot and execute some instructions until it was terminated.
* Bug fixes
* qemu: Open chardev logfile on behalf of QEMU
Guests with a logfile configured for their chardevs are now able to start
even when no virtlogd is configured.
* virhostmem: Handle numactl-less build in hugepages allocation/reporting
Some architectures don't have notion of NUMA (e.g. s390x) but do support
hugepages. Libvirt silently ignored requests to allocate/report hugepage
pool when built without numactl. This is now fixed and the pool can be
allocated/reported on properly.
* qemu: Record proper ``backing`` format for overlays of qcow2+luks images
Libvirt would record ``luks`` instead of ``qcow2`` into the metadata. In
practice this is a problem only when inspecting images manually via
``qemu-img`` as with libvirt users must use full specification of the
backing chain in the domain XML which supersedes information recorded in
the image metadata.
Enjoy.
Jirka
3 years, 2 months