done
}
+#######################################################################
+# Service management routines
+#######################################################################
+prepare_service() {
+ local label service
+
+ service=$1
+ label=$2
+
+ flags=$(get_value flags ${service})
+ echo $flags | grep -q 'r' || return 0
+ echo $flags | grep -q 'R' && return 0
+
+ service clone $label
+ return 1
+}
+
+cleanup_service() {
+ local label
+
+ label=$1
+
+ service unclone $label
+}
+
#######################################################################
# POLICY: restart
#######################################################################
endpoint_post=$(get_value endpoint ${service})
if [ ${restarts_post} -gt ${restarts_pre} \
- -a ${endpoint_post} -eq ${endpoint_pre} ]
+ -a ${endpoint_post} -eq ${endpoint_pre} ]
then
echo ok
else
# is a slight chance that it will actualy stay the same, and fail
# the test.
if [ ${restarts_post} -gt ${restarts_pre} \
- -a ${endpoint_post} -ne ${endpoint_pre} ]
+ -a ${endpoint_post} -ne ${endpoint_pre} ]
then
echo ok
else
}
#######################################################################
-# Live update test
+# Live update tests
#######################################################################
lu_test_one() {
local label=$1
service ${lu_opts} update ${prog} -label ${label} -maxtime ${lu_maxtime} -state ${lu_state}
if [ $? -ne $result ]
then
- echo not ok
return 1
else
return 0
endpoint_pre=$(get_value endpoint ${service})
lu_test_one ${label} self 0 || return
- if ! echo "vm pm vfs rs" | grep -q ${label}
+
+ # Test live update "prepare only"
+ if ! echo "pm rs vfs vm" | grep -q ${label}
then
lu_opts="-o" lu_test_one ${label} self 0 || return
fi
- lu_opts="-x" lu_test_one ${label} self 200 || return
- if ! echo "rs" | grep -q ${label}
+
+ # Test live update initialization crash
+ if ! echo "vm" | grep -q ${label}
+ then
+ lu_opts="-x" lu_test_one ${label} self 200 || return
+ fi
+
+ # Test live update initialization failure
+ if ! echo "rs vm" | grep -q ${label}
then
lu_opts="-y" lu_test_one ${label} self 78 || return
+ fi
+
+ # Test live update initialization timeout
+ if ! echo "rs vm" | grep -q ${label}
+ then
lu_maxtime="1HZ" lu_opts="-z" lu_test_one ${label} self 4 || return
fi
+
+ # Test live update from SEF_LU_STATE_EVAL state
lu_maxtime="1HZ" lu_state="5" lu_test_one ${label} self 4 || return
restarts_post=$(get_value restarts ${service})
# Make sure endpoint and restarts are preserved
if [ ${restarts_post} -eq ${restarts_pre} \
- -a ${endpoint_post} -eq ${endpoint_pre} ]
+ -a ${endpoint_post} -eq ${endpoint_pre} ]
then
echo ok
else
local labels="$*"
local ret=0
local index=0
- local once_index=1
+ local once_index=2
+ local force_unsafe=""
lu_opts=${lu_opts:-}
lu_maxtime=${lu_maxtime:-3HZ}
for label in ${labels}
do
+ index=`expr $index + 1`
+ force_unsafe=""
+
+ if [ "x$label" = "xvm" ]
+ then
+ # VM doesn't support safe LU, nor rollbacks for now
+ force_unsafe="-u"
+
+ if echo "${lu_opts_once}" | grep -q -E -- '-(x|y|z)'
+ then
+ continue
+ fi
+ fi
+
if [ $index -eq $once_index ]
then
- service ${lu_opts_once} -q update self -label ${label} -maxtime ${lu_maxtime_once} -state ${lu_state_once} || ret=1
+ service ${lu_opts_once} ${force_unsafe} -q update self -label ${label} -maxtime ${lu_maxtime_once} -state ${lu_state_once} || ret=1
else
- service ${lu_opts} -q update self -label ${label} -maxtime ${lu_maxtime} -state ${lu_state} || ret=1
+ service ${lu_opts} ${force_unsafe} -q update self -label ${label} -maxtime ${lu_maxtime} -state ${lu_state} || ret=1
fi
- index=`expr $index + 1`
done
service sysctl upd_run
if [ $? -ne $result ]
echo ok
}
-#######################################################################
-# Service management routines
-#######################################################################
-prepare_service() {
- local label service
-
- service=$1
- label=$2
-
- flags=$(get_value flags ${service})
- echo $flags | grep -q 'r' || return 0
- echo $flags | grep -q 'R' && return 0
-
- service clone $label
- return 1
-}
-
-cleanup_service() {
- local label
-
- label=$1
-
- service unclone $label
-}
-
#######################################################################
# main()
#######################################################################