Add error checking to worker_reserved.conf handling
This update add error checking and error handling to worker_reserved.conf update handling. Test Plan: PASS: Verify kickstart logging around worker_reserved update for each of the install cases below. PASS: Verify subcloud install PASS: Verify All In One controller install PASS: Verify worker only install PASS: Verify standard Controller install Closes-Bug: 1999561 Signed-off-by: emacdona <eric.macdonald@windriver.com> Change-Id: I7ccdd9cc02908fcb0fe0a403c2b2141bd44b692a
This commit is contained in:
parent
f96df1e18b
commit
af7defe48f
@ -2373,26 +2373,37 @@ if [ "${aio}" = true ] ; then
|
|||||||
elif [ ${RESERVEDMEM} -gt 8192 ]; then
|
elif [ ${RESERVEDMEM} -gt 8192 ]; then
|
||||||
RESERVEDMEM=8192
|
RESERVEDMEM=8192
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Normally we would set personality based files later
|
# Normally we would set personality based files later
|
||||||
# But we need to copy worker_reserved.conf now since it needs to be modified for AIO
|
# But we need to copy worker_reserved.conf now since it needs to be modified for AIO
|
||||||
cp /usr/share/worker-utils/config/worker_reserved.conf /etc/platform/worker_reserved.conf
|
|
||||||
ilog "${SYSTEM_TYPE__AIO} Reserved Memory: ${RESERVEDMEM}"
|
ilog "${SYSTEM_TYPE__AIO} Reserved Memory: ${RESERVEDMEM}"
|
||||||
sed -i -e "s#\(WORKER_BASE_RESERVED\)=.*#\1=(\"node0:${RESERVEDMEM}MB:1\" \"node1:2000MB:0\" \"node2:2000MB:0\" \"node3:2000MB:0\")#g" /etc/platform/worker_reserved.conf
|
TEMPLATE_FILE="/usr/share/worker-utils/config/worker_reserved.conf"
|
||||||
worker_reserved=$(grep WORKER_BASE_RESERVED /etc/platform/worker_reserved.conf)
|
TARGET_FILE="/etc/platform/worker_reserved.conf"
|
||||||
|
if [ ! -e "${TEMPLATE_FILE}" ] ; then
|
||||||
|
report_failure_with_msg "Cannot configure worker cpu/memory ; missing ${TEMPLATE_FILE}"
|
||||||
|
fi
|
||||||
|
cp "${TEMPLATE_FILE}" "${TARGET_FILE}"
|
||||||
|
if [ ! -e "${TARGET_FILE}" ] ; then
|
||||||
|
report_failure_with_msg "Cannot configure worker cpu/memory ; missing ${TARGET_FILE}"
|
||||||
|
fi
|
||||||
|
sed -i -e "s#\(WORKER_BASE_RESERVED\)=.*#\1=(\"node0:${RESERVEDMEM}MB:1\" \"node1:2000MB:0\" \"node2:2000MB:0\" \"node3:2000MB:0\")#g" "${TARGET_FILE}"
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
report_failure_with_msg "Cannot configure worker cpu/memory ; previous sed search and replace request failed"
|
||||||
|
fi
|
||||||
|
worker_reserved=$(grep WORKER_BASE_RESERVED "${TARGET_FILE}")
|
||||||
ilog "${SYSTEM_TYPE__AIO} '${worker_reserved}'"
|
ilog "${SYSTEM_TYPE__AIO} '${worker_reserved}'"
|
||||||
|
|
||||||
# Update WORKER_CPU_LIST
|
# Update WORKER_CPU_LIST
|
||||||
N_CPUS=$(cat /proc/cpuinfo 2>/dev/null | awk '/^[pP]rocessor/ { n +=1 } END { print (n>0) ? n : 1}')
|
N_CPUS=$(cat /proc/cpuinfo 2>/dev/null | awk '/^[pP]rocessor/ { n +=1 } END { print (n>0) ? n : 1}')
|
||||||
sed -i "s/^WORKER_CPU_LIST=.*/WORKER_CPU_LIST=\"0-$((N_CPUS-1))\"/" /etc/platform/worker_reserved.conf
|
sed -i "s/^WORKER_CPU_LIST=.*/WORKER_CPU_LIST=\"0-$((N_CPUS-1))\"/" "${TARGET_FILE}"
|
||||||
|
|
||||||
worker_cpu_list=$(grep WORKER_CPU_LIST /etc/platform/worker_reserved.conf)
|
worker_cpu_list=$(grep WORKER_CPU_LIST "${TARGET_FILE}")
|
||||||
ilog "${SYSTEM_TYPE__AIO} '${worker_cpu_list}'"
|
ilog "${SYSTEM_TYPE__AIO} '${worker_cpu_list}'"
|
||||||
elif [ "${worker}" = true ] ; then
|
elif [ "${worker}" = true ] ; then
|
||||||
# Keep logic contained and copy worker_reserved.conf now since we need
|
# Keep logic contained and copy worker_reserved.conf now since we need
|
||||||
# to do the copy for AIO above
|
# to do the copy for AIO above
|
||||||
ilog "Enable worker_reserved.conf for ${TRAIT__WORKER}"
|
ilog "Enable ${TARGET_FILE} for ${TRAIT__WORKER}"
|
||||||
cp /usr/share/worker-utils/config/worker_reserved.conf /etc/platform/worker_reserved.conf
|
cp "${TEMPLATE_FILE}" "${TARGET_FILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
true
|
true
|
||||||
|
@ -2541,22 +2541,33 @@ if [ "${aio}" = true ] ; then
|
|||||||
# Normally we would set personality based files later
|
# Normally we would set personality based files later
|
||||||
# But we need to copy worker_reserved.conf now since it needs to be modified for AIO
|
# But we need to copy worker_reserved.conf now since it needs to be modified for AIO
|
||||||
ilog "${SYSTEM_TYPE__AIO} Reserved Memory: ${RESERVEDMEM}"
|
ilog "${SYSTEM_TYPE__AIO} Reserved Memory: ${RESERVEDMEM}"
|
||||||
cp /usr/share/worker-utils/config/worker_reserved.conf /etc/platform/worker_reserved.conf
|
TEMPLATE_FILE="/usr/share/worker-utils/config/worker_reserved.conf"
|
||||||
sed -i -e "s#\(WORKER_BASE_RESERVED\)=.*#\1=(\"node0:${RESERVEDMEM}MB:1\" \"node1:2000MB:0\" \"node2:2000MB:0\" \"node3:2000MB:0\")#g" /etc/platform/worker_reserved.conf
|
TARGET_FILE="/etc/platform/worker_reserved.conf"
|
||||||
worker_reserved=$(grep WORKER_BASE_RESERVED /etc/platform/worker_reserved.conf)
|
if [ ! -e "${TEMPLATE_FILE}" ] ; then
|
||||||
|
report_failure_with_msg "Cannot configure worker cpu/memory ; missing ${TEMPLATE_FILE}"
|
||||||
|
fi
|
||||||
|
cp "${TEMPLATE_FILE}" "${TARGET_FILE}"
|
||||||
|
if [ ! -e "${TARGET_FILE}" ] ; then
|
||||||
|
report_failure_with_msg "Cannot configure worker cpu/memory ; missing ${TARGET_FILE}"
|
||||||
|
fi
|
||||||
|
sed -i -e "s#\(WORKER_BASE_RESERVED\)=.*#\1=(\"node0:${RESERVEDMEM}MB:1\" \"node1:2000MB:0\" \"node2:2000MB:0\" \"node3:2000MB:0\")#g" "${TARGET_FILE}"
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
report_failure_with_msg "Cannot configure worker cpu/memory ; previous sed search and replace request failed"
|
||||||
|
fi
|
||||||
|
worker_reserved=$(grep WORKER_BASE_RESERVED "${TARGET_FILE}")
|
||||||
ilog "${SYSTEM_TYPE__AIO} '${worker_reserved}'"
|
ilog "${SYSTEM_TYPE__AIO} '${worker_reserved}'"
|
||||||
|
|
||||||
# Update WORKER_CPU_LIST
|
# Update WORKER_CPU_LIST
|
||||||
N_CPUS=$(cat /proc/cpuinfo 2>/dev/null | awk '/^[pP]rocessor/ { n +=1 } END { print (n>0) ? n : 1}')
|
N_CPUS=$(cat /proc/cpuinfo 2>/dev/null | awk '/^[pP]rocessor/ { n +=1 } END { print (n>0) ? n : 1}')
|
||||||
sed -i "s/^WORKER_CPU_LIST=.*/WORKER_CPU_LIST=\"0-$((N_CPUS-1))\"/" /etc/platform/worker_reserved.conf
|
sed -i "s/^WORKER_CPU_LIST=.*/WORKER_CPU_LIST=\"0-$((N_CPUS-1))\"/" "${TARGET_FILE}"
|
||||||
|
|
||||||
worker_cpu_list=$(grep WORKER_CPU_LIST /etc/platform/worker_reserved.conf)
|
worker_cpu_list=$(grep WORKER_CPU_LIST "${TARGET_FILE}")
|
||||||
ilog "${SYSTEM_TYPE__AIO} '${worker_cpu_list}'"
|
ilog "${SYSTEM_TYPE__AIO} '${worker_cpu_list}'"
|
||||||
elif [ "${worker}" = true ] ; then
|
elif [ "${worker}" = true ] ; then
|
||||||
# Keep logic contained and copy worker_reserved.conf now since we need
|
# Keep logic contained and copy worker_reserved.conf now since we need
|
||||||
# to do the copy for AIO above
|
# to do the copy for AIO above
|
||||||
ilog "Enable worker_reserved.conf for ${TRAIT__WORKER}"
|
ilog "Enable ${TARGET_FILE} for ${TRAIT__WORKER}"
|
||||||
cp /usr/share/worker-utils/config/worker_reserved.conf /etc/platform/worker_reserved.conf
|
cp "${TEMPLATE_FILE}" "${TARGET_FILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
true
|
true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user