"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-6.9/tests/basic/afr/add-brick-self-heal.t" (23 Apr 2020, 2890 Bytes) of package /linux/misc/glusterfs-6.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 . $(dirname $0)/../../include.rc
    3 . $(dirname $0)/../../volume.rc
    4 cleanup;
    5 
    6 TEST glusterd
    7 TEST pidof glusterd
    8 TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
    9 EXPECT 'Created' volinfo_field $V0 'Status';
   10 TEST $CLI volume start $V0
   11 EXPECT 'Started' volinfo_field $V0 'Status';
   12 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
   13 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1
   14 
   15 TEST $CLI volume set $V0 cluster.data-self-heal off
   16 TEST $CLI volume set $V0 cluster.metadata-self-heal off
   17 TEST $CLI volume set $V0 cluster.entry-self-heal off
   18 TEST $CLI volume set $V0 cluster.heal-timeout 5
   19 
   20 TEST $CLI volume set $V0 self-heal-daemon off
   21 TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0;
   22 
   23 # Create files
   24 for i in {1..5}
   25 do
   26         echo $i > $M0/file$i.txt
   27 done
   28 
   29 # Metadata changes
   30 TEST setfattr -n user.test -v qwerty $M0/file5.txt
   31 
   32 # Add brick1
   33 TEST $CLI volume add-brick $V0 replica 3 $H0:$B0/${V0}2
   34 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2
   35 
   36 # New-brick should accuse the old-bricks (Simulating case for data-loss)
   37 TEST setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/${V0}2/
   38 TEST setfattr -n trusted.afr.$V0-client-1 -v 0x000000000000000000000001 $B0/${V0}2/
   39 
   40 # Check if pending xattr and dirty-xattr are set for newly-added-brick
   41 EXPECT "000000000000000100000001" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}0
   42 EXPECT "000000000000000100000001" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}1
   43 EXPECT "000000000000000000000001" get_hex_xattr trusted.afr.dirty $B0/${V0}2
   44 
   45 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
   46 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 1
   47 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 2
   48 
   49 TEST $CLI volume set $V0 self-heal-daemon on
   50 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
   51 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
   52 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
   53 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 2
   54 TEST $CLI volume heal $V0
   55 
   56 # Wait for heal to complete
   57 EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
   58 
   59 # Check if entry-heal has happened
   60 TEST diff <(ls $B0/${V0}0 | sort) <(ls $B0/${V0}2 | sort)
   61 TEST diff <(ls $B0/${V0}1 | sort) <(ls $B0/${V0}2 | sort)
   62 
   63 # Test if data was healed
   64 TEST diff $B0/${V0}0/file1.txt $B0/${V0}2/file1.txt
   65 
   66 # Test if metadata was healed and exists on both the bricks
   67 EXPECT "qwerty" get_text_xattr user.test $B0/${V0}2/file5.txt
   68 EXPECT "qwerty" get_text_xattr user.test $B0/${V0}0/file5.txt
   69 
   70 EXPECT "000000000000000000000000" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}0
   71 EXPECT "000000000000000000000000" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}1
   72 EXPECT "000000000000000000000000" get_hex_xattr trusted.afr.dirty $B0/${V0}2
   73 
   74 cleanup;