8a0c5c00c8
- drop upstreamed patches - create iucvterm subpackage - update src_vipa locations patch - install cmsfs tools into /sbin - add post 1.8.1 fixes from IBM
185 lines
5.0 KiB
Diff
185 lines
5.0 KiB
Diff
From 263c0e5646ea3c81e570ec7e53c214cac8cb4412 Mon Sep 17 00:00:00 2001
|
|
From: =?utf-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
|
|
Date: Mon, 22 Jun 2009 12:50:08 +0200
|
|
Subject: [PATCH] s390-tools-1.8.1-dumpconf-improve-error-checking
|
|
|
|
Description: dumpconf: Improve parameter checking and error messages.
|
|
Symptom: Ugly and confusing error messages on systems which do not support
|
|
the dump_reipl shutdown action.
|
|
Problem: Error handling is incomplete.
|
|
Solution: The dumpconf init script now validates the syntax of the device
|
|
specified in the config file.
|
|
---
|
|
etc/init.d/dumpconf | 98 +++++++++++++++++++++++++++++++++++----------------
|
|
1 files changed, 67 insertions(+), 31 deletions(-)
|
|
|
|
diff --git a/etc/init.d/dumpconf b/etc/init.d/dumpconf
|
|
index e97f76c..42a2242 100755
|
|
--- a/etc/init.d/dumpconf
|
|
+++ b/etc/init.d/dumpconf
|
|
@@ -119,18 +119,60 @@ verify_ccw_dump_device()
|
|
fi
|
|
}
|
|
|
|
-setup_ccw_device()
|
|
-{
|
|
- echo $DEVICE > $1/ccw/device || RETVAL=1
|
|
+#------------------------------------------------------------------------------
|
|
+# Helper function to check a device string.
|
|
+#------------------------------------------------------------------------------
|
|
+function CheckDeviceString() {
|
|
+ local X
|
|
+
|
|
+ X=$(
|
|
+ echo "$1" |
|
|
+ awk --posix -F. '
|
|
+ function PrintBusID(css, grp, devno) {
|
|
+ while(length(devno) < 4)
|
|
+ devno = "0" devno
|
|
+ print css "." grp "." devno
|
|
+ }
|
|
+ NF == 1 && $1 ~ /^[0-9a-fA-F]{1,4}$/ {
|
|
+ PrintBusID("0","0", $1)
|
|
+ next
|
|
+ }
|
|
+ NF != 3 || $1 !~ /^[0-9a-fA-F]{1,2}$/ {
|
|
+ next
|
|
+ }
|
|
+ $2 !~ /^[0-9a-fA-F]{1,2}$/ {
|
|
+ next
|
|
+ }
|
|
+ $3 !~ /^[0-9a-fA-F]{1,4}$/ {
|
|
+ next
|
|
+ }
|
|
+ {
|
|
+ PrintBusID($1, $2, $3)
|
|
+ }
|
|
+ '
|
|
+ )
|
|
+
|
|
+ if [ "$X" != "" ]; then
|
|
+ echo $X
|
|
+ return 0
|
|
+ fi
|
|
}
|
|
|
|
-setup_fcp_device()
|
|
+setup_device()
|
|
{
|
|
- echo $DEVICE > $1/fcp/device || RETVAL=1
|
|
- echo $WWPN > $1/fcp/wwpn || RETVAL=1
|
|
- echo $LUN > $1/fcp/lun || RETVAL=1
|
|
- echo $BOOTPROG > $1/fcp/bootprog || RETVAL=1
|
|
- echo $BR_LBA > $1/fcp/br_lba || RETVAL=1
|
|
+ DEV="$(CheckDeviceString $DEVICE)"
|
|
+ if [ "$DEV" != "" ]; then
|
|
+ echo $DEV > $1/$DUMP_TYPE/device || RETVAL=1
|
|
+ else
|
|
+ RETVAL=1
|
|
+ echo "ERROR: Invalid device '$DEVICE'" >&2
|
|
+ fi
|
|
+ if [ $DUMP_TYPE == "fcp" ] && [ $RETVAL -eq 0 ]; then
|
|
+ echo $WWPN > $1/fcp/wwpn || RETVAL=1
|
|
+ echo $LUN > $1/fcp/lun || RETVAL=1
|
|
+ echo $BOOTPROG > $1/fcp/bootprog || RETVAL=1
|
|
+ echo $BR_LBA > $1/fcp/br_lba || RETVAL=1
|
|
+ fi
|
|
}
|
|
|
|
setup_nss_device()
|
|
@@ -145,10 +187,8 @@ setup_reipl()
|
|
return
|
|
fi
|
|
|
|
- if [ "$REIPL_TYPE" == "ccw" ]; then
|
|
- setup_ccw_device $REIPL_CONFIG_DIR
|
|
- elif [ "$REIPL_TYPE" == "fcp" ]; then
|
|
- setup_fcp_device $REIPL_CONFIG_DIR
|
|
+ if [ "$REIPL_TYPE" == "ccw" ] || [ "$REIPL_TYPE" == "fcp" ]; then
|
|
+ setup_device $REIPL_CONFIG_DIR
|
|
elif [ "$REIPL_TYPE" == "nss" ]; then
|
|
setup_nss_device $REIPL_CONFIG_DIR
|
|
else
|
|
@@ -169,28 +209,23 @@ setup_reipl()
|
|
|
|
setup_dump()
|
|
{
|
|
- if [ "$DUMP_TYPE" == "ccw" ]; then
|
|
- setup_ccw_device $DUMP_CONFIG_DIR
|
|
- elif [ "$DUMP_TYPE" == "fcp" ]; then
|
|
- setup_fcp_device $DUMP_CONFIG_DIR
|
|
+ if [ "$DUMP_TYPE" == "ccw" ] || [ "$DUMP_TYPE" == "fcp" ]; then
|
|
+ setup_device $DUMP_CONFIG_DIR
|
|
elif [ "$DUMP_TYPE" != "none" ]; then
|
|
echo "ERROR: Unknown dump type '$DUMP_TYPE'" >&2
|
|
RETVAL=1
|
|
fi
|
|
|
|
- echo $DUMP_TYPE > $DUMP_CONFIG_DIR/dump_type || RETVAL=1
|
|
+ if [ $RETVAL -eq 0 ]; then
|
|
+ echo $DUMP_TYPE > $DUMP_CONFIG_DIR/dump_type || RETVAL=1
|
|
+ fi
|
|
|
|
if [ $RETVAL -eq 1 ]; then
|
|
- echo "ERROR: Setup of $DUMP_TYPE dump device failed." >&2
|
|
echo none > $DUMP_CONFIG_DIR/dump_type
|
|
return $RETVAL
|
|
fi
|
|
|
|
- if [ "$CONF_DUMP_TYPE" == "none" ]; then
|
|
- echo "No dump device configured. "
|
|
- else
|
|
- echo "$ON_PANIC on panic configured: Using $DUMP_TYPE dump device."
|
|
- fi
|
|
+ echo "Configuring $ON_PANIC on panic: Using $DUMP_TYPE dump device."
|
|
}
|
|
|
|
setup_on_panic_vmcmd()
|
|
@@ -260,7 +295,7 @@ status_dump()
|
|
echo "type....: fcp"
|
|
print_fcp_device $DUMP_CONFIG_DIR
|
|
else
|
|
- echo "ERROR: Unknown dump device type '$TYPE'!" >&2
|
|
+ echo "ERROR: Unknown dump device type '$CONF_DUMP_TYPE'!" >&2
|
|
echo " Please check if you have the latest dumpconf package!" >&2
|
|
fi
|
|
}
|
|
@@ -316,27 +351,28 @@ start()
|
|
|
|
if [ "$ON_PANIC" == "reipl" ]; then
|
|
setup_reipl
|
|
- elif [ "$ON_PANIC" == "dump" ]; then
|
|
+ elif [ "$ON_PANIC" == "dump" ] || [ "$ON_PANIC" == "dump_reipl" ]; then
|
|
setup_dump
|
|
elif [ "$ON_PANIC" == "vmcmd" ]; then
|
|
setup_on_panic_vmcmd
|
|
- elif [ "$ON_PANIC" == "dump_reipl" ]; then
|
|
- setup_dump
|
|
elif [ "$ON_PANIC" == "stop" ]; then
|
|
echo "stop on panic configured."
|
|
else
|
|
echo "ERROR: Unknown 'on panic' type '$ON_PANIC'" >&2
|
|
RETVAL=1
|
|
fi
|
|
+ if [ $RETVAL -eq 1 ]; then
|
|
+ echo "ERROR: Setup of $DUMP_TYPE dump device failed." >&2
|
|
+ return $RETVAL
|
|
+ fi
|
|
|
|
- echo $ON_PANIC > $ON_PANIC_CONFIG_FILE || RETVAL=1
|
|
+ echo $ON_PANIC > $ON_PANIC_CONFIG_FILE 2> /dev/null || RETVAL=1
|
|
|
|
# check for errors
|
|
|
|
if [ $RETVAL -eq 1 ]; then
|
|
- ERRMSG="\"on panic action\" configuration failed!"
|
|
echo stop > $ON_PANIC_CONFIG_FILE
|
|
- echo "ERROR: $ERRMSG Check $DUMP_CONFIG_FILE!" >&2
|
|
+ echo "ERROR: $ON_PANIC not supported by hardware!" >&2
|
|
return $RETVAL
|
|
fi
|
|
|
|
--
|
|
1.6.0.6
|
|
|