From 5f3bc2ce7cb8579075bcaaca60bb15b2b037fa85 Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Wed, 17 May 2023 05:17:24 -0400 Subject: [PATCH] LU-16834 obdfilter: Do not attach device if already present Running obdfilter-survey where "case=disk" and targets are repeated with same OST's names. obdfilter-survey throws "error: attach: File exists". This is because the on the first iteration the attach and setup is already done and subsequently the attach fails as the device/uuid is already present. Test-Parameters: trivial testlist=obdfilter-survey Signed-off-by: Arshad Hussain Change-Id: I8ab9ea905ec86b9e1aa8906bebcc38fee0fdbc23 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51034 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell Reviewed-by: Timothy Day Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- lustre-iokit/obdfilter-survey/iokit-libecho | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lustre-iokit/obdfilter-survey/iokit-libecho b/lustre-iokit/obdfilter-survey/iokit-libecho index b60eaeb..8376388 100644 --- a/lustre-iokit/obdfilter-survey/iokit-libecho +++ b/lustre-iokit/obdfilter-survey/iokit-libecho @@ -278,11 +278,15 @@ get_ec_devno () { exit 1 fi client_name=${ost_name}_ecc - remote_shell $host \ - "$lctl <<-EOF - attach echo_client $client_name ${client_name}_UUID - setup $ost_name $stack_type - EOF" + # Only 'attach' if '{client_name}_uuid' not already present + if ! [[ $(lctl dl) =~ $client_name ]]; then + remote_shell $host \ + "$lctl <<-EOF + attach echo_client $client_name \ + ${client_name}_UUID + setup $ost_name $stack_type + EOF" + fi ec=$(get_devno $host echo_client $client_name) if [ -z "$ec" ]; then echo "Can't setup echo-client" -- 1.8.3.1