Ticket #41 (new bugs)

Opened 13 years ago

Last modified 13 years ago

srm init-script does not mount pnfs

Reported by: hauki Owned by: omsynge
Priority: major Milestone:
Component: core Keywords:
Cc: Sub Version:

Description

For the command srmls to work, the pnfs must be mounted on the srm-door. The srm-only init-script /opt/d-cache/bin/dcache-srm has no support for mounting pnfs, thus the command fails.

Following path (basically code-replicatino from dcache-core) fixes it.

Cheers, Christof

--- /opt/d-cache/bin/dcache-srm 2008-01-07 11:02:46.000000000 +0200 +++ /etc/init.d/dcache-srm 2008-01-07 10:57:58.000000000 +0200 @@ -17,8 +17,58 @@

export JAVA_OPTS export CATALINA_HOME=${TOMCAT_BASE_PATH}/apache-tomcat-5.5.20

+# ----------------------------------------------------------------- +# Checking node_config (and door_config) +# ----------------------------------------------------------------- + +printConfig() { + key=$1 + cat ${ourHomeDir}/etc/node_config + ${ourHomeDir}/etc/door_config 2>/dev/null | + perl -e " + while (<STDIN>) { + s/#.*$ ; # Remove comments + s/s*$ ; # Remove trailing space + if ( s/s*${key}s*=*s*i ) { # Remove key and equals + print; # Print if key found + last; # Only use first appearance + } + } + " +} + +PNFS_ROOT=printConfig PNFS_ROOT +SERVER_ID=printConfig SERVER_ID +if [ -z "${SERVER_ID}" ] ; then + SERVER_ID=hostname -d 2>/dev/null + if [ $? -ne 0 -o -z "${SERVER_ID}" ] ; then + SERVER_ID="cat /etc/resolv.conf | sed -e 's/#.*$//' | grep 'search' | awk '{ print($2) }'" + if [ -z "${SERVER_ID}" ]; then + SERVER_ID="cat /etc/resolv.conf | sed -e 's/#.*$//' | grep 'domain' | awk '{ print($2) }'" + fi + fi +fi + +

case $cmd1 in

start)

+ cp=df ${PNFS_ROOT}/${SERVER_ID} 2>/dev/null |grep "${PNFS_ROOT}" | awk '{print $2}' + if [ -z $cp ]; then + ADMIN_NODE=printConfig ADMIN_NODE + if [ -z "$ADMIN_NODE" -o "$ADMIN_NODE" = myAdminNode ] ; then + echo "[ERROR] pnfs not mounted on ${PNFS_ROOT}/${SERVER_ID}/ and ADMIN_NODE" + echo " in etc/node_config or etc/door_config not set properly. Exiting." + exit 1 + fi + echo "${PNFS_ROOT}/${SERVER_ID}/ not mounted - going to mount it now ... " + mount -o intr,rw,noac,hard,nfsvers=2 $ADMIN_NODE:/pnfsdoors ${PNFS_ROOT}/${SERVER_ID} + cp=df ${PNFS_ROOT}/${SERVER_ID} 2>/dev/null |grep "${PNFS_ROOT}" | awk '{print $2}' + if [ -z $cp ]; then + echo "[ERROR] Still not mounted. Apparently no pnfs server running on admin" + echo " node $ADMIN_NODE. Exiting." + exit 1 + fi + fi

${TOMCAT_BASE_PATH}/apache-tomcat-5.5.20/bin/startup.sh RETVAL=$? echo

Change History

comment:1 Changed 13 years ago by hauki

Well, here's a more readable version....

--- /opt/d-cache/bin/dcache-srm 2008-01-07 11:02:46.000000000 +0200
+++ /etc/init.d/dcache-srm      2008-01-07 10:57:58.000000000 +0200
@@ -17,8 +17,58 @@
 export JAVA_OPTS
 export CATALINA_HOME=${TOMCAT_BASE_PATH}/apache-tomcat-5.5.20

+#  -----------------------------------------------------------------
+#      Checking node_config (and door_config)
+#  -----------------------------------------------------------------
+
+printConfig() {
+    key=$1
+    cat ${ourHomeDir}/etc/node_config 
+        ${ourHomeDir}/etc/door_config 2>/dev/null |
+    perl -e "
+      while (<STDIN>) {
+         s/#.*$// ;                        # Remove comments
+         s/s*$// ;                         # Remove trailing space
+         if ( s/^s*${key}s*=*s*//i ) {   # Remove key and equals
+            print;                          # Print if key found
+            last;                           # Only use first appearance
+         }
+      }
+    "
+}
+
+PNFS_ROOT=`printConfig PNFS_ROOT`
+SERVER_ID=`printConfig SERVER_ID`
+if [ -z "${SERVER_ID}" ] ; then
+    SERVER_ID=`hostname -d 2>/dev/null`
+    if [ $? -ne 0 -o -z "${SERVER_ID}" ] ; then
+        SERVER_ID="`cat /etc/resolv.conf | sed -e 's/#.*$//' | grep 'search' |
awk '{ print($2) }'`"
+        if [ -z "${SERVER_ID}" ]; then
+            SERVER_ID="`cat /etc/resolv.conf | sed -e 's/#.*$//' | grep 'domain
' | awk '{ print($2) }'`"
+        fi
+    fi
+fi
+
+
 case $cmd1 in
   start)
+       cp=`df ${PNFS_ROOT}/${SERVER_ID} 2>/dev/null |grep "${PNFS_ROOT}" | awk
'{print $2}'`
+       if [ -z $cp ]; then
+               ADMIN_NODE=`printConfig ADMIN_NODE`
+               if [ -z "$ADMIN_NODE" -o "$ADMIN_NODE" = myAdminNode ] ; then
+                   echo "[ERROR] pnfs not mounted on ${PNFS_ROOT}/${SERVER_ID}/ and ADMIN_NODE"
+                    echo "        in etc/node_config or etc/door_config not set properly. Exiting."
+                   exit 1
+               fi
+               echo "${PNFS_ROOT}/${SERVER_ID}/ not mounted - going to mount it now ... "
+               mount -o intr,rw,noac,hard,nfsvers=2 $ADMIN_NODE:/pnfsdoors ${PNFS_ROOT}/${SERVER_ID}
+               cp=`df ${PNFS_ROOT}/${SERVER_ID} 2>/dev/null |grep "${PNFS_ROOT}" | awk '{print $2}'`
+               if [ -z $cp ]; then
+                   echo "[ERROR] Still not mounted. Apparently no pnfs server running on admin"
+                    echo "        node $ADMIN_NODE. Exiting."
+                   exit 1
+               fi
+       fi
         ${TOMCAT_BASE_PATH}/apache-tomcat-5.5.20/bin/startup.sh
         RETVAL=$?
         echo

comment:2 Changed 13 years ago by hauki

In addition, the script dcache-core does not mount pnfs on a srm-only node as well, here's a patch to do that:

--- /opt/d-cache/bin/dcache-core        2007-11-19 10:16:02.000000000 +0200
+++ dcache-core 2008-01-08 07:40:06.000000000 +0200
@@ -124,7 +124,7 @@
                        echo "        Make sure pnfs is running on this admin node. Exiting."
                        exit 1
                    fi
-               elif [ "`printConfig GRIDFTP`" = yes -o "`printConfig GRIDFTP`" = y ] ; then
+               elif [ "`printConfig GRIDFTP`" = yes -o "`printConfig GRIDFTP`" = y -o "`printConfig SRM`" = yes -o "`printConfig SRM`" = y ] ; then

                    cp=`df ${PNFS_ROOT}/${SERVER_ID} 2>/dev/null |grep "${PNFS_ROOT}" | awk '{print $2}'`
                    if [ -z $cp ]; then
Note: See TracTickets for help on using tickets.