|
|
e3c68b |
From f054086daf4549a6227196fe37a57a7e49aa5849 Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: "Bala.FA" <barumuga@redhat.com>
|
|
|
e3c68b |
Date: Fri, 7 Dec 2018 14:13:40 +0530
|
|
|
e3c68b |
Subject: [PATCH 12/52] build: add pretrans check
|
|
|
e3c68b |
|
|
|
e3c68b |
This patch adds pretrans check for client-xlators
|
|
|
e3c68b |
|
|
|
e3c68b |
NOTE: ganesha and python-gluster sub-packages are now obsolete
|
|
|
e3c68b |
|
|
|
e3c68b |
Label: DOWNSTREAM ONLY
|
|
|
e3c68b |
|
|
|
e3c68b |
Change-Id: I454016319832c11902c0ca79a79fbbcf8ac0a121
|
|
|
e3c68b |
Signed-off-by: Bala.FA <barumuga@redhat.com>
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/50967
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/60140
|
|
|
e3c68b |
Tested-by: Milind Changire <mchangir@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
glusterfs.spec.in | 39 +++++++++++++++++++++++++++++++++++++++
|
|
|
e3c68b |
1 file changed, 39 insertions(+)
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
|
|
|
e3c68b |
index 1c631db..a1ff6e0 100644
|
|
|
e3c68b |
--- a/glusterfs.spec.in
|
|
|
e3c68b |
+++ b/glusterfs.spec.in
|
|
|
e3c68b |
@@ -1704,6 +1704,45 @@ if not (ok == 0) then
|
|
|
e3c68b |
end
|
|
|
e3c68b |
|
|
|
e3c68b |
|
|
|
e3c68b |
+%pretrans client-xlators -p <lua>
|
|
|
e3c68b |
+if not posix.access("/bin/bash", "x") then
|
|
|
e3c68b |
+ -- initial installation, no shell, no running glusterfsd
|
|
|
e3c68b |
+ return 0
|
|
|
e3c68b |
+end
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+-- TODO: move this completely to a lua script
|
|
|
e3c68b |
+-- For now, we write a temporary bash script and execute that.
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+script = [[#!/bin/sh
|
|
|
e3c68b |
+pidof -c -o %PPID -x glusterfsd &>/dev/null
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+if [ $? -eq 0 ]; then
|
|
|
e3c68b |
+ pushd . > /dev/null 2>&1
|
|
|
e3c68b |
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
|
|
|
e3c68b |
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
|
|
|
e3c68b |
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
|
|
|
e3c68b |
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
|
|
|
e3c68b |
+ exit 1;
|
|
|
e3c68b |
+ fi
|
|
|
e3c68b |
+ done
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+ popd > /dev/null 2>&1
|
|
|
e3c68b |
+ exit 1;
|
|
|
e3c68b |
+fi
|
|
|
e3c68b |
+]]
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+-- rpm in RHEL5 does not have os.tmpname()
|
|
|
e3c68b |
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
|
|
|
e3c68b |
+tmpname = "/tmp/glusterfs-client-xlators_pretrans_" .. os.date("%s")
|
|
|
e3c68b |
+tmpfile = io.open(tmpname, "w")
|
|
|
e3c68b |
+tmpfile:write(script)
|
|
|
e3c68b |
+tmpfile:close()
|
|
|
e3c68b |
+ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
e3c68b |
+os.remove(tmpname)
|
|
|
e3c68b |
+if not (ok == 0) then
|
|
|
e3c68b |
+ error("Detected running glusterfs processes", ok)
|
|
|
e3c68b |
+end
|
|
|
e3c68b |
+
|
|
|
e3c68b |
|
|
|
e3c68b |
%pretrans devel -p <lua>
|
|
|
e3c68b |
if not posix.access("/bin/bash", "x") then
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|