[PATCH RFC 0/4] rely on QEMU provided macros for some QEMU feature selection

We currently have various features in the RPMs selected based on what the QEMU RPM has built. If the QEMU RPM changes, then libvirt needs to change to match which is an undesirable situation. Forthcoming upstream QEMU changes will involve corresponding Fedora downstream changes. eg removal of i386 host support for system emulators. I would like to make it so that we don't change libvirt RPM spec when these changes happen, merely rebuild libvirt and it "does the right thing". To that end I've proposed some QEMU macros for Fedora: https://src.fedoraproject.org/rpms/qemu/pull-request/43 with intention they would also go into future RHEL-10. This series illustrates what libvirt RPM spec changes would be to adapt to this. I'm not proposing to merge this libvirt series. Rather looking for whether I've missed anything in the design from te QEMU side that could be done better for libvirt. Daniel P. Berrangé (4): rpm: boilerplate to pull in qemu-srpm-macros rpm: use %{qemu_sysemu_host_arches} rpm: use %{qemu_sysemu_kvm_arches} rpm: use %{qemu_sysemu_tcg_non_native} libvirt.spec.in | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) -- 2.41.0

This package provides a few RPM macros that describe the capabilities of the QEMU build in the distro. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- libvirt.spec.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libvirt.spec.in b/libvirt.spec.in index 1f77cd90b7..73a8faae6e 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -6,6 +6,12 @@ %define min_rhel 8 %define min_fedora 33 +%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10 + %define with_qemu_macros 1 +%else + %define with_qemu_macros 0 +%endif + %define arches_qemu_kvm %{ix86} x86_64 %{power64} %{arm} aarch64 s390x %if 0%{?rhel} %if 0%{?rhel} > 8 @@ -267,6 +273,9 @@ Requires: libvirt-libs = %{version}-%{release} # All build-time requirements. Run-time requirements are # listed against each sub-RPM +%if %{with_qemu_macros} +BuildRequires: qemu-srpm-macros +%endif BuildRequires: python3-docutils BuildRequires: gcc BuildRequires: meson >= 0.56.0 -- 2.41.0

This macros reflects the architectures on which QEMU system emulators are built. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- libvirt.spec.in | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 73a8faae6e..641ff179e7 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -12,15 +12,24 @@ %define with_qemu_macros 0 %endif -%define arches_qemu_kvm %{ix86} x86_64 %{power64} %{arm} aarch64 s390x -%if 0%{?rhel} - %if 0%{?rhel} > 8 - %define arches_qemu_kvm x86_64 aarch64 s390x +%if ! %{with_qemu_macros} + %if 0%{?rhel} + %if 0%{?rhel} > 8 + %define qemu_sysemu_host_arches aarch64 s390x x86_64 + %else + %define qemu_sysemu_host_arches aarch64 s390x %{power64} x86_64 + %endif %else - %define arches_qemu_kvm x86_64 %{power64} aarch64 s390x + %define qemu_sysemu_host_arches aarch64 %{arm} %{ix86} %{mips} %{power64} riscv64 s390x x86_64 %endif %endif +%if 0%{?rhel} + %define arches_qemu_kvm %{qemu_sysemu_host_arches} +%else + %define arches_qemu_kvm %{ix86} x86_64 %{power64} %{arm} aarch64 s390x +%endif + %define arches_64bit x86_64 %{power64} aarch64 s390x riscv64 %define arches_x86 %{ix86} x86_64 @@ -37,7 +46,11 @@ %define arches_numad %{arches_x86} %{power64} aarch64 # The hypervisor drivers that run in libvirtd +%ifarch %{qemu_sysemu_host_arches} %define with_qemu 0%{!?_without_qemu:1} +%else +%define with_qemu 0 +%endif %define with_lxc 0%{!?_without_lxc:1} %define with_libxl 0%{!?_without_libxl:1} %define with_vbox 0%{!?_without_vbox:1} @@ -55,10 +68,6 @@ %define with_qemu_tcg 0 %endif -%if ! %{with_qemu_tcg} && ! %{with_qemu_kvm} - %define with_qemu 0 -%endif - # Then the hypervisor drivers that run outside libvirtd, in libvirt.so %define with_openvz 0%{!?_without_openvz:1} %define with_vmware 0%{!?_without_vmware:1} -- 2.41.0

This macro reflects the architectures on which KVM is available with the distro QEMU build. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- libvirt.spec.in | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 641ff179e7..e520def44b 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -19,17 +19,13 @@ %else %define qemu_sysemu_host_arches aarch64 s390x %{power64} x86_64 %endif + %define qemu_sysemu_kvm_arches %{qemu_sysemu_host_arches} %else %define qemu_sysemu_host_arches aarch64 %{arm} %{ix86} %{mips} %{power64} riscv64 s390x x86_64 + %define qemu_sysemu_kvm_arches aarch64 %{ix86} %{mips} %{power64} riscv64 s390x x86_64 %endif %endif -%if 0%{?rhel} - %define arches_qemu_kvm %{qemu_sysemu_host_arches} -%else - %define arches_qemu_kvm %{ix86} x86_64 %{power64} %{arm} aarch64 s390x -%endif - %define arches_64bit x86_64 %{power64} aarch64 s390x riscv64 %define arches_x86 %{ix86} x86_64 @@ -55,7 +51,7 @@ %define with_libxl 0%{!?_without_libxl:1} %define with_vbox 0%{!?_without_vbox:1} -%ifarch %{arches_qemu_kvm} +%ifarch %{qemu_sysemu_kvm_arches} %define with_qemu_kvm %{with_qemu} %else %define with_qemu_kvm 0 @@ -84,7 +80,7 @@ %if 0%{?rhel} > 8 %define with_storage_gluster 0 %else - %ifnarch %{arches_qemu_kvm} + %ifnarch %{qemu_sysemu_kvm_arches} %define with_storage_gluster 0 %endif %endif @@ -164,7 +160,7 @@ %define with_sanlock 0%{!?_without_sanlock:1} %endif %if 0%{?rhel} - %ifarch %{arches_qemu_kvm} + %ifarch %{qemu_sysemu_kvm_arches} %define with_sanlock 0%{!?_without_sanlock:1} %endif %endif -- 2.41.0

This macro reflects whether the QEMU build enables TCG for non-native architectures. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- libvirt.spec.in | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index e520def44b..e1692c7712 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -20,9 +20,11 @@ %define qemu_sysemu_host_arches aarch64 s390x %{power64} x86_64 %endif %define qemu_sysemu_kvm_arches %{qemu_sysemu_host_arches} + %define qemu_sysemu_tcg_non_native 0 %else %define qemu_sysemu_host_arches aarch64 %{arm} %{ix86} %{mips} %{power64} riscv64 s390x x86_64 %define qemu_sysemu_kvm_arches aarch64 %{ix86} %{mips} %{power64} riscv64 s390x x86_64 + %define qemu_sysemu_tcg_non_native 1 %endif %endif @@ -57,11 +59,10 @@ %define with_qemu_kvm 0 %endif -%define with_qemu_tcg %{with_qemu} - -# RHEL disables TCG on all architectures -%if 0%{?rhel} - %define with_qemu_tcg 0 +%if %{qemu_sysemu_tcg_non_native} + %define with_qemu_tcg %{with_qemu} +%else + %define with_qemu_tcg 0 %endif # Then the hypervisor drivers that run outside libvirtd, in libvirt.so -- 2.41.0
participants (1)
-
Daniel P. Berrangé