resource-agents: master - rgmanager: Minor cleanups for file system agents

Fabio M. Di Nitto fabbione at fedoraproject.org
Tue Jul 6 03:50:56 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a=commitdiff;h=53c9f50ebe210a63c74f11184d3023992ed88f31
Commit:        53c9f50ebe210a63c74f11184d3023992ed88f31
Parent:        e642cd87a7cc5455b398b017a33455decd77bbbb
Author:        Lon Hohberger <lhh at redhat.com>
AuthorDate:    Tue Apr 20 18:52:05 2010 -0400
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Tue Jul 6 05:39:49 2010 +0200

rgmanager: Minor cleanups for file system agents

- don't double-check if the mount point exists; once
  is enough
- report an error if creation of the mount point fails

Resolves: rhbz#581533

Signed-off-by: Lon Hohberger <lhh at redhat.com>
---
 rgmanager/src/resources/clusterfs.sh |   22 +++++++---------------
 rgmanager/src/resources/fs.sh.in     |   20 ++++++--------------
 rgmanager/src/resources/netfs.sh     |    8 +++++++-
 3 files changed, 20 insertions(+), 30 deletions(-)

diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh
index bb0acfd..f90f865 100644
--- a/rgmanager/src/resources/clusterfs.sh
+++ b/rgmanager/src/resources/clusterfs.sh
@@ -534,7 +534,13 @@ startFilesystem: Mount point $mp exists but is not a directory"
 	else
 		ocf_log info "\
 startFilesystem: Creating mount point $mp for device $dev"
-		mkdir -p $mp
+		mkdir -p "$mp"
+		ret_val=$?
+		if [ $ret_val -ne 0 ]; then
+			ocf_log err "\
+startFilesystem: Unable to create $mp.  Error code: $ret_val"
+			return $OCF_ERR_GENERIC
+		fi
 	fi
 
 	#
@@ -593,20 +599,6 @@ Cannot mount $dev on $mp, the device or mount point is already in use!"
 	esac
 
 	#
-	# Make sure the mount point exists.
-	#
-	if [ ! -d $mp ]; then
-		rm -f $mp			# rm in case its a plain file
-		mkdir -p $mp			# create the mount point
-		ret_val=$?
-		if [ $ret_val -ne 0 ]; then
-			ocf_log err \
-				"'mkdir -p $mp' failed, error=$ret_val"
-			return $FAIL
-		fi
-	fi
-
-	#
 	# Get the mount options, if they exist.
 	#
 	mount_options=""
diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
index 5a6348b..ffa721f 100644
--- a/rgmanager/src/resources/fs.sh.in
+++ b/rgmanager/src/resources/fs.sh.in
@@ -816,6 +816,12 @@ startFilesystem: Mount point $mp exists but is not a directory"
 		ocf_log err "\
 startFilesystem: Creating mount point $mp for device $dev"
 		mkdir -p "$mp"
+		ret_val=$?
+		if [ $ret_val -ne 0 ]; then
+			ocf_log err "\
+startFilesystem: Unable to create $mp.  Error code: $ret_val"
+			return $OCF_ERR_GENERIC
+		fi
 	fi
 
 	#
@@ -874,20 +880,6 @@ Cannot mount $dev on $mp, the device or mount point is already in use!"
 	esac
 
 	#
-	# Make sure the mount point exists.
-	#
-	if [ ! -d $mp ]; then
-		rm -f $mp			# rm in case its a plain file
-		mkdir -p $mp			# create the mount point
-		ret_val=$?
-		if [ $ret_val -ne 0 ]; then
-			ocf_log err \
-				"'mkdir -p $mp' failed, error=$ret_val"
-			return $FAIL
-		fi
-	fi
-
-	#
 	# Get the mount options, if they exist.
 	#
 	mount_options=""
diff --git a/rgmanager/src/resources/netfs.sh b/rgmanager/src/resources/netfs.sh
index b85027a..bb749f7 100644
--- a/rgmanager/src/resources/netfs.sh
+++ b/rgmanager/src/resources/netfs.sh
@@ -386,7 +386,13 @@ startFilesystem: Mount point $mp exists but is not a directory"
 	else
 		ocf_log info "\
 startFilesystem: Creating mount point $mp for $fullpath"
-		mkdir -p $mp
+		mkdir -p "$mp"
+		ret_val=$?
+		if [ $ret_val -ne 0 ]; then
+			ocf_log err "\
+startFilesystem: Unable to create $mp.  Error code: $ret_val"
+			return $OCF_ERR_GENERIC
+		fi
 	fi
 
 	#


More information about the cluster-commits mailing list