[Ocfs2-tools-devel] [PATCH 05/39] o2cb.init: Store the configured stack name.

Joel Becker joel.becker at oracle.com
Fri Mar 14 16:52:28 PDT 2008


Allow "/etc/init.d/o2cb configure" to ask the name of the cluster stack
to use.  During startup, store that name in sysfs.

Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 vendor/common/o2cb.init.sh |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/vendor/common/o2cb.init.sh b/vendor/common/o2cb.init.sh
index d3075a5..8f4fc6c 100644
--- a/vendor/common/o2cb.init.sh
+++ b/vendor/common/o2cb.init.sh
@@ -314,6 +314,24 @@ EOF
 
     while :
     do
+        echo -n "Cluster stack backing O2CB [$O2CB_STACK]: "
+        read LINE
+        case "$LINE" in
+        "")
+            break
+            ;;
+        ????)
+            O2CB_STACK="$LINE"
+            break
+            ;;
+        *)
+            echo "Invalid answer: $LINE" >&2
+            ;;
+        esac
+    done
+
+    while :
+    do
         echo -n "Cluster to start on boot (Enter \"none\" to clear) [$O2CB_BOOTCLUSTER]: "
         read LINE
         case "$LINE" in
@@ -872,6 +890,7 @@ online_o2cb()
 
 online()
 {
+    CLUSTER_STACK_FILE="/sys/fs/ocfs2/cluster_stack"
     CLUSTER="${1:-${O2CB_BOOTCLUSTER}}"
     if [ -z "$CLUSTER" ]
     then
@@ -886,6 +905,17 @@ online()
         return
     fi
 
+    if [ -f "$CLUSTER_STACK_FILE" ]
+    then
+        echo -n "Setting cluster stack \"$O2CB_STACK\": "
+        echo "$O2CB_STACK" >"$CLUSTER_STACK_FILE" 2>/dev/null
+        if_fail $? "Unable to store cluster stack \"$O2CB_STACK\""
+    elif [ "$O2CB_STACK" != "o2cb" ]
+    then
+        echo -n "Setting cluster stack \"$O2CB_STACK\": "
+        if_fail 1 "Stack \"$O2CB_STACK\" is not supported"
+    fi
+
     online_o2cb "$CLUSTER"
 }
 
-- 
1.5.3.8




More information about the Ocfs2-tools-devel mailing list