Accepting request 501831 from home:jfehlig:branches:Virtualization

Miscellaneous spec file improvements.

- misc spec file cleanup
  - remove checks for old distros well beyond EOL
  - enable wireshark dissector for Leap >= 42.2 and Factory
  - remove support for old, non-systemd distros
  - replace $RPM_ shell vars with modern macros

  5004f121-virFdStreamThread-dont-exceed-length.patch,
  1a4b21f1-set-EOF-on-end-of-stream.patch

OBS-URL: https://build.opensuse.org/request/show/501831
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=608
This commit is contained in:
James Fehlig 2017-06-07 23:56:21 +00:00 committed by Git OBS Bridge
parent 82e6ddc91c
commit f044c9550b
4 changed files with 125 additions and 260 deletions

View File

@ -0,0 +1,39 @@
commit 1a4b21f1c67a3ddf39d11bba39c1dee869131636
Author: Michal Privoznik <mprivozn@redhat.com>
Date: Tue Jun 6 14:45:55 2017 +0200
virNetClientStreamQueuePacket: Set st->incomingEOF on the end of stream
While reworking client side of streams, I had to postpone payload
decoding so that stream holes and stream data can be
distinguished in virNetClientStreamRecvPacket. That's merely what
18944b7aea46d does. However, I accidentally removed one important
bit: when server sends us an empty STREAM packet (with no
payload) - meaning end of stream - st->incomingEOF flag needs to
be set. It used to be before I touched the code. After I removed
it, virNetClientStreamRecvPacket will try to fetch more data from
the stream, but it will never come.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Index: libvirt-3.4.0/src/rpc/virnetclientstream.c
===================================================================
--- libvirt-3.4.0.orig/src/rpc/virnetclientstream.c
+++ libvirt-3.4.0/src/rpc/virnetclientstream.c
@@ -278,6 +278,15 @@ int virNetClientStreamQueuePacket(virNet
VIR_DEBUG("Incoming stream message: stream=%p message=%p", st, msg);
+ if (msg->bufferLength == msg->bufferOffset) {
+ /* No payload means end of the stream. */
+ virObjectLock(st);
+ st->incomingEOF = true;
+ virNetClientStreamEventTimerUpdate(st);
+ virObjectUnlock(st);
+ return 0;
+ }
+
/* Unfortunately, we must allocate new message as the one we
* get in @msg is going to be cleared later in the process. */

View File

@ -1,8 +1,18 @@
-------------------------------------------------------------------
Wed Jun 7 22:07:38 UTC 2017 - jfehlig@suse.com
- misc spec file cleanup
- remove checks for old distros well beyond EOL
- enable wireshark dissector for Leap >= 42.2 and Factory
- remove support for old, non-systemd distros
- replace $RPM_ shell vars with modern macros
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Jun 6 22:01:24 UTC 2017 - jfehlig@suse.com Tue Jun 6 22:01:24 UTC 2017 - jfehlig@suse.com
- Don't exceed specified length when reading from stream - Don't exceed specified length when reading from stream
5004f121-virFdStreamThread-dont-exceed-length.patch 5004f121-virFdStreamThread-dont-exceed-length.patch,
1a4b21f1-set-EOF-on-end-of-stream.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Jun 2 17:23:04 UTC 2017 - jfehlig@suse.com Fri Jun 2 17:23:04 UTC 2017 - jfehlig@suse.com

View File

@ -19,12 +19,6 @@
# The configuration of libvirt is modified slightly for SLE # The configuration of libvirt is modified slightly for SLE
%define with_sle_build %{?is_opensuse:0}%{!?is_opensuse:1} %define with_sle_build %{?is_opensuse:0}%{!?is_opensuse:1}
# openSUSE13.1 and 13.2 do not understand %is_opensuse. Check for those
# explicitly and disable SLE build
%if 0%{?suse_version} == 1310 || 0%{?suse_version} == 1320
%define with_sle_build 0
%endif
# The hypervisor drivers that run in libvirtd # The hypervisor drivers that run in libvirtd
%define with_xen 0%{!?_without_xen:1} %define with_xen 0%{!?_without_xen:1}
%define with_qemu 0%{!?_without_qemu:1} %define with_qemu 0%{!?_without_qemu:1}
@ -52,7 +46,6 @@
# A few optional bits off by default, we enable later # A few optional bits off by default, we enable later
%define with_cgconfig 0%{!?_without_cgconfig:0} %define with_cgconfig 0%{!?_without_cgconfig:0}
%define with_systemd 0%{!?_without_systemd:0}
%define with_numactl 0%{!?_without_numactl:0} %define with_numactl 0%{!?_without_numactl:0}
%define with_numad 0%{!?_without_numad:0} %define with_numad 0%{!?_without_numad:0}
%define with_firewalld 0%{!?_without_firewalld:0} %define with_firewalld 0%{!?_without_firewalld:0}
@ -70,7 +63,7 @@
%define with_libxl 0 %define with_libxl 0
%endif %endif
# For SLE, further restrice Xen support to x86_64 only # For SLE, further restrict Xen support to x86_64 only
%if %{with_sle_build} %if %{with_sle_build}
%ifarch %arm aarch64 %ifarch %arm aarch64
%define with_xen 0 %define with_xen 0
@ -136,16 +129,13 @@
%endif %endif
%endif %endif
# Support systemd on 12.1 and later # libvirt commit 37397320 changed the configure check for wireshark to use
%if 0%{?suse_version} >= 1210 # pkgconfig. Currently only the Leap 42.2 and Factory wireshark-devel packages
%define with_systemd 0%{!?_without_systemd:1} # provide wireshark.pc. Disable the dissector for SLE and Leap <= 42.1
%if 0%{?sle_version} < 120200 && %{with_sle_build}
%define with_wireshark 0
%endif %endif
# libvirt commit 37397320 changed the configure check for wireshark to
# use pkgconfig, but our wireshark packages do not provide wireshark.pc.
# Disable the dissector for now
%define with_wireshark 0
# numad is used to manage the CPU and memory placement dynamically for # numad is used to manage the CPU and memory placement dynamically for
# qemu, lxc, and uml drivers # qemu, lxc, and uml drivers
%if %{with_qemu} || %{with_lxc} || %{with_uml} %if %{with_qemu} || %{with_lxc} || %{with_uml}
@ -219,10 +209,8 @@ BuildRequires: gettext-tools
BuildRequires: libtool BuildRequires: libtool
# Needed for virkmodtest in 'make check' # Needed for virkmodtest in 'make check'
BuildRequires: modutils BuildRequires: modutils
%if %{with_systemd}
BuildRequires: systemd BuildRequires: systemd
BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(systemd)
%endif
%if %{with_xen} || %{with_libxl} %if %{with_xen} || %{with_libxl}
BuildRequires: xen-devel BuildRequires: xen-devel
%endif %endif
@ -312,12 +300,12 @@ BuildRequires: libssh-devel >= 0.7.0
Source0: %{name}-%{version}.tar.xz Source0: %{name}-%{version}.tar.xz
Source1: %{name}-%{version}.tar.xz.asc Source1: %{name}-%{version}.tar.xz.asc
Source2: %{name}.keyring Source2: %{name}.keyring
Source3: libvirtd.init Source3: libvirtd-relocation-server.fw
Source4: libvirtd-relocation-server.fw
Source99: baselibs.conf Source99: baselibs.conf
Source100: %{name}-rpmlintrc Source100: %{name}-rpmlintrc
# Upstream patches # Upstream patches
Patch0: 5004f121-virFdStreamThread-dont-exceed-length.patch Patch0: 5004f121-virFdStreamThread-dont-exceed-length.patch
Patch1: 1a4b21f1-set-EOF-on-end-of-stream.patch
# Patches pending upstream review # Patches pending upstream review
Patch100: libxl-dom-reset.patch Patch100: libxl-dom-reset.patch
Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch
@ -390,10 +378,8 @@ Recommends: polkit >= 0.93
# For virConnectGetSysinfo # For virConnectGetSysinfo
Requires: dmidecode Requires: dmidecode
%endif %endif
%if %{with_systemd}
# For service management # For service management
%{?systemd_requires} %{?systemd_requires}
%endif
%if %{with_numad} %if %{with_numad}
Requires: numad Requires: numad
%endif %endif
@ -818,9 +804,9 @@ capabilities of recent versions of Linux (and other OSes).
%package libs %package libs
Summary: Client side libraries for libvirt Summary: Client side libraries for libvirt
Group: Development/Libraries/C and C++
# So remote clients can access libvirt over SSH tunnel # So remote clients can access libvirt over SSH tunnel
# (client invokes 'nc' against the UNIX socket on the server) # (client invokes 'nc' against the UNIX socket on the server)
Group: Development/Libraries/C and C++
Requires: netcat-openbsd Requires: netcat-openbsd
# Not technically required, but makes 'out-of-box' config # Not technically required, but makes 'out-of-box' config
# work correctly & doesn't have onerous dependencies # work correctly & doesn't have onerous dependencies
@ -887,6 +873,7 @@ libvirt plugin for NSS for translating domain names into IP addresses.
%prep %prep
%setup -q %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1
%patch100 -p1 %patch100 -p1
%patch101 -p1 %patch101 -p1
%patch150 -p1 %patch150 -p1
@ -1008,11 +995,6 @@ libvirt plugin for NSS for translating domain names into IP addresses.
%else %else
%define arg_sanlock --without-sanlock %define arg_sanlock --without-sanlock
%endif %endif
%if %{with_systemd}
%define arg_init_script --with-init-script=systemd
%else
%define arg_init_script --with-init-script=redhat
%endif
%if %{with_firewalld} %if %{with_firewalld}
%define arg_firewalld --with-firewalld %define arg_firewalld --with-firewalld
%else %else
@ -1035,7 +1017,7 @@ LOADERS="$LOADERS:/usr/share/qemu/aavmf-aarch64-code.bin:/usr/share/qemu/aavmf-a
%define arg_loader_nvram --with-loader-nvram="$LOADERS" %define arg_loader_nvram --with-loader-nvram="$LOADERS"
autoreconf -f -i autoreconf -f -i
export CFLAGS="$RPM_OPT_FLAGS" export CFLAGS="%{optflags}"
%configure --disable-static --with-pic \ %configure --disable-static --with-pic \
%{?arg_xen} \ %{?arg_xen} \
%{?arg_qemu} \ %{?arg_qemu} \
@ -1094,7 +1076,7 @@ export CFLAGS="$RPM_OPT_FLAGS"
--with-qemu-group=%{qemu_group} \ --with-qemu-group=%{qemu_group} \
%{?arg_loader_nvram} \ %{?arg_loader_nvram} \
--without-login-shell \ --without-login-shell \
%{arg_init_script} \ --with-init-script=systemd \
ac_cv_path_MODPROBE=/sbin/modprobe \ ac_cv_path_MODPROBE=/sbin/modprobe \
ac_cv_path_UDEVADM=/sbin/udevadm \ ac_cv_path_UDEVADM=/sbin/udevadm \
ac_cv_path_SHOWMOUNT=/usr/sbin/showmount \ ac_cv_path_SHOWMOUNT=/usr/sbin/showmount \
@ -1106,146 +1088,124 @@ gzip -9 ChangeLog
%install %install
%makeinstall SYSTEMD_UNIT_DIR=%{_unitdir} HTML_DIR=%{_docdir}/%{name} %makeinstall SYSTEMD_UNIT_DIR=%{_unitdir} HTML_DIR=%{_docdir}/%{name}
make %{?jobs:-j%jobs} -C examples distclean make %{?jobs:-j%jobs} -C examples distclean
cp examples/lxcconvert/virt-lxc-convert $RPM_BUILD_ROOT%{_bindir} cp examples/lxcconvert/virt-lxc-convert %{buildroot}/%{_bindir}
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la rm -f %{buildroot}/%{_libdir}/*.la
%if %{with_wireshark} %if %{with_wireshark}
rm -f $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/libvirt.la rm -f %{buildroot}/%{_libdir}/wireshark/plugins/libvirt.la
%endif %endif
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a rm -f %{buildroot}/%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/lock-driver/*.la rm -f %{buildroot}/%{_libdir}/%{name}/lock-driver/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/lock-driver/*.a rm -f %{buildroot}/%{_libdir}/%{name}/lock-driver/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/connection-driver/*.la rm -f %{buildroot}/%{_libdir}/%{name}/connection-driver/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/connection-driver/*.a rm -f %{buildroot}/%{_libdir}/%{name}/connection-driver/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/storage-backend/*.la rm -f %{buildroot}/%{_libdir}/%{name}/storage-backend/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/storage-backend/*.a rm -f %{buildroot}/%{_libdir}/%{name}/storage-backend/*.a
# remove currently unsupported locale(s) # remove currently unsupported locale(s)
for dir in $RPM_BUILD_ROOT/usr/share/locale/* for dir in %{buildroot}/usr/share/locale/*
do do
sdir=`echo $dir | sed "s|$RPM_BUILD_ROOT||"` sdir=`echo $dir | sed "s|%{buildroot}||"`
if test -d $sdir ; then continue ; fi if test -d $sdir ; then continue ; fi
rm -rfv "$dir" rm -rfv "$dir"
done done
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/libvirt mkdir -p %{buildroot}/%{_localstatedir}/lib/libvirt
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/hooks mkdir -p %{buildroot}/%{_sysconfdir}/libvirt/hooks
%find_lang %{name} %find_lang %{name}
# Add a README to the libvirt package with a note about the empty # Add a README to the libvirt package with a note about the empty
# file list # file list
cat > $RPM_BUILD_ROOT%{_docdir}/libvirt/libvirt.README << 'EOF' cat > %{buildroot}/%{_docdir}/libvirt/libvirt.README << 'EOF'
The libvirt package no longer contains any files. It exists now The libvirt package no longer contains any files. It exists now
only to fulfill its 'Provides' contract. only to fulfill its 'Provides' contract.
EOF EOF
install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/lib/libvirt/dnsmasq/ install -d -m 0755 %{buildroot}/%{_localstatedir}/lib/libvirt/dnsmasq/
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/ install -d -m 0755 %{buildroot}/%{_datadir}/libvirt/networks/
cp $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml \ cp %{buildroot}/%{_sysconfdir}/libvirt/qemu/networks/default.xml \
$RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml %{buildroot}/%{_datadir}/libvirt/networks/default.xml
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml rm -f %{buildroot}/%{_sysconfdir}/libvirt/qemu/networks/default.xml
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml rm -f %{buildroot}/%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
# Strip auto-generated UUID - we need it generated per-install # Strip auto-generated UUID - we need it generated per-install
sed -i -e "/<uuid>/d" $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml sed -i -e "/<uuid>/d" %{buildroot}/%{_datadir}/libvirt/networks/default.xml
%if %{with_lxc} %if %{with_lxc}
cat > $RPM_BUILD_ROOT%{_docdir}/libvirt/libvirt-daemon-lxc.README << 'EOF' cat > %{buildroot}/%{_docdir}/libvirt/libvirt-daemon-lxc.README << 'EOF'
Any empty package encapsulating requirements for a libvirtd capable Any empty package encapsulating requirements for a libvirtd capable
of managing LXC. of managing LXC.
EOF EOF
%else %else
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/lxc.conf rm -rf %{buildroot}/%{_sysconfdir}/libvirt/lxc.conf
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_lxc.aug rm -f %{buildroot}/%{_datadir}/augeas/lenses/libvirtd_lxc.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug rm -f %{buildroot}/%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.lxc rm -rf %{buildroot}/%{_sysconfdir}/logrotate.d/libvirtd.lxc
%endif %endif
%if %{with_qemu} %if %{with_qemu}
cat > $RPM_BUILD_ROOT%{_docdir}/libvirt/libvirt-daemon-qemu.README << 'EOF' cat > %{buildroot}/%{_docdir}/libvirt/libvirt-daemon-qemu.README << 'EOF'
Any empty package encapsulating requirements for a libvirtd capable Any empty package encapsulating requirements for a libvirtd capable
of managing QEMU/KVM. of managing QEMU/KVM.
EOF EOF
%else %else
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu.conf rm -rf %{buildroot}/%{_sysconfdir}/libvirt/qemu.conf
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_qemu.aug rm -f %{buildroot}/%{_datadir}/augeas/lenses/libvirtd_qemu.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug rm -f %{buildroot}/%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.qemu rm -rf %{buildroot}/%{_sysconfdir}/logrotate.d/libvirtd.qemu
%endif %endif
%if %{with_uml} %if %{with_uml}
cat > $RPM_BUILD_ROOT%{_docdir}/libvirt/libvirt-daemon-uml.README << 'EOF' cat > %{buildroot}/%{_docdir}/libvirt/libvirt-daemon-uml.README << 'EOF'
Any empty package encapsulating requirements for a libvirtd capable Any empty package encapsulating requirements for a libvirtd capable
of managing UML. of managing UML.
EOF EOF
%else %else
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.uml rm -rf %{buildroot}/%{_sysconfdir}/logrotate.d/libvirtd.uml
%endif %endif
%if %{with_vbox} %if %{with_vbox}
cat > $RPM_BUILD_ROOT%{_docdir}/libvirt/libvirt-daemon-vbox.README << 'EOF' cat > %{buildroot}/%{_docdir}/libvirt/libvirt-daemon-vbox.README << 'EOF'
Any empty package encapsulating requirements for a libvirtd capable Any empty package encapsulating requirements for a libvirtd capable
of managing VirtualBox. of managing VirtualBox.
EOF EOF
%endif %endif
%if %{with_xen} || %{with_libxl} %if %{with_xen} || %{with_libxl}
cat > $RPM_BUILD_ROOT%{_docdir}/libvirt/libvirt-daemon-xen.README << 'EOF' cat > %{buildroot}/%{_docdir}/libvirt/libvirt-daemon-xen.README << 'EOF'
Any empty package encapsulating requirements for a libvirtd capable Any empty package encapsulating requirements for a libvirtd capable
of managing Xen. of managing Xen.
EOF EOF
%endif %endif
%if ! %{with_libxl} %if ! %{with_libxl}
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/libxl.conf rm -f %{buildroot}/%{_sysconfdir}/libvirt/libxl.conf
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.libxl rm -f %{buildroot}/%{_sysconfdir}/logrotate.d/libvirtd.libxl
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_libxl.aug rm -f %{buildroot}/%{_datadir}/augeas/lenses/libvirtd_libxl.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug rm -f %{buildroot}/%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
%endif %endif
%if ! %{with_sanlock} %if ! %{with_sanlock}
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirt_sanlock.aug rm -f %{buildroot}/%{_datadir}/augeas/lenses/libvirt_sanlock.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirt_sanlock.aug rm -f %{buildroot}/%{_datadir}/augeas/lenses/tests/test_libvirt_sanlock.aug
%endif %endif
# init scripts # init scripts
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d mkdir -p %{buildroot}/%{_localstatedir}/adm/fillup-templates
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates rm -f %{buildroot}/usr/lib/sysctl.d/60-libvirtd.conf
# Currently using our own libvirtd init script mv %{buildroot}/%{_sysconfdir}/sysconfig/libvirtd %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.libvirtd
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/libvirtd mv %{buildroot}/%{_sysconfdir}/sysconfig/virtlogd %{buildroot}/%{_localstatedir}/adm/fillup-templates/sysconfig.virtlogd
%if %{with_systemd} mv %{buildroot}/%{_sysconfdir}/sysconfig/virtlockd %{buildroot}/%{_localstatedir}/adm/fillup-templates/sysconfig.virtlockd
ln -s %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rclibvirtd mv %{buildroot}/%{_sysconfdir}/sysconfig/libvirt-guests %{buildroot}/%{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests
%else # Provide rc symlink backward compatibility
install %SOURCE3 $RPM_BUILD_ROOT%{_sysconfdir}/init.d/libvirtd ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rclibvirtd
ln -s /etc/init.d/libvirtd $RPM_BUILD_ROOT%{_sbindir}/rclibvirtd ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rcvirtlogd
%endif ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rcvirtlockd
mv $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/libvirtd $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.libvirtd ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rclibvirt-guests
rm -f $RPM_BUILD_ROOT/usr/lib/sysctl.d/60-libvirtd.conf
# For other services, use the in-tree scripts
%if %{with_systemd}
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/virtlogd
ln -s %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcvirtlogd
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/virtlockd
ln -s %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcvirtlockd
%else
mv $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/virtlogd $RPM_BUILD_ROOT%{_sysconfdir}/init.d/virtlogd
ln -s /etc/init.d/virtlogd $RPM_BUILD_ROOT%{_sbindir}/rcvirtlogd
mv $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/virtlockd $RPM_BUILD_ROOT%{_sysconfdir}/init.d/virtlockd
ln -s /etc/init.d/virtlockd $RPM_BUILD_ROOT%{_sbindir}/rcvirtlockd
%endif
mv $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/virtlogd $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.virtlogd
mv $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/virtlockd $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.virtlockd
#install firewall definitions format is described here: #install firewall definitions format is described here:
#/usr/share/SuSEfirewall2/services/TEMPLATE #/usr/share/SuSEfirewall2/services/TEMPLATE
mkdir -p $RPM_BUILD_ROOT%{_fwdefdir} mkdir -p %{buildroot}/%{_fwdefdir}
install -m 644 %{S:4} $RPM_BUILD_ROOT%{_fwdefdir}/libvirtd-relocation-server install -m 644 %{S:3} %{buildroot}/%{_fwdefdir}/libvirtd-relocation-server
%if %{with_systemd}
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/libvirt-guests
ln -s %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rclibvirt-guests
%else
mv $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/libvirt-guests $RPM_BUILD_ROOT%{_sysconfdir}/init.d/libvirt-guests
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
ln -s %{_sysconfdir}/init.d/libvirt-guests $RPM_BUILD_ROOT%{_sbindir}/rclibvirt-guests
%endif
mv $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/libvirt-guests $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests
%ifarch %{power64} s390x x86_64 %ifarch %{power64} s390x x86_64
mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes.stp \ mv %{buildroot}/%{_datadir}/systemtap/tapset/libvirt_probes.stp \
$RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes-64.stp %{buildroot}/%{_datadir}/systemtap/tapset/libvirt_probes-64.stp
mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \ mv %{buildroot}/%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \
$RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes-64.stp %{buildroot}/%{_datadir}/systemtap/tapset/libvirt_qemu_probes-64.stp
%endif %endif
%fdupes -s $RPM_BUILD_ROOT %fdupes -s %{buildroot}
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf %{buildroot}
%check %check
cd tests cd tests
@ -1271,39 +1231,28 @@ then
fi fi
%pre daemon %pre daemon
%if %{with_systemd}
%service_add_pre libvirtd.service %service_add_pre libvirtd.service
%service_add_pre virtlockd.service virtlockd.socket %service_add_pre virtlockd.service virtlockd.socket
%service_add_pre virtlogd.service virtlogd.socket %service_add_pre virtlogd.service virtlogd.socket
%endif
%{_bindir}/getent group libvirt >/dev/null || \ %{_bindir}/getent group libvirt >/dev/null || \
%{_sbindir}/groupadd -r libvirt || : %{_sbindir}/groupadd -r libvirt || :
%post daemon %post daemon
/sbin/ldconfig /sbin/ldconfig
%if %{with_systemd}
%service_add_post libvirtd.service %service_add_post libvirtd.service
%service_add_post virtlockd.service virtlockd.socket %service_add_post virtlockd.service virtlockd.socket
%service_add_post virtlogd.service virtlogd.socket %service_add_post virtlogd.service virtlogd.socket
%endif
%{fillup_only -n libvirtd} %{fillup_only -n libvirtd}
%{fillup_only -n virtlockd} %{fillup_only -n virtlockd}
%{fillup_only -n virtlogd} %{fillup_only -n virtlogd}
%preun daemon %preun daemon
%if %{with_systemd}
%service_del_preun libvirtd.service %service_del_preun libvirtd.service
%service_del_preun virtlockd.service virtlockd.socket %service_del_preun virtlockd.service virtlockd.socket
%service_del_preun virtlogd.service virtlogd.socket %service_del_preun virtlogd.service virtlogd.socket
%else
%stop_on_removal libvirtd
%stop_on_removal virtlockd
%stop_on_removal virtlogd
%endif
%postun daemon %postun daemon
/sbin/ldconfig /sbin/ldconfig
%if %{with_systemd}
# On upgrade, defer restarting daemons until %posttrans # On upgrade, defer restarting daemons until %posttrans
if test $1 -eq 0 ; then if test $1 -eq 0 ; then
for service in libvirtd virtlockd virtlogd ; do for service in libvirtd virtlockd virtlogd ; do
@ -1311,29 +1260,18 @@ if test $1 -eq 0 ; then
done done
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi fi
%else
%restart_on_update libvirtd
%restart_on_update virtlockd
%restart_on_update virtlogd
%endif
%if %{with_systemd}
%service_del_postun libvirtd.service %service_del_postun libvirtd.service
%service_del_postun virtlockd.service virtlockd.socket %service_del_postun virtlockd.service virtlockd.socket
%service_del_postun virtlogd.service virtlogd.socket %service_del_postun virtlogd.service virtlogd.socket
%else
%insserv_cleanup
%endif
%posttrans daemon %posttrans daemon
# All connection drivers should be installed post transaction. # All connection drivers should be installed post transaction.
# Time to restart daemons. # Time to restart daemons.
%if %{with_systemd}
if test "$YAST_IS_RUNNING" != "instsys" -a "$DISABLE_RESTART_ON_UPDATE" != yes ; then if test "$YAST_IS_RUNNING" != "instsys" -a "$DISABLE_RESTART_ON_UPDATE" != yes ; then
for service in libvirtd virtlockd virtlogd ; do for service in libvirtd virtlockd virtlogd ; do
/usr/bin/systemctl try-restart ${service}.service >/dev/null 2>&1 || : /usr/bin/systemctl try-restart ${service}.service >/dev/null 2>&1 || :
done done
fi fi
%endif
# In upgrade scenario we must explicitly enable virtlockd/virtlogd # In upgrade scenario we must explicitly enable virtlockd/virtlogd
# sockets, if libvirtd is already enabled and start them if # sockets, if libvirtd is already enabled and start them if
@ -1341,17 +1279,10 @@ fi
# guests # guests
%triggerpostun daemon -- libvirt-daemon < 1.3.0 %triggerpostun daemon -- libvirt-daemon < 1.3.0
if [ $1 -ge 1 ] ; then if [ $1 -ge 1 ] ; then
%if %{with_systemd}
/usr/bin/systemctl is-enabled libvirtd.service 1>/dev/null 2>&1 && /usr/bin/systemctl is-enabled libvirtd.service 1>/dev/null 2>&1 &&
/usr/bin/systemctl enable virtlogd.socket || : /usr/bin/systemctl enable virtlogd.socket || :
/usr/bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 && /usr/bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 &&
/usr/bin/systemctl start virtlogd.socket || : /usr/bin/systemctl start virtlogd.socket || :
%else
/sbin/chkconfig libvirtd 1>/dev/null 2>&1 &&
/sbin/chkconfig virtlogd on || :
/sbin/service libvirtd status 1>/dev/null 2>&1 &&
/sbin/service virtlogd start || :
%endif
fi fi
%post daemon-config-network %post daemon-config-network
@ -1364,32 +1295,20 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ;
fi fi
%pre client %pre client
%if %{with_systemd}
%service_add_pre libvirt-guests.service %service_add_pre libvirt-guests.service
%endif
%post client %post client
%if %{with_systemd}
%service_add_post libvirt-guests.service %service_add_post libvirt-guests.service
%endif
%{fillup_only -n libvirt-guests} %{fillup_only -n libvirt-guests}
%preun client %preun client
%if %{with_systemd}
%service_del_preun libvirt-guests.service %service_del_preun libvirt-guests.service
%else
%stop_on_removal libvirt-guests
%endif
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
rm -f /var/lib/libvirt/libvirt-guests rm -f /var/lib/libvirt/libvirt-guests
fi fi
%postun client %postun client
%if %{with_systemd}
%service_del_postun libvirt-guests.service %service_del_postun libvirt-guests.service
%else
%insserv_cleanup
%endif
%post libs %post libs
/sbin/ldconfig /sbin/ldconfig
@ -1416,18 +1335,12 @@ fi
%{_localstatedir}/adm/fillup-templates/sysconfig.libvirtd %{_localstatedir}/adm/fillup-templates/sysconfig.libvirtd
%{_localstatedir}/adm/fillup-templates/sysconfig.virtlogd %{_localstatedir}/adm/fillup-templates/sysconfig.virtlogd
%{_localstatedir}/adm/fillup-templates/sysconfig.virtlockd %{_localstatedir}/adm/fillup-templates/sysconfig.virtlockd
%if %{with_systemd}
%{_unitdir}/libvirtd.service %{_unitdir}/libvirtd.service
%{_unitdir}/virt-guest-shutdown.target %{_unitdir}/virt-guest-shutdown.target
%{_unitdir}/virtlogd.service %{_unitdir}/virtlogd.service
%{_unitdir}/virtlogd.socket %{_unitdir}/virtlogd.socket
%{_unitdir}/virtlockd.service %{_unitdir}/virtlockd.service
%{_unitdir}/virtlockd.socket %{_unitdir}/virtlockd.socket
%else
%config /etc/init.d/libvirtd
%config /etc/init.d/virtlogd
%config /etc/init.d/virtlockd
%endif
%{_sbindir}/rclibvirtd %{_sbindir}/rclibvirtd
%{_sbindir}/rcvirtlogd %{_sbindir}/rcvirtlogd
%{_sbindir}/rcvirtlockd %{_sbindir}/rcvirtlockd
@ -1668,11 +1581,7 @@ fi
%dir %{_libdir}/%{name} %dir %{_libdir}/%{name}
%attr(0755, root, root) %{_libdir}/%{name}/libvirt-guests.sh %attr(0755, root, root) %{_libdir}/%{name}/libvirt-guests.sh
%{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests %{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests
%if %{with_systemd}
%{_unitdir}/libvirt-guests.service %{_unitdir}/libvirt-guests.service
%else
%config /etc/init.d/libvirt-guests
%endif
%{_sbindir}/rclibvirt-guests %{_sbindir}/rclibvirt-guests
%files libs -f %{name}.lang %files libs -f %{name}.lang

View File

@ -1,93 +0,0 @@
#!/bin/sh
# the following is the LSB init header see
# http://www.linux-foundation.org/spec//booksets/LSB-Core-generic/LSB-Core-generic.html#INITSCRCOMCONV
#
### BEGIN INIT INFO
# Provides: libvirtd
# Required-Start: $network $remote_fs
# Should-Start: xend cgconfig
# Default-Start: 3 5
# Required-Stop: $network $remote_fs
# Should-Stop: xend cgconfig
# Default-Stop: 0 1 2 4 6
# Short-Description: daemon for libvirt virtualization API
# Description: This is a daemon for managing QEMU guest instances
# and libvirt virtual networks
# See http://libvirt.org
### END INIT INFO
LIBVIRTD_BIN=/usr/sbin/libvirtd
LIBVIRTD_PIDFILE=/var/run/libvirtd.pid
test -x $LIBVIRTD_BIN || { echo "$LIBVIRD_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
. /etc/rc.status
rc_reset
test -f /etc/sysconfig/libvirtd && . /etc/sysconfig/libvirtd
LIBVIRTD_CONFIG_ARGS=
if [ -n "$LIBVIRTD_CONFIG" ]
then
LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
fi
case "$1" in
start)
if [ -e $LIBVIRTD_PIDFILE ]; then
if checkproc $LIBVIRTD_BIN ; then
echo -n "libvirtd is already running."
rc_status -v
exit
else
echo "Removing stale PID file $LIBVIRTD_PIDFILE."
rm -f $LIBVIRTD_PIDFILE
fi
fi
echo -n "Starting libvirtd "
mkdir -p /var/cache/libvirt
rm -rf /var/cache/libvirt/*
# LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
# automatically
if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
fi
startproc $LIBVIRTD_BIN --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
rc_status -v
;;
stop)
echo -n "Shutting down libvirtd "
rm -rf /var/cache/libvirt/*
killproc -TERM $LIBVIRTD_BIN > /dev/null 2>&1
rm -f $LIBVIRTD_PIDFILE
rc_status -v
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
reload)
killproc -HUP $LIBVIRTD_BIN
rc_status -v
;;
status)
echo -n "Checking status of libvirtd "
checkproc $LIBVIRTD_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|reload|status}"
rc_failed 2
rc_exit
;;
esac
rc_exit