Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
1010682e
Commit
1010682e
authored
Mar 24, 2015
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grf: last resort
parent
dc7188f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
grf
gluster/grf
+23
-13
No files found.
gluster/grf
View file @
1010682e
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment