Patchwork [BRANCH:release-3.1,BUG:2904] build : with rpm install invoke glusterd upgrade option to modify vol files and start

login
register
Submitter Lakshmipathi
Date 2011-06-17 12:24:58
Message ID <20110617122458.GA12843@shell.gluster.com>
Download mbox | patch
Permalink /patch/7542/
State Accepted
Headers show

Comments

Lakshmipathi - 2011-06-17 12:24:58
Signed-off-by: Lakshmipathi.G <lakshmipathi@gluster.com>
---
 glusterfs.spec.in |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

Patch

diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 6fffc02..f3ce5eb 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -141,10 +141,28 @@  find %{buildroot}%{_libdir} -name '*.a' | xargs rm -f
 echo "%{_prefix}/lib64" > /etc/ld.so.conf.d/glusterfs.conf
 /sbin/ldconfig
 
+if [ -d /etc/glusterd/vols ]; then
+#for each dir under vols, backup non-fuse .vol files  as .Vol.old
+for file in `find /etc/glusterd/vols -type f ! -name *-fuse.vol`;
+do
+grep ".vol" $file &> /dev/null && fname=`basename $file .vol` && dname=`dirname $file` && cp $file $dname/$fname.Vol.old
+done
+fi
+
 pidof -c -o %PPID -x glusterd &> /dev/null
 if [ $? -eq 0 ];
 then
+killall glusterd &> /dev/null
+#add marker translator
+glusterd --xlator-option *.upgrade=on
+sleep 10
+killall glusterd  &> /dev/null
+#start glusterd normally.
 /etc/init.d/glusterd restart &> /dev/null
+else
+glusterd --xlator-option *.upgrade=on
+sleep 10
+killall glusterd &> /dev/null
 fi
 
 %postun core