[PATCH 7/8] Enable driver modules in libvirt RPM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Turn on loadable modules for libvirtd. Add new sub-RPMs
libvirt-daemon-driver-XXX for each of the hypervisor
driver modules. Keep the secondary driver modules in the
main libvirt-daemon RPM, since there is no compelling
reason to install them individually. Adapt the existing
libvirt-daemon-XXXX RPMs to have deps on the appropriate
driver modules
---
 libvirt.spec.in |  224 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 171 insertions(+), 53 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index e7e0a55..d867b09 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -34,6 +34,8 @@
 %define server_drivers     1
 %endif
 
+# Always build with dlopen'd modules
+%define with_driver_modules 1
 
 # Now set the defaults for all the important features, independent
 # of any particular OS
@@ -252,6 +254,26 @@
 %endif
 %endif
 
+# The following 3 macros make later code simpler
+%if %{with_udev} || %{with_hal}
+%define with_nodedev 1
+%else
+%define with_nodedev 0
+%endif
+
+%if %{with_netcf}
+%define with_interface 1
+%else
+%define with_interface 0
+%endif
+
+%if %{with_storage_fs} || %{with_storage_mpath} || %{with_storage_iscsi} || %{with_storage_lvm} || %{with_storage_disk}
+%define with_storage 1
+%else
+%define with_storage 0
+%endif
+
+
 # Force QEMU to run as non-root
 %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
 %define qemu_user  qemu
@@ -288,8 +310,18 @@ Requires: libvirt-daemon-config-network = %{version}-%{release}
 %if %{with_nwfilter}
 Requires: libvirt-daemon-config-nwfilter = %{version}-%{release}
 %endif
-# XXX when we turn on driver modules, we need to add
-# deps on each driver (Requires: libvirt-daemon-drv-qemu)
+%if %{with_qemu}
+Requires: libvirt-daemon-driver-qemu = %{version}-%{release}
+%endif
+%if %{with_xen}
+Requires: libvirt-daemon-driver-xen = %{version}-%{release}
+%endif
+%if %{with_uml}
+Requires: libvirt-daemon-driver-uml = %{version}-%{release}
+%endif
+%if %{with_lxc}
+Requires: libvirt-daemon-driver-lxc = %{version}-%{release}
+%endif
 %endif
 Requires: libvirt-client = %{version}-%{release}
 
@@ -599,9 +631,53 @@ Requires: libvirt-daemon = %{version}-%{release}
 Network filter configuration files for cleaning guest traffic
 %endif
 
-# XXX when we turn on driver modules, we will need to
-# create daemon-drv-XXX sub-RPMs and add them as deps
-# to all of the following  daemon-XXX RPMs
+%if %{with_qemu}
+%package daemon-driver-qemu
+Summary: Qemu driver plugin for the libvirtd daemon
+Group: Development/Libraries
+Requires: libvirt-daemon = %{version}-%{release}
+
+%description daemon-driver-qemu
+The qemu driver plugin for the libvirtd daemon, providing
+an implementation of the hypervisor driver APIs using
+QEMU
+%endif
+
+%if %{with_lxc}
+%package daemon-driver-lxc
+Summary: LXC driver plugin for the libvirtd daemon
+Group: Development/Libraries
+Requires: libvirt-daemon = %{version}-%{release}
+
+%description daemon-driver-lxc
+The LXC driver plugin for the libvirtd daemon, providing
+an implementation of the hypervisor driver APIs using
+the Linux kernel
+%endif
+
+%if %{with_uml}
+%package daemon-driver-uml
+Summary: Uml driver plugin for the libvirtd daemon
+Group: Development/Libraries
+Requires: libvirt-daemon = %{version}-%{release}
+
+%description daemon-driver-uml
+The UML driver plugin for the libvirtd daemon, providing
+an implementation of the hypervisor driver APIs using
+User Mode Linux
+%endif
+
+%if %{with_xen} || %{with_libxl}
+%package daemon-driver-xen
+Summary: Xen driver plugin for the libvirtd daemon
+Group: Development/Libraries
+Requires: libvirt-daemon = %{version}-%{release}
+
+%description daemon-driver-xen
+The Xen driver plugin for the libvirtd daemon, providing
+an implementation of the hypervisor driver APIs using
+Xen
+%endif
 
 %if %{with_qemu_tcg}
 %package daemon-qemu
@@ -609,6 +685,7 @@ Summary: Server side daemon & driver required to run QEMU guests
 Group: Development/Libraries
 
 Requires: libvirt-daemon = %{version}-%{release}
+Requires: libvirt-daemon-driver-qemu = %{version}-%{release}
 Requires: qemu
 
 %description daemon-qemu
@@ -623,6 +700,7 @@ Summary: Server side daemon & driver required to run KVM guests
 Group: Development/Libraries
 
 Requires: libvirt-daemon = %{version}-%{release}
+Requires: libvirt-daemon-driver-qemu = %{version}-%{release}
 Requires: qemu-kvm
 
 %description daemon-kvm
@@ -637,6 +715,7 @@ Summary: Server side daemon & driver required to run LXC guests
 Group: Development/Libraries
 
 Requires: libvirt-daemon = %{version}-%{release}
+Requires: libvirt-daemon-driver-lxc = %{version}-%{release}
 
 %description daemon-lxc
 Server side daemon and driver required to manage the virtualization
@@ -650,6 +729,7 @@ Summary: Server side daemon & driver required to run UML guests
 Group: Development/Libraries
 
 Requires: libvirt-daemon = %{version}-%{release}
+Requires: libvirt-daemon-driver-uml = %{version}-%{release}
 # There are no UML kernel RPMs in Fedora/RHEL to depend on.
 
 %description daemon-uml
@@ -664,6 +744,7 @@ Summary: Server side daemon & driver required to run XEN guests
 Group: Development/Libraries
 
 Requires: libvirt-daemon = %{version}-%{release}
+Requires: libvirt-daemon-driver-xen = %{version}-%{release}
 Requires: xen
 
 %description daemon-xen
@@ -886,6 +967,10 @@ of recent versions of Linux (and other OSes).
 %define _without_dtrace --without-dtrace
 %endif
 
+%if ! %{with_driver_modules}
+%define _without_driver_modules --without-driver-modules
+%endif
+
 %define when  %(date +"%%F-%%T")
 %define where %(hostname)
 %define who   %{?packager}%{!?packager:Unknown}
@@ -940,6 +1025,7 @@ autoreconf -if
            %{?_without_macvtap} \
            %{?_without_audit} \
            %{?_without_dtrace} \
+           %{?_without_driver_modules} \
            %{with_packager} \
            %{with_packager_version} \
            --with-qemu-user=%{qemu_user} \
@@ -962,6 +1048,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.la
 rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.a
 rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.la
 rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.a
+%if %{with_driver_modules}
+rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/connection-driver/*.la
+rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/connection-driver/*.a
+%endif
 
 %if %{with_network}
 install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/lib/libvirt/dnsmasq/
@@ -1216,6 +1306,15 @@ fi
 
 %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/
 
+# Shared loadable driver modules
+%dir %{_libdir}/%{name}/connection-driver/
+%{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so
+%{_libdir}/%{name}/connection-driver/libvirt_driver_network.so
+%{_libdir}/%{name}/connection-driver/libvirt_driver_nodedev.so
+%{_libdir}/%{name}/connection-driver/libvirt_driver_nwfilter.so
+%{_libdir}/%{name}/connection-driver/libvirt_driver_secret.so
+%{_libdir}/%{name}/connection-driver/libvirt_driver_storage.so
+
 %{_sysconfdir}/rc.d/init.d/libvirtd
 %if %{with_systemd}
 %{_unitdir}/libvirtd.service
@@ -1228,25 +1327,8 @@ fi
 %else
 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
 %endif
-%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
-%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
-%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
-%if %{with_libxl}
-%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
-%endif
 
 %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd
-%if %{with_qemu}
-%config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
-%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
-%endif
-%if %{with_lxc}
-%config(noreplace) %{_sysconfdir}/libvirt/lxc.conf
-%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc
-%endif
-%if %{with_uml}
-%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml
-%endif
 
 %dir %{_datadir}/libvirt/
 
@@ -1262,39 +1344,12 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
 %dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/boot/
 %dir %attr(0711, root, root) %{_localstatedir}/cache/libvirt/
 
-%if %{with_qemu}
-%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
-%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
-%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
-%endif
-%if %{with_lxc}
-%ghost %dir %{_localstatedir}/run/libvirt/lxc/
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/
-%endif
-%if %{with_uml}
-%ghost %dir %{_localstatedir}/run/libvirt/uml/
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/
-%endif
-%if %{with_libxl}
-%ghost %dir %{_localstatedir}/run/libvirt/libxl/
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
-%endif
 %if %{with_network}
 %ghost %dir %{_localstatedir}/run/libvirt/network/
 %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/
 %dir %attr(0755, root, root) %{_localstatedir}/lib/libvirt/dnsmasq/
 %endif
 
-%if %{with_qemu}
-%{_datadir}/augeas/lenses/libvirtd_qemu.aug
-%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
-%endif
-
-%if %{with_lxc}
-%{_datadir}/augeas/lenses/libvirtd_lxc.aug
-%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
-%endif
-
 %{_datadir}/augeas/lenses/libvirtd.aug
 %{_datadir}/augeas/lenses/tests/test_libvirtd.aug
 
@@ -1308,10 +1363,6 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
 
 %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/
 
-%if %{with_lxc}
-%attr(0755, root, root) %{_libexecdir}/libvirt_lxc
-%endif
-
 %if %{with_storage_disk}
 %attr(0755, root, root) %{_libexecdir}/libvirt_parthelper
 %endif
@@ -1332,6 +1383,73 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
 %{_sysconfdir}/libvirt/nwfilter/*.xml
 %endif
 
+%if %{with_driver_modules}
+%if %{with_qemu}
+%files daemon-driver-qemu
+%defattr(-, root, root)
+%config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
+
+%{_libdir}/%{name}/connection-driver/libvirt_driver_qemu.so
+
+%{_datadir}/augeas/lenses/libvirtd_qemu.aug
+%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
+
+%if %{with_dtrace}
+%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp
+%endif
+
+%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
+%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
+%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
+%endif
+
+%if %{with_lxc}
+%files daemon-driver-lxc
+%defattr(-, root, root)
+%config(noreplace) %{_sysconfdir}/libvirt/lxc.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc
+
+%attr(0755, root, root) %{_libexecdir}/libvirt_lxc
+%{_libdir}/%{name}/connection-driver/libvirt_driver_lxc.so
+
+%{_datadir}/augeas/lenses/libvirtd_lxc.aug
+%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
+
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
+%ghost %dir %{_localstatedir}/run/libvirt/lxc/
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/
+%endif
+
+%if %{with_uml}
+%files daemon-driver-uml
+%defattr(-, root, root)
+%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml
+
+%{_libdir}/%{name}/connection-driver/libvirt_driver_uml.so
+
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
+%ghost %dir %{_localstatedir}/run/libvirt/uml/
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/
+%endif
+
+%if %{with_xen} || %{with_libxl}
+%files daemon-driver-xen
+%defattr(-, root, root)
+%if %{with_xen}
+%{_libdir}/%{name}/connection-driver/libvirt_driver_xen.so
+%endif
+%if %{with_libxl}
+%{_libdir}/%{name}/connection-driver/libvirt_driver_libxl.so
+
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
+%ghost %dir %{_localstatedir}/run/libvirt/libxl/
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
+%endif
+%endif
+%endif
+
 %if %{with_qemu_tcg}
 %files daemon-qemu
 %defattr(-, root, root)
-- 
1.7.7.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]