Commit e3054e1b authored by Vitaly Lipatov's avatar Vitaly Lipatov

grf: fix list url support for gfid

parent e7725e98
......@@ -128,29 +128,7 @@ if [ -n "$sfile" ] ; then
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
if echo "$sfile" | grep -q "\*" ; then
sdir="$(dirname "$sfile")"
if [ -d "$sdir" ] ; then
echo "Work with dir $sdir"
......@@ -165,11 +143,46 @@ else
exit 1
fi
tr_gfid_to_rpath()
{
local rfile rpath file
local sfile="$1"
rpath=
echo "$sfile" | grep -q "<" || return
# Перебираем брики и находим первый попавшийся .glusterfs/AA/BB/AABBCCDDEE, преобразуем в путь и используем"
rfile=
for brick in $LISTBRICKS ; do
set_host_path "$brick"
# 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
# print result
echo $rfile | sed -e "s|.*$rpath|$FTPROOT|g"
return 0
else
echo "Can't resolve this gfid" >&2
return 1
fi
}
test_file()
{
local sfile="$1"
if echo "$sfile" | grep -q "<" ; then
echo "Work with GFID $sfile path"
sfile=$(tr_gfid_to_rpath $sfile) || return
fi
echo
echo "mounted info for $sfile:"
if [ -z "$restore" ] ; then
......
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