Last active
August 4, 2016 16:39
-
-
Save portante/73535a849f9828aa4b1c80907524560d to your computer and use it in GitHub Desktop.
A quick tool to issue a stat on files give a set of GFIDs from Gluster volume heal info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| function getparent { | |
| #echo $1 $2 | |
| local link=$(readlink -n -v $1/$2) | |
| if [ "x$link" == "x" ]; then | |
| return | |
| fi | |
| p_gfid_dn=$(dirname $1/$link) | |
| p_gfid=$(basename $p_gfid_dn) | |
| if [ "$p_gfid" != "00000000-0000-0000-0000-000000000001" ]; then | |
| p_lvltwo_dn=$(dirname $p_gfid_dn) | |
| p_lvltwo=$(basename $p_lvltwo_dn) | |
| p_lvlone_dn=$(dirname $p_lvltwo_dn) | |
| p_lvlone=$(basename $p_lvlone_dn) | |
| getparent $1 $p_lvlone/$p_lvltwo/$p_gfid | |
| fi | |
| name=$(basename $link) | |
| if [ "x$name" == "x.." ]; then | |
| return | |
| fi | |
| echo -n "/$name" | |
| } | |
| while read line ; do | |
| for i in {0..5} ; do | |
| getparent /brick/pbench$i*-brick/pbench/.glusterfs $line | |
| echo "" | |
| done | |
| done < heal.gfids.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment