[libvirt] [PATCH 0/8] Refactor libvirt RPM to allow fine grained installed

This is an update of the patch DV reverted from GIT https://www.redhat.com/archives/libvir-list/2012-March/msg01332.html At the end of this series we have the following RPMs with files The daemon itself (if %with_libvirtd == 1 - ie skipped for %client_only builds) - libvirt-daemon - just libvirtd daemon & secondary drivers (storage, network, nwfilter, etc) Two optional config file packages (if %with_libvirtd == 1): - libvirt-daemon-config-network - just the network driver default config - libvirt-daemon-config-nwfilter - just the nwfilter default config Four hypervisor driver packages (%with_driver_modules == 1, now on by default) - libvirt-daemon-driver-qemu - libvirt_driver_qemu.so + related driver files - libvirt-daemon-driver-lxc - libvirt_driver_lxc.so + related driver files - libvirt-daemon-driver-uml - libvirt_driver_uml.so + related driver files - libvirt-daemon-driver-xen - libvirt_driver_{xen,libxl}.so + related driver files Other non-daemon packages always enabled - libvirt-client - libvirt.so + virsh - libvirt-devel - libvirt header files & libraries - libvirt-python - libvirt python module - libvirt-docs - API docs and website docs Finally there are a handful of virtual empty packages To preserve the existing upgrade path & avoid breaking existing app dependancies: - libvirt - Depends libvirt-daemon, libvirt-client, libvirt-daemon-config-* and libvirt-daemon-driver-*. To allow applications to depend on specific libvirt drivers: - libvirt-daemon-qemu - Depends on libvirt-daemon, libvirt-daemon-driver-qemu & qemu - libvirt-daemon-kvm - Depends on libvirt-daemon, libvirt-daemon-driver-qemu & qemu-kvm - libvirt-daemon-lxc - Depends on libvirt-daemon, libvirt-daemon-driver-lxc - libvirt-daemon-uml - Depends on libvirt-daemon, libvirt-daemon-driver-uml - libvirt-daemon-xen - Depends on libvirt-daemon, libvirt-daemon-driver-xen & xen The result is: - To install everything (daemon, all drivers, all configs) yum install libvirt - To install just KVM with no configs yum install libvirt-daemon-kvm - To install KVM + default configs yum install libvirt-daemon-kvm libvirt-daemon-config-network libvirt-daemon-config-nwfilter The problems solved are - Can install libvirtd without the default configs which many apps don't want and causing death to networking if installed inside a guest - Applications don't need to know about the underlying hypervisor package names - libvirt pulls in the correct packages - Applications can install KVM without pulling in Xen libraries

From: "Daniel P. Berrange" <berrange@redhat.com> Currently documentation is split between the libvirt RPM and the libvirt-devel RPM. In the client-only build there is no libvirt RPM, so the docs need to live elsewhere. The obvious answer is a dedicated libvirt-docs RPM. For back-compatibility make the libvirt-devel RPM require the libvirt-docs RPM * libvirt.spec.in: Create separate libvirt-docs RPM --- libvirt.spec.in | 34 +++++++++++++++++++++++++++------- 1 files changed, 27 insertions(+), 7 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 74f8f9a..8fcb90b 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -537,6 +537,14 @@ Libvirt is a C toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes). The main package includes the libvirtd server exporting the virtualization support. +%package docs +Summary: API reference and website documentation +Group: Development/Libraries + +%description docs +Includes the API reference for the libvirt C library, and a complete +copy of the libvirt.org website documentation. + %package client Summary: Client side library and utilities of the libvirt library Group: Development/Libraries @@ -566,14 +574,14 @@ virtualization capabilities of recent versions of Linux (and other OSes). Summary: Libraries, includes, etc. to compile with the libvirt library Group: Development/Libraries Requires: %{name}-client = %{version}-%{release} +Requires: %{name}-docs = %{version}-%{release} Requires: pkgconfig %if %{with_xen} Requires: xen-devel %endif %description devel -Includes and documentations for the C library providing an API to use -the virtualization capabilities of recent versions of Linux (and other OSes). +Include header files & development libraries for the libvirt C library. %if %{with_sanlock} %package lock-sanlock @@ -874,6 +882,9 @@ rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.lxc rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.uml %endif +mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-%{version} \ + $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-docs-%{version} + %clean rm -fr %{buildroot} @@ -1178,6 +1189,20 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %doc docs/*.xml %endif +%files docs +%defattr(-, root, root) +# Website +%dir %{_datadir}/doc/libvirt-docs-%{version} +%dir %{_datadir}/doc/libvirt-docs-%{version}/html +%{_datadir}/doc/libvirt-docs-%{version}/html/* + +# API docs +%dir %{_datadir}/gtk-doc/html/libvirt/ +%doc %{_datadir}/gtk-doc/html/libvirt/*.devhelp +%doc %{_datadir}/gtk-doc/html/libvirt/*.html +%doc %{_datadir}/gtk-doc/html/libvirt/*.png +%doc %{_datadir}/gtk-doc/html/libvirt/*.css + %if %{with_sanlock} %files lock-sanlock %defattr(-, root, root) @@ -1250,11 +1275,6 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %dir %{_includedir}/libvirt %{_includedir}/libvirt/*.h %{_libdir}/pkgconfig/libvirt.pc -%dir %{_datadir}/gtk-doc/html/libvirt/ -%doc %{_datadir}/gtk-doc/html/libvirt/*.devhelp -%doc %{_datadir}/gtk-doc/html/libvirt/*.html -%doc %{_datadir}/gtk-doc/html/libvirt/*.png -%doc %{_datadir}/gtk-doc/html/libvirt/*.css %dir %{_datadir}/libvirt/api/ %{_datadir}/libvirt/api/libvirt-api.xml -- 1.7.7.6

On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Currently documentation is split between the libvirt RPM and the libvirt-devel RPM. In the client-only build there is no libvirt RPM, so the docs need to live elsewhere. The obvious answer is a dedicated libvirt-docs RPM. For back-compatibility make the libvirt-devel RPM require the libvirt-docs RPM
* libvirt.spec.in: Create separate libvirt-docs RPM --- libvirt.spec.in | 34 +++++++++++++++++++++++++++------- 1 files changed, 27 insertions(+), 7 deletions(-)
Sounds reasonable as justification for the new package. ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> The API XML files are now formally installed as part of the libvirt-devel RPM. Thus there is no need to include them as %doc in the main libvirt RPM --- libvirt.spec.in | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 8fcb90b..05bda8f 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1185,8 +1185,6 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %attr(0755, root, root) %{_sbindir}/libvirtd %{_mandir}/man8/libvirtd.8* - -%doc docs/*.xml %endif %files docs -- 1.7.7.6

On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The API XML files are now formally installed as part of the libvirt-devel RPM.
indirectly, since libvirt-devel pulls in libvirt-docs
Thus there is no need to include them as %doc in the main libvirt RPM --- libvirt.spec.in | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index 8fcb90b..05bda8f 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1185,8 +1185,6 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %attr(0755, root, root) %{_sbindir}/libvirtd
%{_mandir}/man8/libvirtd.8* - -%doc docs/*.xml %endif
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, Apr 03, 2012 at 09:01:40PM -0600, Eric Blake wrote:
On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The API XML files are now formally installed as part of the libvirt-devel RPM.
indirectly, since libvirt-devel pulls in libvirt-docs
No, no. Directly - I'm referring to /usr/share/libvirt/api/*.xml which is separate from the HTML API docs, and is directly in libvirt-devel.
Thus there is no need to include them as %doc in the main libvirt RPM --- libvirt.spec.in | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index 8fcb90b..05bda8f 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1185,8 +1185,6 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %attr(0755, root, root) %{_sbindir}/libvirtd
%{_mandir}/man8/libvirtd.8* - -%doc docs/*.xml %endif
ACK.
Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

From: "Daniel P. Berrange" <berrange@redhat.com> Take the libvirt RPM and split it into three pieces - libvirt-daemon - libvirtd & other mandatory bits for its operation - libvirt-daemon-config-network - the virbr0 config definition - libvirt-daemon-config-nwfilter - the firewall config rules For backwards compatibility with existing installs / application RPM deps, the 'libvirt' RPM is retained, but will have a dependancy on the 3 new RPMs. --- libvirt.spec.in | 313 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 182 insertions(+), 131 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 05bda8f..66e2c0b 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -268,109 +268,21 @@ Source: http://libvirt.org/sources/libvirt-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root URL: http://libvirt.org/ -# All runtime requirements for the libvirt package (runtime requrements -# for subpackages are listed later in those subpackages) - -# The client side, i.e. shared libs and virsh are in a subpackage -Requires: %{name}-client = %{version}-%{release} - -# Used by many of the drivers, so turn it on whenever the -# daemon is present %if %{with_libvirtd} -# for modprobe of pci devices -Requires: module-init-tools -# for /sbin/ip & /sbin/tc -Requires: iproute -%if %{with_avahi} -Requires: avahi-libs -%endif -%endif +Requires: libvirt-daemon = %{version}-%{release} %if %{with_network} -Requires: dnsmasq >= 2.41 -Requires: radvd -%endif -%if %{with_network} || %{with_nwfilter} -Requires: iptables -Requires: iptables-ipv6 +Requires: libvirt-daemon-config-network = %{version}-%{release} %endif %if %{with_nwfilter} -Requires: ebtables -%endif -# needed for device enumeration -%if %{with_hal} -Requires: hal -%endif -%if %{with_udev} -Requires: udev >= 145 -%endif -%if %{with_polkit} -%if 0%{?fedora} >= 12 || 0%{?rhel} >=6 -Requires: polkit >= 0.93 -%else -Requires: PolicyKit >= 0.6 -%endif -%endif -%if %{with_storage_fs} -Requires: nfs-utils -# For mkfs -Requires: util-linux-ng -# For pool-build probing for existing pools -BuildRequires: libblkid-devel >= 2.17 -# For glusterfs -%if 0%{?fedora} >= 11 -Requires: glusterfs-client >= 2.0.1 -%endif -%endif -%if %{with_qemu} -# From QEMU RPMs -Requires: /usr/bin/qemu-img -# For image compression -Requires: gzip -Requires: bzip2 -Requires: lzop -Requires: xz -%else -%if %{with_xen} -# From Xen RPMs -Requires: /usr/sbin/qcow-create -%endif -%endif -%if %{with_storage_lvm} -# For LVM drivers -Requires: lvm2 -%endif -%if %{with_storage_iscsi} -# For ISCSI driver -Requires: iscsi-initiator-utils -%endif -%if %{with_storage_disk} -# For disk driver -Requires: parted -Requires: device-mapper -%endif -%if %{with_storage_mpath} -# For multipath support -Requires: device-mapper -%endif -%if %{with_cgconfig} -Requires: libcgroup -%endif -%ifarch %{ix86} x86_64 ia64 -# For virConnectGetSysinfo -Requires: dmidecode +Requires: libvirt-daemon-config-nwfilter = %{version}-%{release} %endif -# For service management -%if %{with_systemd} -Requires(post): systemd-units -Requires(post): systemd-sysv -Requires(preun): systemd-units -Requires(postun): systemd-units -%endif -%if %{with_numad} -Requires: numad +# XXX when we turn on driver modules, we need to add +# deps on each driver (Requires: libvirt-daemon-drv-qemu) %endif +Requires: libvirt-client = %{version}-%{release} -# All build-time requirements +# All build-time requirements. Run-time requirements are +# listed against each sub-RPM %if 0%{?enable_autotools} BuildRequires: autoconf BuildRequires: automake @@ -545,6 +457,137 @@ Group: Development/Libraries Includes the API reference for the libvirt C library, and a complete copy of the libvirt.org website documentation. +%if %{with_libvirtd} +%package daemon +Summary: Server side daemon and supporting files for libvirt library +Group: Development/Libraries + +# All runtime requirements for the libvirt package (runtime requrements +# for subpackages are listed later in those subpackages) + +# The client side, i.e. shared libs and virsh are in a subpackage +Requires: %{name}-client = %{version}-%{release} + +# for modprobe of pci devices +Requires: module-init-tools +# for /sbin/ip & /sbin/tc +Requires: iproute +%if %{with_avahi} +Requires: avahi-libs +%endif +%if %{with_network} +Requires: dnsmasq >= 2.41 +Requires: radvd +%endif +%if %{with_network} || %{with_nwfilter} +Requires: iptables +Requires: iptables-ipv6 +%endif +%if %{with_nwfilter} +Requires: ebtables +%endif +# needed for device enumeration +%if %{with_hal} +Requires: hal +%endif +%if %{with_udev} +Requires: udev >= 145 +%endif +%if %{with_polkit} +%if 0%{?fedora} >= 12 || 0%{?rhel} >=6 +Requires: polkit >= 0.93 +%else +Requires: PolicyKit >= 0.6 +%endif +%endif +%if %{with_storage_fs} +Requires: nfs-utils +# For mkfs +Requires: util-linux-ng +# For pool-build probing for existing pools +BuildRequires: libblkid-devel >= 2.17 +# For glusterfs +%if 0%{?fedora} >= 11 +Requires: glusterfs-client >= 2.0.1 +%endif +%endif +%if %{with_qemu} +# From QEMU RPMs +Requires: /usr/bin/qemu-img +# For image compression +Requires: gzip +Requires: bzip2 +Requires: lzop +Requires: xz +%else +%if %{with_xen} +# From Xen RPMs +Requires: /usr/sbin/qcow-create +%endif +%endif +%if %{with_storage_lvm} +# For LVM drivers +Requires: lvm2 +%endif +%if %{with_storage_iscsi} +# For ISCSI driver +Requires: iscsi-initiator-utils +%endif +%if %{with_storage_disk} +# For disk driver +Requires: parted +Requires: device-mapper +%endif +%if %{with_storage_mpath} +# For multipath support +Requires: device-mapper +%endif +%if %{with_cgconfig} +Requires: libcgroup +%endif +%ifarch %{ix86} x86_64 ia64 +# For virConnectGetSysinfo +Requires: dmidecode +%endif +# For service management +%if %{with_systemd} +Requires(post): systemd-units +Requires(post): systemd-sysv +Requires(preun): systemd-units +Requires(postun): systemd-units +%endif +%if %{with_numad} +Requires: numad +%endif + +%description daemon +Server side daemon required to manage the virtualization capabilities +of recent versions of Linux. Requires a hypervisor specific sub-RPM +for specific drivers. + +%if %{with_network} +%package daemon-config-network +Summary: Default configuration files for the libvirtd daemon +Group: Development/Libraries + +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-config-network +Default configuration files for setting up NAT based networking +%endif + +%if %{with_nwfilter} +%package daemon-config-nwfilter +Summary: Network filter configuration files for the libvirtd daemon +Group: Development/Libraries + +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-config-nwfilter +Network filter configuration files for cleaning guest traffic +%endif +%endif + %package client Summary: Client side library and utilities of the libvirt library Group: Development/Libraries @@ -899,7 +942,8 @@ do done make check -%pre +%if %{with_libvirtd} +%pre daemon %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6 # Normally 'setup' adds this in /etc/passwd, but this is # here for case of upgrades from earlier Fedora/RHEL. This @@ -911,22 +955,9 @@ getent passwd qemu >/dev/null || \ -c "qemu user" qemu %endif -%post +%post daemon -%if %{with_libvirtd} %if %{with_network} -# We want to install the default network for initial RPM installs -# or on the first upgrade from a non-network aware libvirt only. -# We check this by looking to see if the daemon is already installed -if ! /sbin/chkconfig libvirtd && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml -then - UUID=`/usr/bin/uuidgen` - sed -e "s,</name>,</name>\n <uuid>$UUID</uuid>," \ - < %{_datadir}/libvirt/networks/default.xml \ - > %{_sysconfdir}/libvirt/qemu/networks/default.xml - ln -s ../default.xml %{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml -fi - # All newly defined networks will have a mac address for the bridge # auto-generated, but networks already existing at the time of upgrade # will not. We need to go through all the network configs, look for @@ -990,10 +1021,8 @@ if [ "$1" -ge "1" ]; then /sbin/service libvirtd condrestart > /dev/null 2>&1 fi %endif -%endif -%preun -%if %{with_libvirtd} +%preun daemon %if %{with_systemd} if [ $1 -eq 0 ] ; then # Package removal, not upgrade @@ -1006,10 +1035,8 @@ if [ $1 = 0 ]; then /sbin/chkconfig --del libvirtd fi %endif -%endif -%postun -%if %{with_libvirtd} +%postun daemon %if %{with_systemd} /bin/systemctl daemon-reload >/dev/null 2>&1 || : if [ $1 -ge 1 ] ; then @@ -1017,6 +1044,17 @@ if [ $1 -ge 1 ] ; then /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || : fi %endif + +%if %{with_network} +%post daemon-config-network +if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ; then + UUID=`/usr/bin/uuidgen` + sed -e "s,</name>,</name>\n <uuid>$UUID</uuid>," \ + < %{_datadir}/libvirt/networks/default.xml \ + > %{_sysconfdir}/libvirt/qemu/networks/default.xml + ln -s ../default.xml %{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml +fi +%endif %endif %if %{with_libvirtd} @@ -1065,10 +1103,27 @@ fi /bin/systemctl try-restart libvirt-guests.service >/dev/null 2>&1 || : %endif -%if %{with_libvirtd} %files %defattr(-, root, root) +%files docs +%defattr(-, root, root) +# Website +%dir %{_datadir}/doc/libvirt-docs-%{version} +%dir %{_datadir}/doc/libvirt-docs-%{version}/html +%{_datadir}/doc/libvirt-docs-%{version}/html/* + +# API docs +%dir %{_datadir}/gtk-doc/html/libvirt/ +%doc %{_datadir}/gtk-doc/html/libvirt/*.devhelp +%doc %{_datadir}/gtk-doc/html/libvirt/*.html +%doc %{_datadir}/gtk-doc/html/libvirt/*.png +%doc %{_datadir}/gtk-doc/html/libvirt/*.css + +%if %{with_libvirtd} +%files daemon +%defattr(-, root, root) + %doc AUTHORS ChangeLog.gz NEWS README COPYING.LIB TODO %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/ @@ -1079,7 +1134,6 @@ fi %endif %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/ -%{_sysconfdir}/libvirt/nwfilter/*.xml %{_sysconfdir}/rc.d/init.d/libvirtd %if %{with_systemd} @@ -1185,21 +1239,18 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %attr(0755, root, root) %{_sbindir}/libvirtd %{_mandir}/man8/libvirtd.8* -%endif -%files docs +%if %{with_network} +%files daemon-config-network %defattr(-, root, root) -# Website -%dir %{_datadir}/doc/libvirt-docs-%{version} -%dir %{_datadir}/doc/libvirt-docs-%{version}/html -%{_datadir}/doc/libvirt-docs-%{version}/html/* +%endif -# API docs -%dir %{_datadir}/gtk-doc/html/libvirt/ -%doc %{_datadir}/gtk-doc/html/libvirt/*.devhelp -%doc %{_datadir}/gtk-doc/html/libvirt/*.html -%doc %{_datadir}/gtk-doc/html/libvirt/*.png -%doc %{_datadir}/gtk-doc/html/libvirt/*.css +%if %{with_nwfilter} +%files daemon-config-nwfilter +%defattr(-, root, root) +%{_sysconfdir}/libvirt/nwfilter/*.xml +%endif +%endif %if %{with_sanlock} %files lock-sanlock -- 1.7.7.6

On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Take the libvirt RPM and split it into three pieces
- libvirt-daemon - libvirtd & other mandatory bits for its operation - libvirt-daemon-config-network - the virbr0 config definition - libvirt-daemon-config-nwfilter - the firewall config rules
For backwards compatibility with existing installs / application RPM deps, the 'libvirt' RPM is retained, but will have a dependancy on
s/dependancy/dependency/
the 3 new RPMs. --- libvirt.spec.in | 313 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 182 insertions(+), 131 deletions(-)
Large, but looks sane. In particular, you shuffled the %files docs section up, which made the last part a bit harder to read; perhaps you could have redone patch 1/8 to stick %files docs in that area to begin with, but it's not worth a rebase now. ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> Introduce a set sub-RPMs, one per hypervisor, which can be used as dependancy targets by applications wishing to pull in the full stack of packages required for a specific hypervisor. This avoids the application needing to know what the hypervisor specific package set is. ie, applications should not need to know that using the libvirt Xen hypervisor requires the 'xen' RPM - libvirt should take care of that knowledge. All the application wants is 'libvirt-daemon-xen' There are 5 sub-RPMs: libvirt-daemon-qemu - non-native TCG based emulators libvirt-daemon-kvm - native KVM hypervisor libvirt-daemon-uml - User Mode linux libvirt-daemon-xen - Xen, either via XenD or libxl libvirt-daemon-lxc - Linux native containers When driver modules get turned on, these sub-RPMs will also gain dependancies on the appropriate driver module .so files --- libvirt.spec.in | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 110 insertions(+), 1 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 66e2c0b..0d221ab 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -52,6 +52,14 @@ %define with_libxl 0%{!?_without_libxl:%{server_drivers}} %define with_vmware 0%{!?_without_vmware:%{server_drivers}} +%define with_qemu_tcg %{with_qemu} +# Change if we ever provide qemu-kvm binaries on non-x86 hosts +%ifarch %{ix86} x86_64 +%define with_qemu_kvm %{with_qemu} +%else +%define with_qemu_kvm 0 +%endif + # Then the hypervisor drivers that talk via a native remote protocol %define with_phyp 0%{!?_without_phyp:1} %define with_esx 0%{!?_without_esx:1} @@ -125,8 +133,10 @@ # RHEL-5 has restricted QEMU to x86_64 only and is too old for LXC %if 0%{?rhel} == 5 +%define with_qemu_tcg 0 %ifnarch x86_64 %define with_qemu 0 +%define with_qemu_kvm 0 %endif %define with_lxc 0 %endif @@ -134,8 +144,10 @@ # RHEL-6 has restricted QEMU to x86_64 only, stopped including Xen # on all archs. Other archs all have LXC available though %if 0%{?rhel} >= 6 +%define with_qemu_tcg 0 %ifnarch x86_64 %define with_qemu 0 +%define with_qemu_kvm 0 %endif %define with_xen 0 %endif @@ -206,7 +218,7 @@ %define with_storage_disk 0 %endif -%if %{with_qemu} +%if %{with_qemu} || %{with_lxc} || %{with_uml} %define with_nwfilter 0%{!?_without_nwfilter:%{server_drivers}} # Enable libpcap library %define with_libpcap 0%{!?_without_libpcap:%{server_drivers}} @@ -586,6 +598,78 @@ Requires: libvirt-daemon = %{version}-%{release} %description daemon-config-nwfilter 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_tcg} +%package daemon-qemu +Summary: Server side daemon & driver required to run QEMU guests +Group: Development/Libraries + +Requires: libvirt-daemon = %{version}-%{release} +Requires: qemu + +%description daemon-qemu +Server side daemon and driver required to manage the virtualization +capabilities of the QEMU TCG emulators +%endif + + +%if %{with_qemu_kvm} +%package daemon-kvm +Summary: Server side daemon & driver required to run KVM guests +Group: Development/Libraries + +Requires: libvirt-daemon = %{version}-%{release} +Requires: qemu-kvm + +%description daemon-kvm +Server side daemon and driver required to manage the virtualization +capabilities of the KVM hypervisor +%endif + + +%if %{with_lxc} +%package daemon-lxc +Summary: Server side daemon & driver required to run LXC guests +Group: Development/Libraries + +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-lxc +Server side daemon and driver required to manage the virtualization +capabilities of LXC +%endif + + +%if %{with_uml} +%package daemon-uml +Summary: Server side daemon & driver required to run UML guests +Group: Development/Libraries + +Requires: libvirt-daemon = %{version}-%{release} +# There are no UML kernel RPMs in Fedora/RHEL to depend on. + +%description daemon-uml +Server side daemon and driver required to manage the virtualization +capabilities of UML +%endif + + +%if %{with_xen} || %{with_libxl} +%package daemon-xen +Summary: Server side daemon & driver required to run XEN guests +Group: Development/Libraries + +Requires: libvirt-daemon = %{version}-%{release} +Requires: xen + +%description daemon-xen +Server side daemon and driver required to manage the virtualization +capabilities of XEN +%endif %endif %package client @@ -1250,6 +1334,31 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %defattr(-, root, root) %{_sysconfdir}/libvirt/nwfilter/*.xml %endif + +%if %{with_qemu_tcg} +%files daemon-qemu +%defattr(-, root, root) +%endif + +%if %{with_qemu_kvm} +%files daemon-kvm +%defattr(-, root, root) +%endif + +%if %{with_lxc} +%files daemon-lxc +%defattr(-, root, root) +%endif + +%if %{with_uml} +%files daemon-uml +%defattr(-, root, root) +%endif + +%if %{with_xen} || %{with_libxl} +%files daemon-xen +%defattr(-, root, root) +%endif %endif %if %{with_sanlock} -- 1.7.7.6

On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Introduce a set sub-RPMs, one per hypervisor, which can be used as dependancy targets by applications wishing to pull in the
s/dependancy/dependency/
full stack of packages required for a specific hypervisor. This avoids the application needing to know what the hypervisor specific package set is.
ie, applications should not need to know that using the libvirt Xen hypervisor requires the 'xen' RPM - libvirt should take care of that knowledge. All the application wants is 'libvirt-daemon-xen'
As I mentioned on the other thread, I'm in favor of this, but it sounded like DV was a bit worried. Anyone else want to chime in?
There are 5 sub-RPMs:
libvirt-daemon-qemu - non-native TCG based emulators libvirt-daemon-kvm - native KVM hypervisor libvirt-daemon-uml - User Mode linux libvirt-daemon-xen - Xen, either via XenD or libxl libvirt-daemon-lxc - Linux native containers
When driver modules get turned on, these sub-RPMs will also gain dependancies on the appropriate driver module .so files
s/dependancies/dependencies/ ACK for the technical aspect, if you don't get outvoted on the design. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> The public libvirt API does not have any application visible dependancy on Xen libraries. The xen-devel dependancy is thus bogus --- libvirt.spec.in | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 0d221ab..9c662af 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -703,9 +703,6 @@ Group: Development/Libraries Requires: %{name}-client = %{version}-%{release} Requires: %{name}-docs = %{version}-%{release} Requires: pkgconfig -%if %{with_xen} -Requires: xen-devel -%endif %description devel Include header files & development libraries for the libvirt C library. -- 1.7.7.6

On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The public libvirt API does not have any application visible dependancy on Xen libraries. The xen-devel dependancy is thus
s/dependancy/dependency/g
bogus --- libvirt.spec.in | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index 0d221ab..9c662af 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -703,9 +703,6 @@ Group: Development/Libraries Requires: %{name}-client = %{version}-%{release} Requires: %{name}-docs = %{version}-%{release} Requires: pkgconfig -%if %{with_xen} -Requires: xen-devel -%endif
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> The openvz, virtualbox and vmware drivers do not run inside libvirtd, therefore they should be grouped with the other client side drivers --- libvirt.spec.in | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 9c662af..e7e0a55 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -42,15 +42,12 @@ %define with_libvirtd 0%{!?_without_libvirtd:%{server_drivers}} %define with_avahi 0%{!?_without_avahi:%{server_drivers}} -# Then the hypervisor drivers that run on local host +# Then the hypervisor drivers that run in libvirtd %define with_xen 0%{!?_without_xen:%{server_drivers}} %define with_qemu 0%{!?_without_qemu:%{server_drivers}} -%define with_openvz 0%{!?_without_openvz:%{server_drivers}} %define with_lxc 0%{!?_without_lxc:%{server_drivers}} -%define with_vbox 0%{!?_without_vbox:%{server_drivers}} %define with_uml 0%{!?_without_uml:%{server_drivers}} %define with_libxl 0%{!?_without_libxl:%{server_drivers}} -%define with_vmware 0%{!?_without_vmware:%{server_drivers}} %define with_qemu_tcg %{with_qemu} # Change if we ever provide qemu-kvm binaries on non-x86 hosts @@ -60,13 +57,16 @@ %define with_qemu_kvm 0 %endif -# Then the hypervisor drivers that talk via a native remote protocol +# Then the hypervisor drivers that run outside libvirtd, in libvirt.so +%define with_openvz 0%{!?_without_openvz:1} +%define with_vbox 0%{!?_without_vbox:1} +%define with_vmware 0%{!?_without_vmware:1} %define with_phyp 0%{!?_without_phyp:1} %define with_esx 0%{!?_without_esx:1} %define with_hyperv 0%{!?_without_hyperv:1} %define with_xenapi 0%{!?_without_xenapi:1} -# Then the secondary host drivers +# Then the secondary host drivers, which run inside libvirtd %define with_network 0%{!?_without_network:%{server_drivers}} %define with_storage_fs 0%{!?_without_storage_fs:%{server_drivers}} %define with_storage_lvm 0%{!?_without_storage_lvm:%{server_drivers}} -- 1.7.7.6

On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The openvz, virtualbox and vmware drivers do not run inside libvirtd, therefore they should be grouped with the other client side drivers --- libvirt.spec.in | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> 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

On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
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(-)
Obviously, this can't be applied unless we also review your 0/10 series for turning on modules. But assuming that gets a positive review, ACK that this looks correct (I didn't actually test it tonight, though) -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> It is not safe to restart libvirtd after install of the libvirt-daemon RPM, since the corresponding driver modules may not yet have been installed by RPM. The solution is to move the restart logic to a %posttrans script. This runs at completion of the RPM transaction, once everything is uninstalled. --- libvirt.spec.in | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index d867b09..73e1ec3 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1188,9 +1188,6 @@ fi %endif /sbin/chkconfig --add libvirtd -if [ "$1" -ge "1" ]; then - /sbin/service libvirtd condrestart > /dev/null 2>&1 -fi %endif %preun daemon @@ -1207,13 +1204,21 @@ if [ $1 = 0 ]; then fi %endif -%postun daemon %if %{with_systemd} +%postun daemon /bin/systemctl daemon-reload >/dev/null 2>&1 || : +%endif + +%posttrans daemon +%if %{with_systemd} if [ $1 -ge 1 ] ; then # Package upgrade, not uninstall /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || : fi +%else +if [ "$1" -ge "1" ]; then + /sbin/service libvirtd condrestart > /dev/null 2>&1 +fi %endif %if %{with_network} -- 1.7.7.6

On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
It is not safe to restart libvirtd after install of the libvirt-daemon RPM, since the corresponding driver modules may not yet have been installed by RPM. The solution is to move the restart logic to a %posttrans script. This runs at completion of the RPM transaction, once everything is uninstalled. --- libvirt.spec.in | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
I haven't used %posttrans before, but it looks simple enough. What I'm not sure of...
diff --git a/libvirt.spec.in b/libvirt.spec.in index d867b09..73e1ec3 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1188,9 +1188,6 @@ fi %endif
/sbin/chkconfig --add libvirtd -if [ "$1" -ge "1" ]; then - /sbin/service libvirtd condrestart > /dev/null 2>&1 -fi %endif
%preun daemon @@ -1207,13 +1204,21 @@ if [ $1 = 0 ]; then fi %endif
-%postun daemon %if %{with_systemd} +%postun daemon /bin/systemctl daemon-reload >/dev/null 2>&1 || : +%endif
is why daemon-reload can be done right away,
+ +%posttrans daemon +%if %{with_systemd} if [ $1 -ge 1 ] ; then # Package upgrade, not uninstall /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
but a full restart has to wait for %posttrans. I was naively assuming they should both be %posttrans. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, Apr 03, 2012 at 10:06:05PM -0600, Eric Blake wrote:
On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
It is not safe to restart libvirtd after install of the libvirt-daemon RPM, since the corresponding driver modules may not yet have been installed by RPM. The solution is to move the restart logic to a %posttrans script. This runs at completion of the RPM transaction, once everything is uninstalled. --- libvirt.spec.in | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
I haven't used %posttrans before, but it looks simple enough. What I'm not sure of...
diff --git a/libvirt.spec.in b/libvirt.spec.in index d867b09..73e1ec3 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1188,9 +1188,6 @@ fi %endif
/sbin/chkconfig --add libvirtd -if [ "$1" -ge "1" ]; then - /sbin/service libvirtd condrestart > /dev/null 2>&1 -fi %endif
%preun daemon @@ -1207,13 +1204,21 @@ if [ $1 = 0 ]; then fi %endif
-%postun daemon %if %{with_systemd} +%postun daemon /bin/systemctl daemon-reload >/dev/null 2>&1 || : +%endif
is why daemon-reload can be done right away,
This tells systemd to re-read the .unit and .service files, but not take any action.
+%posttrans daemon +%if %{with_systemd} if [ $1 -ge 1 ] ; then # Package upgrade, not uninstall /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
but a full restart has to wait for %posttrans. I was naively assuming they should both be %posttrans.
And this actually makes systemd take some actions. I guess we could also postpone the daemon-reload to %posttrans without any ill-effects though. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Tue, Apr 03, 2012 at 01:48:49PM +0100, Daniel P. Berrange wrote:
This is an update of the patch DV reverted from GIT
https://www.redhat.com/archives/libvir-list/2012-March/msg01332.html
At the end of this series we have the following RPMs with files
For clarity, the complete set is 18741 libvirt-0.9.11-1.fc16.x86_64.rpm 3379337 libvirt-client-0.9.11-1.fc16.x86_64.rpm 1231185 libvirt-daemon-0.9.11-1.fc16.x86_64.rpm 18765 libvirt-daemon-config-network-0.9.11-1.fc16.x86_64.rpm 23057 libvirt-daemon-config-nwfilter-0.9.11-1.fc16.x86_64.rpm 333645 libvirt-daemon-driver-lxc-0.9.11-1.fc16.x86_64.rpm 299625 libvirt-daemon-driver-qemu-0.9.11-1.fc16.x86_64.rpm 56989 libvirt-daemon-driver-uml-0.9.11-1.fc16.x86_64.rpm 151497 libvirt-daemon-driver-xen-0.9.11-1.fc16.x86_64.rpm 18437 libvirt-daemon-kvm-0.9.11-1.fc16.x86_64.rpm 18405 libvirt-daemon-lxc-0.9.11-1.fc16.x86_64.rpm 18441 libvirt-daemon-qemu-0.9.11-1.fc16.x86_64.rpm 18405 libvirt-daemon-uml-0.9.11-1.fc16.x86_64.rpm 18417 libvirt-daemon-xen-0.9.11-1.fc16.x86_64.rpm 7310897 libvirt-debuginfo-0.9.11-1.fc16.x86_64.rpm 509877 libvirt-devel-0.9.11-1.fc16.x86_64.rpm 643977 libvirt-docs-0.9.11-1.fc16.x86_64.rpm 50677 libvirt-lock-sanlock-0.9.11-1.fc16.x86_64.rpm 176053 libvirt-python-0.9.11-1.fc16.x86_64.rpm Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Eric Blake