Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
d7721e64
Commit
d7721e64
authored
7 years ago
by
Vladimir Bahyl
Browse files
Options
Downloads
Patches
Plain Diff
Check for tape replica existence and print errors
parent
c4632479
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
eos_wfe_scripts/create_tape_drop_disk_replicas
+28
-7
28 additions, 7 deletions
eos_wfe_scripts/create_tape_drop_disk_replicas
with
28 additions
and
7 deletions
eos_wfe_scripts/create_tape_drop_disk_replicas
+
28
−
7
View file @
d7721e64
...
...
@@ -16,16 +16,37 @@ LOG_DATE=`/usr/bin/date +%s | /usr/bin/tr '\n' ' ' ; /usr/bin/date`
LOG_SCRIPT_NAME
=
`
/usr/bin/basename
$0
`
LOG_FILE
=
"/var/log/eos/wfe/
${
WF_TAG
}
.log"
echo
"
$LOG_DATE
$LOG_SCRIPT_NAME
creating tape replica with fsid
${
TAPE_FS_ID
}
for
${
FILE_PATH
}
"
>>
${
LOG_FILE
}
if
!
eos
-r
0 0 file tag
"
${
FILE_PATH
}
"
+
${
TAPE_FS_ID
}
;
then
echo
"
$LOG_DATE
$LOG_SCRIPT_NAME
failed to create tape replica with fsid
${
TAPE_FS_ID
}
for
${
FILE_PATH
}
"
>>
${
LOG_FILE
}
# Creating tape replica
echo
"
${
LOG_DATE
}
${
LOG_SCRIPT_NAME
}
creating tape replica with fsid
${
TAPE_FS_ID
}
for
${
FILE_PATH
}
"
>>
${
LOG_FILE
}
OUTPUT
=
`
/usr/bin/eos
-r
0 0 file tag
"
${
FILE_PATH
}
"
+
${
TAPE_FS_ID
}
2>&1
`
RESULT
=
$?
if
[
0
-ne
${
RESULT
}
]
;
then
echo
"
${
LOG_DATE
}
${
LOG_SCRIPT_NAME
}
failed to create tape replica with fsid
${
TAPE_FS_ID
}
for
${
FILE_PATH
}
:
${
RESULT
}
${
OUTPUT
}
"
>>
${
LOG_FILE
}
exit
1
fi
for
DISK_FSID
in
`
eos file info
"
${
FILE_PATH
}
"
-m
|
sed
s/
\
/
'\n'
/g |
grep
fsid |
sed
s/fsid
=
// |
grep
-v
${
TAPE_FS_ID
}
`
;
do
echo
"
$LOG_DATE
$LOG_SCRIPT_NAME
deleting disk replica with fsid
${
DISK_FSID
}
for
${
FILE_PATH
}
"
>>
${
LOG_FILE
}
if
!
eos
-r
0 0 file drop
"
${
FILE_PATH
}
"
${
DISK_FSID
}
;
then
echo
"
$LOG_DATE
$LOG_SCRIPT_NAME
failed to delete disk replica with fsid
${
DISK_FSID
}
for
${
FILE_PATH
}
"
>>
${
LOG_FILE
}
# Checking tape replica
#echo "${LOG_DATE} ${LOG_SCRIPT_NAME} checking tape replica for ${FILE_PATH}" >> ${LOG_FILE}
OUTPUT
=
`
/usr/bin/eos
-r
0 0 attr
ls
"
${
FILE_PATH
}
"
2>&1 | /usr/bin/grep
-c
'^sys.archiveFileId=\"'
`
RESULT
=
$?
if
[
1
-gt
${
OUTPUT
}
]
;
then
echo
"
${
LOG_DATE
}
${
LOG_SCRIPT_NAME
}
missing tape replica sys.archiveFileId for
${
FILE_PATH
}
:
${
RESULT
}
${
OUTPUT
}
"
>>
${
LOG_FILE
}
exit
1
fi
OUTPUT
=
`
/usr/bin/eos
-r
0 0
ls
-y
"
${
FILE_PATH
}
"
2>&1 | /usr/bin/grep
-c
'^d.::t[123456789]'
`
RESULT
=
$?
if
[
1
-gt
${
OUTPUT
}
]
;
then
echo
"
${
LOG_DATE
}
${
LOG_SCRIPT_NAME
}
tape replica (expecting at least d?::t1) missing in EOS for
${
FILE_PATH
}
:
${
RESULT
}
${
OUTPUT
}
"
>>
${
LOG_FILE
}
exit
1
fi
# Deleting disk replica
for
DISK_FSID
in
`
/usr/bin/eos file info
"
${
FILE_PATH
}
"
-m
| /usr/bin/sed s/
\
/
'\n'
/g | /usr/bin/grep fsid | /usr/bin/sed s/fsid
=
// | /usr/bin/grep
-v
${
TAPE_FS_ID
}
`
;
do
echo
"
${
LOG_DATE
}
${
LOG_SCRIPT_NAME
}
deleting disk replica with fsid
${
DISK_FSID
}
for
${
FILE_PATH
}
"
>>
${
LOG_FILE
}
OUTPUT
=
`
/usr/bin/eos
-r
0 0 file drop
"
${
FILE_PATH
}
"
${
DISK_FSID
}
2>&1
`
RESULT
=
$?
if
[
0
-ne
${
RESULT
}
]
;
then
echo
"
${
LOG_DATE
}
${
LOG_SCRIPT_NAME
}
failed to delete disk replica with fsid
${
DISK_FSID
}
for
${
FILE_PATH
}
:
${
RESULT
}
${
OUTPUT
}
"
>>
${
LOG_FILE
}
exit
1
fi
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment