[PATCH 6/6] spec: move driver-specific files to driver subpackages

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

 



The libvirt-daemon package contains several driver-specific files,
directories, and script, which can be problematic when building the
package with multiple hypervisor support, e.g. both QEMU and Xen.

E.g. installing a QEMU+Xen enabled libvirt-daemon on a Xen-only system
will result in the creation of qemu and kvm groups and a qemu user.

Move the driver-specific files, directories, and script to the
respective driver subpackages.
---
 libvirt.spec.in | 91 +++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 73 insertions(+), 18 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index bd5c883..32878f9 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1522,9 +1522,10 @@ then
 fi
 
 %if %{with_libvirtd}
-    %if %{with_qemu}
+    %if ! %{with_driver_modules}
+        %if %{with_qemu}
 %pre daemon
-        %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+            %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
 # We want soft static allocation of well-known ids, as disk images
 # are commonly shared across NFS mounts by id rather than name; see
 # https://fedoraproject.org/wiki/Packaging:UsersAndGroups
@@ -1538,6 +1539,7 @@ if ! getent passwd qemu >/dev/null; then
   fi
 fi
 exit 0
+            %endif
         %endif
     %endif
 
@@ -1671,6 +1673,27 @@ fi
 /sbin/chkconfig --del libvirtd >/dev/null 2>&1 || :
 /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
     %endif
+
+    %if %{with_driver_modules}
+        %if %{with_qemu}
+%pre daemon-driver-qemu
+            %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+# We want soft static allocation of well-known ids, as disk images
+# are commonly shared across NFS mounts by id rather than name; see
+# https://fedoraproject.org/wiki/Packaging:UsersAndGroups
+getent group kvm >/dev/null || groupadd -f -g 36 -r kvm
+getent group qemu >/dev/null || groupadd -f -g 107 -r qemu
+if ! getent passwd qemu >/dev/null; then
+  if ! getent passwd 107 >/dev/null; then
+    useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu
+  else
+    useradd -r -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu
+  fi
+fi
+exit 0
+            %endif
+        %endif
+    %endif
 %endif # %{with_libvirtd}
 
 %preun client
@@ -1813,7 +1836,8 @@ exit 0
 %{_mandir}/man8/libvirtd.8*
 %{_mandir}/man8/virtlockd.8*
 
-    %if %{with_network}
+    %if ! %{with_driver_modules}
+        %if %{with_network}
 %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
 %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/
 %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart
@@ -1822,11 +1846,11 @@ exit 0
 %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_storage_disk}
+        %endif
+        %if %{with_storage_disk}
 %attr(0755, root, root) %{_libexecdir}/libvirt_parthelper
-    %endif
-    %if %{with_qemu}
+        %endif
+        %if %{with_qemu}
 %config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
 %config(noreplace) %{_sysconfdir}/libvirt/qemu-lockd.conf
 %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
@@ -1838,8 +1862,8 @@ exit 0
 %dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
 %{_datadir}/augeas/lenses/libvirtd_qemu.aug
 %{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
-    %endif
-    %if %{with_lxc}
+        %endif
+        %if %{with_lxc}
 %config(noreplace) %{_sysconfdir}/libvirt/lxc.conf
 %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc
 %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
@@ -1848,21 +1872,22 @@ exit 0
 %{_datadir}/augeas/lenses/libvirtd_lxc.aug
 %{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
 %attr(0755, root, root) %{_libexecdir}/libvirt_lxc
-    %endif
-    %if %{with_uml}
+        %endif
+        %if %{with_uml}
 %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml
 %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_libxl}
+        %endif
+        %if %{with_libxl}
 %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
-    %if %{with_xen}
+        %endif
+        %if %{with_xen}
 %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/xen/
-    %endif
+        %endif
+    %endif # ! %{with_driver_modules}
 
     %if %{with_network}
 %files daemon-config-network
@@ -1907,36 +1932,66 @@ exit 0
         %if %{with_storage}
 %files daemon-driver-storage
 %defattr(-, root, root)
+            %if %{with_storage_disk}
+%attr(0755, root, root) %{_libexecdir}/libvirt_parthelper
+            %endif
 %{_libdir}/%{name}/connection-driver/libvirt_driver_storage.so
         %endif
 
         %if %{with_qemu}
 %files daemon-driver-qemu
 %defattr(-, root, root)
-%{_libdir}/%{name}/connection-driver/libvirt_driver_qemu.so
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
+%config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
+%config(noreplace) %{_sysconfdir}/libvirt/qemu-lockd.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.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}/lib/libvirt/qemu/channel/
+%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/channel/target/
+%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
+%{_datadir}/augeas/lenses/libvirtd_qemu.aug
+%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
+{_libdir}/%{name}/connection-driver/libvirt_driver_qemu.so
         %endif
 
         %if %{with_lxc}
 %files daemon-driver-lxc
 %defattr(-, root, root)
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
+%config(noreplace) %{_sysconfdir}/libvirt/lxc.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc
+%ghost %dir %{_localstatedir}/run/libvirt/lxc/
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/
+%{_datadir}/augeas/lenses/libvirtd_lxc.aug
+%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
+%attr(0755, root, root) %{_libexecdir}/libvirt_lxc
 %{_libdir}/%{name}/connection-driver/libvirt_driver_lxc.so
         %endif
 
         %if %{with_uml}
 %files daemon-driver-uml
 %defattr(-, root, root)
-%{_libdir}/%{name}/connection-driver/libvirt_driver_uml.so
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
+%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml
+%ghost %dir %{_localstatedir}/run/libvirt/uml/
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/
+{_libdir}/%{name}/connection-driver/libvirt_driver_uml.so
         %endif
 
         %if %{with_xen}
 %files daemon-driver-xen
 %defattr(-, root, root)
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/xen/
 %{_libdir}/%{name}/connection-driver/libvirt_driver_xen.so
         %endif
 
         %if %{with_libxl}
 %files daemon-driver-libxl
 %defattr(-, root, root)
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
+%ghost %dir %{_localstatedir}/run/libvirt/libxl/
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
 %{_libdir}/%{name}/connection-driver/libvirt_driver_libxl.so
         %endif
 
-- 
1.8.0.1

--
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]