From 7a0a2dac1a566d4a1efd0ff875f77c34a553522a Mon Sep 17 00:00:00 2001 From: Ovidiu Poncea Date: Thu, 30 Jul 2020 13:25:41 +0300 Subject: [PATCH] Fix issues with controller node Anaconda hang On some deployments install fails as we keep one FD open during install. This leads to hangs when Anaconda 'post' stage returns. On other deployments install fails as udev sometimes creates multiple links to the same devices in /dev/disk/by-path. We iterate through this list and, because they are not unique, we try to run flocks multiple times for the same device. Locking a device multiple times doesn't work, the second flock waits for first lock to release. This commit: o removes 'exec {stdout}>&1' from ks-functions.sh so it no longer opens FDs in 'post' stage. For the pre stage we open it only when needed; o makes sure that list of storage devices is unique; o increases timeout of udevadm settle from its default of 180s to 300s, the value used throughout Anaconda. This helps with slower hardware. Closes-Bug: 1889427 Change-Id: I348f10d96a78ea2c1c25fe6cf48462b0bc31fb84 Signed-off-by: Ovidiu Poncea --- bsp-files/kickstarts/functions.sh | 6 +----- bsp-files/kickstarts/pre_disk_setup_common.cfg | 9 +++++++++ bsp-files/kickstarts/pre_disk_setup_tail.cfg | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bsp-files/kickstarts/functions.sh b/bsp-files/kickstarts/functions.sh index 2e3a8711..1b187e15 100644 --- a/bsp-files/kickstarts/functions.sh +++ b/bsp-files/kickstarts/functions.sh @@ -9,13 +9,9 @@ cat </tmp/ks-functions.sh # SPDX-License-Identifier: Apache-2.0 # -# Get the FD used by subshells to log output -if [ -z "\$stdout" ]; then - exec {stdout}>&1 -fi - function wlog() { + [ -z "\$stdout" ] && stdout=1 local dt="\$(date "+%Y-%m-%d %H:%M:%S.%3N")" echo "\$dt - \$1" >&\${stdout} } diff --git a/bsp-files/kickstarts/pre_disk_setup_common.cfg b/bsp-files/kickstarts/pre_disk_setup_common.cfg index 84f5394d..e8c69a3f 100644 --- a/bsp-files/kickstarts/pre_disk_setup_common.cfg +++ b/bsp-files/kickstarts/pre_disk_setup_common.cfg @@ -1,5 +1,8 @@ %pre --erroronfail +# Get the FD used by subshells to log output +exec {stdout}>&1 + # Source common functions . /tmp/ks-functions.sh @@ -56,6 +59,12 @@ for f in /dev/disk/by-path/*; do fi done +# Filter STOR_DEVS variable for any duplicates as on some systems udev +# creates multiple links to the same device. This causes issues due to +# attempting to acquire a flock on the same device multiple times. +STOR_DEVS=$(echo "$STOR_DEVS" | xargs -n 1 | sort -u | xargs) +wlog "Unique storage devices: $STOR_DEVS." + if [ -z "$STOR_DEVS" ] then report_pre_failure_with_msg "ERROR: No storage devices available." diff --git a/bsp-files/kickstarts/pre_disk_setup_tail.cfg b/bsp-files/kickstarts/pre_disk_setup_tail.cfg index f11cdd37..7bd0af2c 100644 --- a/bsp-files/kickstarts/pre_disk_setup_tail.cfg +++ b/bsp-files/kickstarts/pre_disk_setup_tail.cfg @@ -13,7 +13,7 @@ do exec {fd}>&- done sleep 2 -udevadm settle || report_pre_failure_with_msg "ERROR: udevadm settle failed!" +udevadm settle --timeout=300 || report_pre_failure_with_msg "ERROR: udevadm settle failed!" # Rescan LVM cache to avoid warnings for VGs that were recreated. pvscan --cache