Hello community,

here is the log from the commit of package ganglia for openSUSE:Factory checked 
in at 2020-02-07 15:57:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ganglia (Old)
 and      /work/SRC/openSUSE:Factory/.ganglia.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ganglia"

Fri Feb  7 15:57:47 2020 rev:10 rq:770839 version:3.7.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/ganglia/ganglia.changes  2020-02-04 
19:54:05.301347325 +0100
+++ /work/SRC/openSUSE:Factory/.ganglia.new.26092/ganglia.changes       
2020-02-07 15:59:34.567671010 +0100
@@ -1,0 +2,7 @@
+Fri Feb  7 09:14:41 UTC 2020 - Christian Goll <[email protected]>
+
+- added check for btrfs root filesystem (bsc#1162886)
+  * added patch gmetad-service-btrfs-check.patch
+  * added source btrfs-subvol-test.sh
+
+-------------------------------------------------------------------

New:
----
  btrfs-subvol-test.sh
  gmetad-service-btrfs-check.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ganglia.spec ++++++
--- /var/tmp/diff_new_pack.larBwu/_old  2020-02-07 15:59:35.731671604 +0100
+++ /var/tmp/diff_new_pack.larBwu/_new  2020-02-07 15:59:35.735671606 +0100
@@ -28,8 +28,10 @@
 URL:            http://ganglia.info/
 # The Release macro value is set in configure.in, please update it there.
 Source0:        
http://downloads.sourceforge.net/ganglia/%{name}-%{version}.tar.gz
+Source1:        btrfs-subvol-test.sh
 # PATCH-FIX-OPENSUSE ganglia-3.7.1-no-private-apr.patch
 Patch1:         ganglia-3.7.2-no-private-apr.patch
+Patch2:         gmetad-service-btrfs-check.patch
 Patch3:         detect_aarch.patch
 Patch4:         add_unknown_arch.patch
 Patch5:         
ganglia-0001-avoid-segfault-when-fd-leaked-and-reached-fd-number-.patch
@@ -139,6 +141,16 @@
 This gmond modules support package provides the capability of loading
 gmetric/python modules via DSO at daemon start time instead of via gmetric.
 
+%package gmetad-skip-bcheck
+Summary:        Skips check for btrs root fs before gmond starts
+Group:          System/Monitoring
+Requires:       ganglia-gmetad
+
+%description gmetad-skip-bcheck
+Skips test for btrfs-root before gmond service start by touching a config 
file. 
+No needed if no btrfs-root is used or statedir is on seperare mount.
+Avoids potential data loss on rollback
+
 
 %package devel
 Summary:        Ganglia static libraries and header files
@@ -228,6 +240,12 @@
 #rc file needed by systemd
 ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcgmond
 ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcgmetad
+# copy check for btrs-root-fs
+cp -f %SOURCE1 %{buildroot}%{_libdir}/ganglia/
+cat > %{buildroot}%{_sysconfdir}/ganglia/no_btrfs_check <<EOF
+This file belongs to the package %name-gmond-skip-bcheck 
+skips the test for a btrfs root
+EOF
 
 %pre  gmetad
 %service_add_pre gmetad.service
@@ -311,6 +329,7 @@
 %{_mandir}/man1/gmetad*1*
 %{_unitdir}/gmetad.service
 %{_sbindir}/rcgmetad
+%attr(0755,-,-) %{_libdir}/ganglia/btrfs-subvol-test.sh
 %config(noreplace) %{_sysconfdir}/%{name}/gmetad.conf
 
 %files gmond
@@ -349,6 +368,9 @@
 %config(noreplace) %{_sysconfdir}/%{name}/conf.d/modpython.conf
 %config(noreplace) %{_sysconfdir}/%{name}/conf.d/*.pyconf*
 
+%files gmetad-skip-bcheck
+%config %{_sysconfdir}/ganglia/no_btrfs_check
+
 %files devel
 %defattr(-,root,root,-)
 %{_includedir}/ganglia.h

++++++ btrfs-subvol-test.sh ++++++
#!/bin/bash
#
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# Author: Christian Goll <[email protected]>
#
TEST_FILE_NAME=no_btrfs_check
function usage() {
cat <<EOF
        $0 /DIR/TO/TEST
        The test will exactly fail if TEST is on the same fs as / and its 
        btrfs fs. As an overwrite option you can touch the file 
/etc/TEST/$TEST_FILE_NAME
        which will make the test always to suceed.
        Goal of this test is to have a handy script to create the awareness, 
that the 
        date in /DIR/TO/TEST my be lost on a fs-rollback.
EOF
}

if [ $# -ne "1" ] ; then 
        usage
        exit 1
fi
testdir=$1
# Test for every entry entry in /proc/mounts if the maximum depth
basedir="/"
depth=0
fstype=unknown
mountops=unknown
while IFS='' read -r entry || [[ -n "$entry" ]] ; do
        path=$(echo $entry | cut -f 2 -d ' ')
        echo $testdir | grep $path > /dev/null
        if [ x$? == "x1" ] ; then
                continue
        fi
        newdepth=$(echo $path | tr -d -c '/' | wc -m)
        if [ $newdepth -lt $depth ] ; then 
                echo "continue"
                continue
        fi
        depth=$newdepth
        fstype=$(echo $entry | cut -f 3 -d ' ')
        mountopts=$(echo $entry | cut -f 4 -d ' ')
        basedir=$path
done < /proc/mounts
if [ $fstype != "btrfs" ] ; then 
        exit 0
fi
echo $mountops | grep 'subvolid' > /dev/null
if [ $basedir != "/" ] ; then
        exit 0
fi
if [ -e "/etc/$(basename $testdir)/$TEST_FILE_NAME" ] ; then
        exit 0
fi
cat << EOF 
The start of the service failed as the directory $testdir" is located under
a btrfs root. On a filesystem rollback data could so become unaccessible or 
corrupted.
To start the service anyway run "touch /etc/$(basename 
$testdir)/$TEST_FILE_NAME" or
install the package with the suffix "skip-bcheck" associtated with the package 
of the
service
EOF
exit 1
++++++ gmetad-service-btrfs-check.patch ++++++
>From 4a4e66bd4c1a5c47da86e34bba557289e72a0a97 Mon Sep 17 00:00:00 2001
From: Christian Goll <[email protected]>
Date: Thu, 6 Feb 2020 16:52:05 +0100
Subject: [PATCH] gmetad service btrfs check

---
 gmetad/gmetad.service.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gmetad/gmetad.service.in b/gmetad/gmetad.service.in
index 8234e90..8e12b69 100644
--- a/gmetad/gmetad.service.in
+++ b/gmetad/gmetad.service.in
@@ -5,6 +5,7 @@ After=network.target
 [Service]
 Type=forking
 PIDFile=@runstatedir@/gmetad.pid
+ExecStartPre=@libdir@/ganglia/btrfs-subvol-test.sh @varstatedir@
 ExecStart=@sbindir@/gmetad --pid-file=@runstatedir@/gmetad.pid
 EnvironmentFile=-@envdir@/gmetad
 
-- 
2.24.1


Reply via email to