Commit 1010682e authored by Vitaly Lipatov's avatar Vitaly Lipatov

grf: last resort

parent dc7188f1
......@@ -190,7 +190,7 @@ get_gfid()
#trusted.gfid=0x9dd12f564daa42ff94e103a4b0fb0899
# /var/local/eterglust/pub/.glusterfs/9d/d1/9dd12f56-4daa-42ff-94e1-03a4b0fb0899
gfid=$(sshopbrick "getfattr -d -m . -e hex" "$file" | grep ^trusted.gfid | sed -e "s|trusted.gfid=0x||g")
gfid=$(sshopbrick "getfattr -h -d -m . -e hex" "$file" | grep ^trusted.gfid | sed -e "s|trusted.gfid=0x||g")
# if file exists, really
if [ -n "$gfid" ] ; then
python -c "import uuid; x=uuid.UUID(hex='$gfid'); print x;"
......@@ -247,7 +247,7 @@ for brick in $LISTBRICKS ; do
[ -d "$sfile" ] && opbrick "ls -ld" "$file"
# FIXME: replace with get_gfid
sshopbrick "getfattr -d -m . -e hex" "$file" | tee $WORKDIR/getfattr
sshopbrick "getfattr -h -P -d -m . -e hex" "$file" | tee $WORKDIR/getfattr
#trusted.gfid=0x9dd12f564daa42ff94e103a4b0fb0899
# /var/local/eterglust/pub/.glusterfs/9d/d1/9dd12f56-4daa-42ff-94e1-03a4b0fb0899
......@@ -255,16 +255,16 @@ for brick in $LISTBRICKS ; do
# if file exists, really
if [ -n "$gfid" ] ; then
gfid=`python -c "import uuid; x=uuid.UUID(hex='$gfid'); print x;"`
echo gfid $gfid
fi
echo "gfid: $gfid"
# показываем информацию о файле или содержимом каталога
if opbrick "ls -l" "$file" ; then
if [ ! -L "$sfile" ] ; then
if ! opbrick "test -L" "$file" ; then
sshopbrick md5sum "$file"
echo "$file" | grep -q rpm && sshopbrick "epm checkpkg" "$file"
else
echo "skip md5, it is link"
echo "$host: skip md5, it is link"
fi
fi
done
......@@ -273,9 +273,9 @@ fi
if [ "$remove" = "--allremove" ] ; then
for brick in $LISTBRICKS ; do
set_host_path "$brick"
# удаляем локальные размещения
# пустых файлов
opbrick "test -s" "$file" || opbrick rm -v "$file"
opbrick "rm -v" "$file"
gfid=$(get_gfid "$file")
[ -n "$gfid" ] && opbrick "rm -fv" "$(get_pgf_name $gfid)"
done
fi
......@@ -283,10 +283,14 @@ OLDFILE=
SELFILE=
SELHOST=
SELPATH=
ISDIR=
if [ "$restore" = "--restore" ] ; then
COUNT=1
FILNUM=0
rm -f $WORKDIR/*
[ -d "$sfile" ] && [ ! -L "$sfile" ] && ISDIR=1
for i in $LISTBRICKS ; do
set_host_path "$i"
# Надо отличать, есть файл или ошибка с ним. Если файла вообще нет, надо удалять всё на томах
......@@ -296,7 +300,7 @@ if [ "$restore" = "--restore" ] ; then
FILNUM=$(($FILNUM+1))
touch -d "$FD" "$WORKDIR/$host-$COUNT"
if [ -z "$OLDFILE" ] || [ "$OLDFILE" -nt "$WORKDIR/$host-$COUNT" ] ; then
if opbrick "test -s" "$file" ; then
if opbrick "test -L" "$file" || opbrick "test -s" "$file" ; then
OLDFILE="$WORKDIR/$host-$COUNT"
SELFILE="$file"
SELHOST=$host
......@@ -344,17 +348,23 @@ if [ "$restore" = "--restore" ] ; then
# FIXME: Нельзя удалять, если OLDFILE на неактивном томе
# TODO: обычно нет смысла удалять пару
# прежде удаляем из .glusterfs
if opbrick "test -r" "$file" ; then
if opbrick "test -r" "$file" || opbrick "test -L" "$file" ; then
gfid=$(get_gfid "$file")
if [ "$gfid" != "$GENGFID" ] ; then
echo "gfid mismatch!!!! ($gfid and $GENGFID)"
opbrick "rm -fv" "$(get_pgf_name $GENGFID)"
[ -n "$GENGFID" ] && opbrick "rm -fv" "$(get_pgf_name $GENGFID)"
fi
[ -n "$gfid" ] && opbrick "rm -fv" "$(get_pgf_name $gfid)"
else
opbrick "rm -fv" "$(get_pgf_name $GENGFID)"
[ -n "$GENGFID" ] && opbrick "rm -fv" "$(get_pgf_name $GENGFID)"
fi
if [ -n "$ISDIR" ] ; then
opbrick "rmdir -v" "$file"
else
opbrick "rm -fv" "$file"
fi
opbrick "rm -fv" "$file"
echo "$path/$file ($host)" >>grf.removed.list
fi
......
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