Workaround for 4.18.0-305.45.1 OpenShift kernel
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
3df37198ca
commit
52279d257e
@ -6,14 +6,51 @@
|
|||||||
|
|
||||||
. $(dirname $3)/conf_framework.sh
|
. $(dirname $3)/conf_framework.sh
|
||||||
|
|
||||||
# RHEL8.5 kernel 4.18 subversion targeted for the workaround is 348.7.1.
|
# Check whether version A is the same as (or newer than) version B.
|
||||||
# The workaround is needed starting this version and up.
|
#
|
||||||
QUEUE_PUT_WA_LINUX_MAJOR_SINCE=4
|
# Version consists of three elements: major, minor and sub.
|
||||||
QUEUE_PUT_WA_LINUX_MINOR_SINCE=18
|
# The last argument (GT_LVL) tells at which level it is acceptable
|
||||||
QUEUE_PUT_WA_LINUX_SUB_SINCE=0
|
# for version A to be newer than B. It can be "major", "minor", "sub"
|
||||||
QUEUE_PUT_WA_RHEL_MAJOR_SINCE=348
|
# or unspecified.
|
||||||
QUEUE_PUT_WA_RHEL_MINOR_SINCE=7
|
# - For GT_LVL="major" used, then all versions that are newer than B
|
||||||
QUEUE_PUT_WA_RHEL_SUB_SINCE=1
|
# are accepted.
|
||||||
|
# - For GT=LVL="minor" only versions that are newer and have the same
|
||||||
|
# major number.
|
||||||
|
# - For GT_LVL="sub" only version that are newer and have the same major
|
||||||
|
# and minor number are accepted.
|
||||||
|
# - For GT_LVL unspecified version A needs to be exactly the same as
|
||||||
|
# version B.
|
||||||
|
compare_version () {
|
||||||
|
MAJOR_A=$1
|
||||||
|
MINOR_A=$2
|
||||||
|
SUB_A=$3
|
||||||
|
MAJOR_B=$4
|
||||||
|
MINOR_B=$5
|
||||||
|
SUB_B=$6
|
||||||
|
GT_LVL=$7
|
||||||
|
if [ "$MAJOR_A" -eq "$MAJOR_B" ]; then
|
||||||
|
if [ "$MINOR_A" -eq "$MINOR_B" ]; then
|
||||||
|
if [ "$SUB_A" -eq "$SUB_B" ]; then
|
||||||
|
return 0
|
||||||
|
elif [ -n "$GT_LVL" ] && [ "$SUB_A" -gt "$SUB_B" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
elif [ "$GT_LVL" = "major" -o "$GT_LVL" = "minor" ] &&
|
||||||
|
[ "$MINOR_A" -gt "$MINOR_B" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
elif [ "$GT_LVL" = "major" ] && [ "$MAJOR_A" -gt "$MAJOR_B" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
compare_kernel_version () {
|
||||||
|
compare_version $1 $2 $3 $LINUX_MAJOR $LINUX_MINOR $LINUX_SUB $4
|
||||||
|
}
|
||||||
|
compare_rhel_kernel_version () {
|
||||||
|
compare_version $1 $2 $3 $RHEL_MAJOR $RHEL_MINOR $RHEL_SUB $4
|
||||||
|
}
|
||||||
|
|
||||||
check () {
|
check () {
|
||||||
cur_name=$(basename $2)
|
cur_name=$(basename $2)
|
||||||
@ -24,9 +61,7 @@ check () {
|
|||||||
LINUX_MINOR=$((LINUX_VERSION_CODE >> 8 & 0xff))
|
LINUX_MINOR=$((LINUX_VERSION_CODE >> 8 & 0xff))
|
||||||
LINUX_SUB=$((LINUX_VERSION_CODE & 0xff))
|
LINUX_SUB=$((LINUX_VERSION_CODE & 0xff))
|
||||||
|
|
||||||
if [ -z $RHEL_RELEASE ]; then
|
if [ -n $RHEL_RELEASE ]; then
|
||||||
echo $cur_name "2" >> $config_file_path; #not RHEL, no workaround needed
|
|
||||||
else
|
|
||||||
#it's RHEL, check versions to see if the workaround is needed
|
#it's RHEL, check versions to see if the workaround is needed
|
||||||
|
|
||||||
IFS=. read -a arr <<< $RHEL_RELEASE
|
IFS=. read -a arr <<< $RHEL_RELEASE
|
||||||
@ -34,32 +69,21 @@ check () {
|
|||||||
RHEL_MINOR="${arr[1]:=0}"
|
RHEL_MINOR="${arr[1]:=0}"
|
||||||
RHEL_SUB="${arr[2]:=0}"
|
RHEL_SUB="${arr[2]:=0}"
|
||||||
|
|
||||||
#check kernel and rhel version (major/minor/sub)
|
#check linux kernel version
|
||||||
if [ "$LINUX_MAJOR" -eq "$QUEUE_PUT_WA_LINUX_MAJOR_SINCE" ] &&
|
if compare_kernel_version 4 18 0; then
|
||||||
[ "$LINUX_MINOR" -eq "$QUEUE_PUT_WA_LINUX_MINOR_SINCE" ] &&
|
#check rhel kernel version
|
||||||
[ "$LINUX_SUB" -eq "$QUEUE_PUT_WA_LINUX_SUB_SINCE" ];
|
if compare_rhel_kernel_version 305 45 1 "minor"; then
|
||||||
then
|
|
||||||
if [ "$RHEL_MAJOR" -gt "$QUEUE_PUT_WA_RHEL_MAJOR_SINCE" ]; then
|
|
||||||
echo $cur_name "1" >> $config_file_path; #workaround needed
|
echo $cur_name "1" >> $config_file_path; #workaround needed
|
||||||
elif [ "$RHEL_MAJOR" -lt "$QUEUE_PUT_WA_RHEL_MAJOR_SINCE" ]; then
|
return
|
||||||
echo $cur_name "2" >> $config_file_path; #no workaround needed
|
fi
|
||||||
else
|
|
||||||
if [ "$RHEL_MINOR" -gt "$QUEUE_PUT_WA_RHEL_MINOR_SINCE" ]; then
|
if compare_rhel_kernel_version 348 7 1 "major"; then
|
||||||
echo $cur_name "1" >> $config_file_path; #workaround needed
|
echo $cur_name "1" >> $config_file_path; #workaround needed
|
||||||
elif [ "$RHEL_MINOR" -lt "$QUEUE_PUT_WA_RHEL_MINOR_SINCE" ]; then
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
echo $cur_name "2" >> $config_file_path; #no workaround needed
|
echo $cur_name "2" >> $config_file_path; #no workaround needed
|
||||||
else
|
|
||||||
if [ "$RHEL_SUB" -ge "$QUEUE_PUT_WA_RHEL_SUB_SINCE" ]; then
|
|
||||||
echo $cur_name "1" >> $config_file_path; #workaround needed
|
|
||||||
else
|
|
||||||
echo $cur_name "2" >> $config_file_path; #no workaround needed
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo $cur_name "2" >> $config_file_path; #no workaround needed
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply() {
|
apply() {
|
||||||
|
Loading…
Reference in New Issue
Block a user