|
|
256ebe |
From bf5906cbc9bf986c7495db792d098001e28c47e3 Mon Sep 17 00:00:00 2001
|
|
|
256ebe |
From: Niels de Vos <ndevos@redhat.com>
|
|
|
256ebe |
Date: Wed, 22 Apr 2015 15:39:59 +0200
|
|
|
256ebe |
Subject: [PATCH 10/52] spec: fix/add pre-transaction scripts for geo-rep and
|
|
|
256ebe |
cli packages
|
|
|
256ebe |
|
|
|
256ebe |
The cli subpackage never had a %pretrans script, this has been added
|
|
|
256ebe |
now.
|
|
|
256ebe |
|
|
|
256ebe |
The %pretrans script for ge-repliaction was never included in the RPM
|
|
|
256ebe |
package because it was disable by a undefined macro (_can_georeplicate).
|
|
|
256ebe |
This macro is not used/set anywhere else and _without_georeplication
|
|
|
256ebe |
should take care of it anyway.
|
|
|
256ebe |
|
|
|
256ebe |
Note: This is a Red Hat Gluster Storage specific patch. Upstream
|
|
|
256ebe |
packaging guidelines do not allow these kind of 'features'.
|
|
|
256ebe |
|
|
|
256ebe |
Label: DOWNSTREAM ONLY
|
|
|
256ebe |
|
|
|
256ebe |
Change-Id: I16aab5bba72f1ed178f3bcac47f9d8ef767cfcef
|
|
|
256ebe |
Signed-off-by: Niels de Vos <ndevos@redhat.com>
|
|
|
256ebe |
Signed-off-by: Bala.FA <barumuga@redhat.com>
|
|
|
256ebe |
Reviewed-on: https://code.engineering.redhat.com/gerrit/50491
|
|
|
256ebe |
Reviewed-on: https://code.engineering.redhat.com/gerrit/60138
|
|
|
256ebe |
Tested-by: Milind Changire <mchangir@redhat.com>
|
|
|
256ebe |
---
|
|
|
256ebe |
glusterfs.spec.in | 43 +++++++++++++++++++++++++++++++++++++++++--
|
|
|
256ebe |
1 file changed, 41 insertions(+), 2 deletions(-)
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
|
|
|
256ebe |
index 8a31a98..b70dbfc 100644
|
|
|
256ebe |
--- a/glusterfs.spec.in
|
|
|
256ebe |
+++ b/glusterfs.spec.in
|
|
|
256ebe |
@@ -1626,6 +1626,47 @@ end
|
|
|
256ebe |
|
|
|
256ebe |
|
|
|
256ebe |
|
|
|
256ebe |
+%pretrans cli -p <lua>
|
|
|
256ebe |
+if not posix.access("/bin/bash", "x") then
|
|
|
256ebe |
+ -- initial installation, no shell, no running glusterfsd
|
|
|
256ebe |
+ return 0
|
|
|
256ebe |
+end
|
|
|
256ebe |
+
|
|
|
256ebe |
+-- TODO: move this completely to a lua script
|
|
|
256ebe |
+-- For now, we write a temporary bash script and execute that.
|
|
|
256ebe |
+
|
|
|
256ebe |
+script = [[#!/bin/sh
|
|
|
256ebe |
+pidof -c -o %PPID -x glusterfsd &>/dev/null
|
|
|
256ebe |
+
|
|
|
256ebe |
+if [ $? -eq 0 ]; then
|
|
|
256ebe |
+ pushd . > /dev/null 2>&1
|
|
|
256ebe |
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
|
|
|
256ebe |
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
|
|
|
256ebe |
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
|
|
|
256ebe |
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
|
|
|
256ebe |
+ exit 1;
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+ done
|
|
|
256ebe |
+
|
|
|
256ebe |
+ popd > /dev/null 2>&1
|
|
|
256ebe |
+ exit 1;
|
|
|
256ebe |
+fi
|
|
|
256ebe |
+]]
|
|
|
256ebe |
+
|
|
|
256ebe |
+-- rpm in RHEL5 does not have os.tmpname()
|
|
|
256ebe |
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
|
|
|
256ebe |
+tmpname = "/tmp/glusterfs-cli_pretrans_" .. os.date("%s")
|
|
|
256ebe |
+tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
+tmpfile:write(script)
|
|
|
256ebe |
+tmpfile:close()
|
|
|
256ebe |
+ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
+os.remove(tmpname)
|
|
|
256ebe |
+if not (ok == 0) then
|
|
|
256ebe |
+ error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
+end
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
+
|
|
|
256ebe |
%pretrans devel -p <lua>
|
|
|
256ebe |
if not posix.access("/bin/bash", "x") then
|
|
|
256ebe |
-- initial installation, no shell, no running glusterfsd
|
|
|
256ebe |
@@ -1708,7 +1749,6 @@ end
|
|
|
256ebe |
|
|
|
256ebe |
|
|
|
256ebe |
|
|
|
256ebe |
-%if 0%{?_can_georeplicate}
|
|
|
256ebe |
%if ( 0%{!?_without_georeplication:1} )
|
|
|
256ebe |
%pretrans geo-replication -p <lua>
|
|
|
256ebe |
if not posix.access("/bin/bash", "x") then
|
|
|
256ebe |
@@ -1749,7 +1789,6 @@ if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
%endif
|
|
|
256ebe |
-%endif
|
|
|
256ebe |
|
|
|
256ebe |
|
|
|
256ebe |
|
|
|
256ebe |
--
|
|
|
256ebe |
1.8.3.1
|
|
|
256ebe |
|