Bug 824231

Summary: move working directory of glusterd from '/etc/glusterd' to '/var/lib/glusterd'
Product: [Community] GlusterFS Reporter: Amar Tumballi <amarts>
Component: glusterdAssignee: Raghavendra Bhat <rabhat>
Status: CLOSED CURRENTRELEASE QA Contact: Ujjwala <ujjwala>
Severity: high Docs Contact:
Priority: medium    
Version: mainlineCC: gluster-bugs, rabhat, sdharane, ujjwala, vraman
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-3.4.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-24 17:11:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Amar Tumballi 2012-05-23 03:24:22 UTC
Description of problem:
Currently, for release-3.3 branch and on master branch, if one installs GlusterFS using RPMs, the working directory will become /var/lib/glusterd, but not in case of source install (and other distro installs). It makes sense to keep all type of install behave same.

Version-Release number of selected component (if applicable):
release-3.3/master

Comment 1 Amar Tumballi 2012-05-30 05:07:01 UTC
http://review.gluster.com/3479 fixes it in release-3.3, http://review.gluster.com/3338 is queued up for master.

Comment 2 Ujjwala 2012-06-01 12:10:28 UTC
Did source install from 3.3.0 qa41 to 3.3.0 community release. The working directory is moved from /etc/glusterd to /var/lib/glusterd.

Comment 3 Raghavendra Bhat 2012-06-08 14:13:21 UTC
The migration of /etc/glusterd to /var/lib/glusterd is smooth when source installation is done. Whereas if the upgrade is rpm upgrade (in my case 3.2.6 to 3.3.0), is failing with following o/p.

[root@gqas009 final]# rpm -Uvh glusterfs-server-3.3.0-1.x86_64.rpm
warning: glusterfs-server-3.3.0-1.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID cae81a29: NOKEY
Preparing...                ########################################### [100%]
   1:glusterfs-server       ########################################### [100%]
mv: cannot move `/etc/glusterd' to `/var/lib/glusterd': Directory not empty


Reason:
When 3.3.0 packages are being installed when new (3.3.0)glusterd is started it sees that there is no /var/lib/glusterd and creates them.

Since /var/lib/glusterd is already there this part of the upgrade script fails.


# Move legacy sysconf files to the correct sysconfdir
if [ -d /etc/glusterd ]; then
    mkdir -p /var/lib
    mv /etc/glusterd /var/lib/
    ln -sf /var/lib/glusterd /etc/glusterd
fi


Above it tries to move /etc/glusterd to /var/lib, finds non-empty glusterd directory (created by glusterd process) and errors out without upgrading.

The below changes to the spec files fixes the issue.

git branch
  master
* release-3.3
[root@gqas009 glusterfs.git]# git diff
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index c425e06..412b3fb 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -305,7 +305,8 @@ fi
 # Move legacy sysconf files to the correct sysconfdir
 if [ -d /etc/glusterd ]; then
     mkdir -p /var/lib
-    mv /etc/glusterd /var/lib/
+    cp -a /etc/glusterd /var/lib/;
+    rm -rf /etc/glusterd
     ln -sf /var/lib/glusterd /etc/glusterd
 fi

[root@gqas009 glusterfs.git]#

Comment 4 Amar Tumballi 2012-06-12 05:30:11 UTC
this will make it to 3.3.1

Comment 5 Vijay Bellur 2012-07-03 12:02:53 UTC
CHANGE: http://review.gluster.com/3512 (mount.glusterfs: update the glusterd WORKDIR) merged in release-3.3 by Vijay Bellur (vijay)

Comment 6 Amar Tumballi 2012-07-04 09:17:46 UTC
http://review.gluster.com/3548 got pushed to upstream as part of bug 230218