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
caa39645
Commit
caa39645
authored
11 years ago
by
Giuseppe Lo Presti
Browse files
Options
Downloads
Patches
Plain Diff
Implemented bug #103708: RFE: "light" nslisstape (skip file path)
parent
7b5312e6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
hsmtools/nslistsegs
+107
-0
107 additions, 0 deletions
hsmtools/nslistsegs
hsmtools/nslistsegs.man
+46
-0
46 additions, 0 deletions
hsmtools/nslistsegs.man
ns/nslisttape.man
+3
-1
3 additions, 1 deletion
ns/nslisttape.man
vmgr/vmgrlisttape.man
+4
-2
4 additions, 2 deletions
vmgr/vmgrlisttape.man
with
160 additions
and
3 deletions
hsmtools/nslistsegs
0 → 100755
+
107
−
0
View file @
caa39645
#!/usr/bin/python
#/******************************************************************************
# * nslistsegs
# *
# * This file is part of the Castor project.
# * See http://castor.web.cern.ch/castor
# *
# * Copyright (C) 2003 CERN
# * This program is free software; you can redistribute it and/or
# * modify it under the terms of the GNU General Public License
# * as published by the Free Software Foundation; either version 2
# * of the License, or (at your option) any later version.
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# *
# * @author Castor Dev team, castor-dev@cern.ch
# *****************************************************************************/
'''
command line printing the list of segments in a given CASTOR tape
'''
import
sys
import
getopt
import
castor_tools
import
math
# usage function
def
usage
(
exitCode
):
'''
prints usage
'''
print
'
Usage :
'
+
sys
.
argv
[
0
]
+
'
[-h|--help] -V|--VID <tapeVID>
'
sys
.
exit
(
exitCode
)
verbose
=
False
tpvid
=
''
# first parse the options
try
:
options
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'
hvV:
'
,
[
'
help
'
,
'
verbose
'
,
'
VID=
'
])
except
Exception
,
e
:
print
e
usage
(
1
)
for
f
,
v
in
options
:
if
f
==
'
-h
'
or
f
==
'
--help
'
:
usage
(
0
)
elif
f
==
'
-v
'
or
f
==
'
--verbose
'
:
verbose
=
True
elif
f
==
'
-V
'
or
f
==
'
--VID
'
:
tpvid
=
v
else
:
print
"
unknown option :
"
+
f
usage
(
1
)
# Deal with arguments
if
tpvid
==
''
:
print
'
Missing argument
'
usage
(
1
)
try
:
# connect to nameserver and prepare statements
nsconn
=
castor_tools
.
connectToNS
()
cur
=
nsconn
.
cursor
()
# query the seg_metadata table. Note that for the compression we get it
# without converting it in a real compression factor (100/compression).
# As a matter of fact, many files in CASTOR have been stored with
# an incorrect compression of 100 (i.e. no compression), so here we
# expose the raw data as is.
# See ns/Cns_oracle_ifce.pc and ns/oracleTrailer.sql for how the compression
# shall be used and properly printed.
sqlStatement
=
'''
SELECT s_status, s_fileid, copyno, fseq, gid, segsize, decode(compression, 0, 100, compression),
to_char(checksum,
\'
XXXXXXXX
\'
), creationTime, lastModificationTime
FROM Cns_seg_metadata WHERE vid = :vid
'''
cur
.
execute
(
sqlStatement
,
vid
=
tpvid
)
# get results
rows
=
cur
.
fetchall
()
if
len
(
rows
)
==
0
:
print
'
No segments found on %s
'
%
tpvid
sys
.
exit
(
0
)
# loop over configs and print them
titles
=
[
'
STATUS
'
,
'
FILEID
'
,
'
COPYNO
'
,
'
FSEQ
'
,
'
GID
'
,
'
SIZE
'
,
'
COMPRESSION
'
,
'
CHECKSUM
'
,
'
CREATIONTIME
'
,
'
LASTMODIFICATIONTIME
'
]
data
=
[(
s_status
,
s_fileid
,
copyno
,
fseq
,
gid
,
segsize
,
compression
,
checksum
,
\
'
'
+
castor_tools
.
secsToDate
(
creationtime
),
'
'
+
castor_tools
.
secsToDate
(
lastmodificationtime
))
for
(
s_status
,
s_fileid
,
copyno
,
fseq
,
gid
,
segsize
,
compression
,
checksum
,
creationtime
,
lastmodificationtime
)
in
rows
]
# compute some statistics
if
len
(
rows
)
>
2
:
size
=
tsum
=
tsumsq
=
0
for
r
in
rows
:
size
+=
int
(
r
[
5
])
tsum
+=
int
(
r
[
-
2
])
tsumsq
+=
int
(
r
[
-
2
])
*
int
(
r
[
-
2
])
data
+=
[(
'
-
'
,
'
--SUMMARY--
'
,
'
-
'
,
rows
[
-
1
][
3
],
'
-
'
,
castor_tools
.
nbToDataAmount
(
size
),
'
-
'
,
'
-
'
,
\
castor_tools
.
secsToDate
(
tsum
/
len
(
rows
)),
\
'
+/-
'
+
castor_tools
.
nbToAge
(
math
.
sqrt
(
tsumsq
/
len
(
rows
)
-
tsum
*
tsum
/
(
len
(
rows
)
*
len
(
rows
)))))]
castor_tools
.
prettyPrintTable
(
titles
,
data
)
# close DB connections
try
:
castor_tools
.
disconnectDB
(
nsconn
)
except
Exception
:
pass
except
Exception
,
e
:
print
e
if
verbose
:
import
traceback
traceback
.
print_exc
()
sys
.
exit
(
-
1
)
This diff is collapsed.
Click to expand it.
hsmtools/nslistsegs.man
0 → 100644
+
46
−
0
View file @
caa39645
.TH NSLISTSEGS "1castor" "2014" CASTOR "Prints out the segments of a tape and some summary statistics"
.SH NAME
nslistsegs
.SH SYNOPSIS
.B nslistsegs
[
.BI -h
]
-V <VID>
.SH DESCRIPTION
.B nslistsegs
prints out the list of segments in the given tape. The list is retrieved from the nameserver catalogue in bulk with a direct
query, and no information is given about the files beyond their file ids for performance reasons.
If the tape contains more than 2 segments, a summary line is printed as well with some statistics including the total
size of the segments, the average creation time and its standard deviation in the form of a time interval.
.TP
.BI \-h,\ \-\-help
Get usage information
.TP
.BI \-V,\ \-\-VID
The Volume ID of the tape to be listed
.SH EXAMPLES
.nf
.ft CW
# nslistsegs -V T80784
STATUS FILEID COPYNO FSEQ GID SIZE COMPRESSION CHECKSUM CREATIONTIME LASTMODIFICATIONTIME
-------------------------------------------------------------------------------------------------------------------
- 161824199 1 1 1665 201636792 126 547421A6 04-Nov-2007 12:42:44 11-Jan-2014 11:20:30
- 161795001 1 2 1665 3228132 126 30F15D30 04-Nov-2007 08:44:34 11-Jan-2014 11:20:30
...
- 696028399 1 154634 1665 11663567 3588789 853505DB 30-Mar-2011 06:30:53 23-Jan-2014 05:02:34
- 695960979 1 154635 1665 11357774 3594232 E7883BF5 30-Mar-2011 04:40:20 23-Jan-2014 05:02:34
- 696015257 1 154636 1665 11662226 3588377 7C64BD82 30-Mar-2011 06:15:00 23-Jan-2014 05:02:34
- --SUMMARY-- - 154636 - 9TiB - - 01-Feb-2008 06:29:58 +/- 1135d2h47mn49s
.SH NOTES
This command requires database client access to the nameserver catalogue.
.SH SEE ALSO
.BR nslisttape(1) ,
.BR vmgrlisttape(1)
.SH AUTHOR
\fBCASTOR\fP Team <castor.support@cern.ch>
This diff is collapsed.
Click to expand it.
ns/nslisttape.man
+
3
−
1
View file @
caa39645
...
...
@@ -72,6 +72,8 @@ This program returns 0 if the operation was successful or >0 if the operation
failed.
.SH SEE ALSO
.BR Castor_limits(4) ,
.B Cns_listtape(3)
.BR Cns_listtape(3) ,
.BR vmgrlisttape(1) ,
.BR nslistsegs(1)
.SH AUTHOR
\fBCASTOR\fP Team <castor.support@cern.ch>
This diff is collapsed.
Click to expand it.
vmgr/vmgrlisttape.man
+
4
−
2
View file @
caa39645
...
...
@@ -108,7 +108,9 @@ failed.
.BR Castor_limits(4) ,
.BR vmgr_entertape(3) ,
.BR vmgrentertape(1) ,
.B vmgr_listtape(3) ,
.B vmgr_querytape(3)
.BR vmgr_listtape(3) ,
.BR vmgr_querytape(3) ,
.BR nslisttape(1) ,
.BR nslistsegs(1)
.SH AUTHOR
\fBCASTOR\fP Team <castor.support@cern.ch>
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