Commit e7725e98 authored by Vitaly Lipatov's avatar Vitaly Lipatov

grf: add gfid mismatch support

parent 806bc822
...@@ -120,10 +120,37 @@ fi ...@@ -120,10 +120,37 @@ fi
# check and fix path # check and fix path
if [ -n "$sfile" ] ; then if [ -n "$sfile" ] ; then
if [ -d "$sfile" ] ; then # select via param?
sfile="$sfile/*" #if [ -d "$sfile" ] ; then
fi # sfile="$sfile/*"
if echo "$sfile" | grep "\*" ; then #fi
mkdir -p $MOUNTDIR
mount_g
# FIXME: do not work with list
if echo "$sfile" | grep "<" ; then
echo "Work with GFID $sfile path"
# Перебираем брики и находим первый попавшийся .glusterfs/AA/BB/AABBCCDDEE, преобразуем в путь и используем"
rfile=
for brick in $LISTBRICKS ; do
set_host_path "$brick"
#echo "$host - $path"
# hack: translate to a path on volume
file="$(echo "$sfile" | sed -e "s|$FTPROOT/||g")"
rfile=$(echo $file | sed -e "s|[<>]||g")
rfile=.glusterfs/$(echo $rfile | cut -b1-2)/$(echo $rfile | cut -b3-4)/$rfile
rpath=$path
rfile=$(opbrick "realpath" "$rfile") && break
done
if [ -n "$rfile" ] ; then
sfile=$(echo $rfile | sed -e "s|.*$rpath|$FTPROOT|g")
else
echo "Can't resolve this gfid"
umount_g
exit
fi
elif echo "$sfile" | grep "\*" ; then
sdir="$(dirname "$sfile")" sdir="$(dirname "$sfile")"
if [ -d "$sdir" ] ; then if [ -d "$sdir" ] ; then
echo "Work with dir $sdir" echo "Work with dir $sdir"
...@@ -139,9 +166,6 @@ else ...@@ -139,9 +166,6 @@ else
fi fi
mkdir -p $MOUNTDIR
mount_g
test_file() test_file()
{ {
local sfile="$1" local sfile="$1"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment