Commit 60b11682 authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

(Re)added display of files to be migrated with status VALID_TOBEMIGR

parent 1d92b0ad
......@@ -75,7 +75,7 @@ DiskCopyStatus = ["DISKCOPY_VALID",
"DISKCOPY_INVALID",
"INVALID_STATUS",
"DISKCOPY_BEINGDELETED",
"INVALID_STATUS",
"DISKCOPY_VALID_TOBEMIGR",
"DISKCOPY_WAITFS_SCHEDULING"]
# connect to the stager and execute the query
......@@ -83,24 +83,28 @@ rc = 0
try:
stconn = castor_tools.connectToStager()
stcur = stconn.cursor()
stcur.arraysize = 50
stcur.arraysize = 1000
# the status expression reads "if the CastorFile.tapeStatus is NOTONTAPE with the DiskCopy VALID, show VALID_TOBEMIGR instead"
if printFileId:
stCheckSQL = '''
SELECT /*+ INDEX(DC I_DiskCopy_FileSystem) */
FileSystem.mountPoint||DC.path, DC.status,
DC.id, CastorFile.fileId, CastorFile.lastKnownFileName
FROM FileSystem, DiskServer, DiskCopy DC, CastorFile
FileSystem.mountPoint||DC.path, DC.id,
decode(DC.status, 0, decode(CF.tapeStatus, 0, 10, 0), DC.status),
CF.fileId, CF.lastKnownFileName
FROM FileSystem, DiskServer, DiskCopy DC, CastorFile CF
WHERE FileSystem.diskServer = DiskServer.id
AND DC.fileSystem = FileSystem.id
AND DC.castorFile = Castorfile.id
AND DC.castorFile = CF.id
AND DiskServer.name = :diskServerName'''
else:
stCheckSQL = '''
SELECT /*+ INDEX(DC I_DiskCopy_FileSystem) */
FileSystem.mountPoint||DC.path, DC.status, DC.id
FROM FileSystem, DiskServer, DiskCopy DC
FileSystem.mountPoint||DC.path, DC.id,
decode(DC.status, 0, decode(CF.tapeStatus, 0, 10, 0), DC.status)
FROM FileSystem, DiskServer, DiskCopy DC, CastorFile CF
WHERE FileSystem.diskServer = DiskServer.id
AND DC.fileSystem = FileSystem.id
AND DC.castorFile = CF.id
AND DiskServer.name = :diskServerName'''
stcur.execute(stCheckSQL, diskServerName=diskServerName)
rows = stcur.fetchall()
......@@ -120,19 +124,19 @@ try:
head = ''
if printFileId: head = head + "%-10s " % "FileId"
if printDiskCopyId: head = head + "%-12s " % "DiskCopyId"
head = head + "%-20s %-50s " % ("Status", "Physical FileName")
head = head + "%-24s %-50s " % ("Status", "Physical FileName")
if printFileId: head = head + "Last known FileName"
print head
# print rows
for row in rows:
line = ''
if printFileId: line = line + "%-10d " % row[3]
if printDiskCopyId: line = line + "%-12d " % row[2]
if row[1] <= len(DiskCopyStatus):
statusStr = DiskCopyStatus[row[1]]
if printDiskCopyId: line = line + "%-12d " % row[1]
if row[2] <= len(DiskCopyStatus):
statusStr = DiskCopyStatus[row[2]]
else:
statusStr = "Unknown status : " + str(row[1])
line = line + "%-20s %-50s " % (statusStr, diskServerName + ':' + row[0])
statusStr = "Unknown status : " + str(row[2])
line = line + "%-24s %-50s " % (statusStr, diskServerName + ':' + row[0])
if printFileId:
line = line + row[4]
print line
......
......@@ -45,22 +45,22 @@ is the name of the disk server to be queried. It needs to be fully qualified.
.fi
Status Physical FileName
.fi
DISKCOPY_VALID lxfsrk60a05.cern.ch:/srv/castor/01/05/61263405@lxs5010.450
DISKCOPY_VALID lxfsrk60a05.cern.ch:/srv/castor/01/05/61263405@lxs5010.450
.fi
DISKCOPY_VALID lxfsrk60a05.cern.ch:/srv/castor/01/21/61270821@lxs5010.529
DISKCOPY_VALID_TOBEMIGR lxfsrk60a05.cern.ch:/srv/castor/01/21/61270821@lxs5010.529
.fi
DISKCOPY_STAGEOUT lxfsrk60a05.cern.ch:/srv/castor/01/46/61312846@lxs5010.718
DISKCOPY_STAGEOUT lxfsrk60a05.cern.ch:/srv/castor/01/46/61312846@lxs5010.718
.ft
.BI #\ diskserver_qry\ -id\ lxfsrk60a05.cern.ch
.fi
FileId DiskCopyId Status Physical FileName Last known FileName
.fi
61263405 450 DISKCOPY_VALID lxfsrk60a05.cern.ch:/srv/castor/01/05/61263405@lxs5010.450 /castor/cern.ch/some/hsm/path
61263405 450 DISKCOPY_VALID lxfsrk60a05.cern.ch:/srv/castor/01/05/61263405@lxs5010.450 /castor/cern.ch/some/hsm/path
.fi
61270821 529 DISKCOPY_VALID lxfsrk60a05.cern.ch:/srv/castor/01/21/61270821@lxs5010.529 /castor/cern.ch/some/hsm/path
61270821 529 DISKCOPY_VALID_TOBEMIGR lxfsrk60a05.cern.ch:/srv/castor/01/21/61270821@lxs5010.529 /castor/cern.ch/some/hsm/path
.fi
61312846 718 DISKCOPY_STAGEOUT lxfsrk60a05.cern.ch:/srv/castor/01/46/61312846@lxs5010.718 /castor/cern.ch/some/hsm/path
61312846 718 DISKCOPY_STAGEOUT lxfsrk60a05.cern.ch:/srv/castor/01/46/61312846@lxs5010.718 /castor/cern.ch/some/hsm/path
.ft
.BI #\ diskserver_qry\ -id\ lxfsrk60a05
......@@ -68,10 +68,7 @@ FileId DiskCopyId Status Physical FileName
Unknown diskserver lxfsrk60a05. Did you provide a fully qualified name ?
.fi
.SH NOTES
This command connects directly to the stager database through
the perl DBI interface to ORACLE. Thus it can only run on
a machine providing it.
Configuration for the database access is taken from castor.conf.
Configuration for the database access is taken from /etc/castor/ORASTAGERCONFIG.
.SH SEE ALSO
.BR adminMultiInstance(1castor)
......
Supports Markdown
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