File lio-utils-init-script-restore-config.patch of Package lio-utils.10501
---
scripts/rc.target.suse | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- a/scripts/rc.target.suse
+++ b/scripts/rc.target.suse
@@ -45,6 +45,8 @@ SEMA_TARGET="/var/crash/target.fault"
CONFIGFS_SCRIPT_DIR="/etc/target"
TCM_CONFIGFS_SCRIPT="/etc/target/tcm_start.sh"
LIO_CONFIGFS_SCRIPT="/etc/target/lio_start.sh"
+TARGETCLI="/usr/bin/targetcli"
+SAVECONFIG="/etc/target/saveconfig.json"
#########################################################################
# Allows saving command & arguments into a file for subsequent debugging
@@ -161,6 +163,16 @@ function run_tcm_cfs_ops() {
run_lio_target_cfs_ops
run_fabric_cfs_ops
+ # restore config from savefile
+ if [ -x $TARGETCLI -a -r $SAVECONFIG ]; then
+ echo -n $"Restoring configuration from $SAVECONFIG: "
+ ${TARGETCLI} restoreconfig clear_existing=true savefile=${SAVECONFIG} > /dev/null 2>&1
+ RET=$?
+ if [ $RET != 0 ]; then
+ rc_failed 1
+ fi
+ rc_status -v
+ fi
}
function check_configfs_mount() {