Whamcloud - gitweb
LU-16834 obdfilter: Do not attach device if already present 34/51034/5
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Wed, 17 May 2023 09:17:24 +0000 (05:17 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 13 Sep 2023 04:02:37 +0000 (04:02 +0000)
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 <arshad.hussain@aeoncomputing.com>
Change-Id: I8ab9ea905ec86b9e1aa8906bebcc38fee0fdbc23
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51034
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre-iokit/obdfilter-survey/iokit-libecho

index b60eaeb..8376388 100644 (file)
@@ -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"