Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
208c0b8f
Commit
208c0b8f
authored
Nov 08, 2016
by
Eric Cano
Browse files
Removed redundant DriveConfig class and replaced it with TpConfigLine.
parent
5181643c
Changes
28
Hide whitespace changes
Inline
Side-by-side
tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt
View file @
208c0b8f
...
...
@@ -37,8 +37,6 @@ set(CTATAPESERVERDAEMON_LIBRARY_SRCS
DiskReadTask.cpp
DiskWriteTask.cpp
DiskWriteThreadPool.cpp
DriveConfig.cpp
DriveConfigMap.cpp
EmptyDriveProbe.cpp
EncryptionControl.cpp
TapeServerReporter.cpp
...
...
@@ -80,7 +78,7 @@ endif(CMAKE_COMPILER_IS_GNUCC)
add_library
(
ctaTapeServerDaemon
${
CTATAPESERVERDAEMON_LIBRARY_SRCS
}
)
target_link_libraries
(
ctaTapeServerDaemon ctamessages ctatapereactor ctacommon ctaremotens protobuf ctascheduler ctalegacymsg ctacatalogue
)
target_link_libraries
(
ctaTapeServerDaemon ctamessages ctatapereactor ctacommon ctaremotens protobuf ctascheduler ctalegacymsg ctacatalogue
TapeDrive
)
add_dependencies
(
ctaTapeServerDaemon ctamessagesprotobuf
)
add_library
(
ctatapeserverdaemonunittests SHARED
...
...
@@ -88,7 +86,6 @@ add_library(ctatapeserverdaemonunittests SHARED
DiskReadTaskTest.cpp
DiskWriteTaskTest.cpp
DiskWriteThreadPoolTest.cpp
DriveConfigTest.cpp
MigrationReportPackerTest.cpp
RecallReportPackerTest.cpp
RecallTaskInjectorTest.cpp
...
...
tapeserver/castor/tape/tapeserver/daemon/CleanerSession.cpp
View file @
208c0b8f
...
...
@@ -30,7 +30,7 @@ castor::tape::tapeserver::daemon::CleanerSession::CleanerSession(
cta
::
server
::
ProcessCap
&
capUtils
,
cta
::
mediachanger
::
MediaChangerFacade
&
mc
,
cta
::
log
::
Logger
&
log
,
const
DriveC
onfig
&
driveConfig
,
const
cta
::
tape
::
daemon
::
Tpc
onfig
Line
&
driveConfig
,
System
::
virtualWrapper
&
sysWrapper
,
const
std
::
string
&
vid
,
const
bool
waitMediaInDrive
,
...
...
@@ -66,7 +66,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
// Reaching this point means the cleaner failed and an exception was thrown
std
::
list
<
cta
::
log
::
Param
>
params
=
{
cta
::
log
::
Param
(
"TPVID"
,
m_vid
),
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
getU
nitName
()
),
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
u
nitName
),
cta
::
log
::
Param
(
"message"
,
errorMessage
)};
m_log
(
cta
::
log
::
ERR
,
"Cleaner failed"
,
params
);
return
MARK_DRIVE_AS_DOWN
;
...
...
@@ -105,7 +105,7 @@ void castor::tape::tapeserver::daemon::CleanerSession::cleanDrive(drive::DriveIn
if
(
!
drive
.
hasTapeInPlace
())
{
std
::
list
<
cta
::
log
::
Param
>
params
;
params
.
push_back
(
cta
::
log
::
Param
(
"TPVID"
,
m_vid
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
getU
nitName
()
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
u
nitName
));
m_log
(
cta
::
log
::
INFO
,
"Cleaner found tape drive empty"
,
params
);
return
;
//return immediately if there is no tape
}
...
...
@@ -156,7 +156,7 @@ void castor::tape::tapeserver::daemon::CleanerSession::logAndClearTapeAlerts(dri
// Reaching this point means it failed and an exception was thrown (because of the "return" above)
std
::
list
<
cta
::
log
::
Param
>
params
=
{
cta
::
log
::
Param
(
"TPVID"
,
m_vid
),
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
getU
nitName
()
),
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
u
nitName
),
cta
::
log
::
Param
(
"message"
,
errorMessage
)};
m_log
(
cta
::
log
::
ERR
,
"Cleaner failed getting tape alerts from the drive"
,
params
);
}
...
...
@@ -181,7 +181,7 @@ void castor::tape::tapeserver::daemon::CleanerSession::setProcessCapabilities(
std
::
unique_ptr
<
castor
::
tape
::
tapeserver
::
drive
::
DriveInterface
>
castor
::
tape
::
tapeserver
::
daemon
::
CleanerSession
::
createDrive
()
{
SCSI
::
DeviceVector
dv
(
m_sysWrapper
);
SCSI
::
DeviceInfo
driveInfo
=
dv
.
findBySymlink
(
m_driveConfig
.
getD
evFilename
()
);
SCSI
::
DeviceInfo
driveInfo
=
dv
.
findBySymlink
(
m_driveConfig
.
d
evFilename
);
// Instantiate the drive object
std
::
unique_ptr
<
castor
::
tape
::
tapeserver
::
drive
::
DriveInterface
>
...
...
@@ -203,7 +203,7 @@ void castor::tape::tapeserver::daemon::CleanerSession::waitUntilMediaIsReady(
drive
::
DriveInterface
&
drive
)
{
std
::
list
<
cta
::
log
::
Param
>
params
;
params
.
push_back
(
cta
::
log
::
Param
(
"TPVID"
,
m_vid
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
getU
nitName
()
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
u
nitName
));
params
.
push_back
(
cta
::
log
::
Param
(
"waitMediaInDriveTimeout"
,
m_waitMediaInDriveTimeout
));
...
...
@@ -225,7 +225,7 @@ void castor::tape::tapeserver::daemon::CleanerSession::rewindDrive(
drive
::
DriveInterface
&
drive
)
{
std
::
list
<
cta
::
log
::
Param
>
params
;
params
.
push_back
(
cta
::
log
::
Param
(
"TPVID"
,
m_vid
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
getU
nitName
()
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
u
nitName
));
m_log
(
cta
::
log
::
INFO
,
"Cleaner rewinding tape"
,
params
);
drive
.
rewind
();
...
...
@@ -239,7 +239,7 @@ void castor::tape::tapeserver::daemon::CleanerSession::checkTapeContainsData(
drive
::
DriveInterface
&
drive
)
{
std
::
list
<
cta
::
log
::
Param
>
params
;
params
.
push_back
(
cta
::
log
::
Param
(
"TPVID"
,
m_vid
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
getU
nitName
()
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
u
nitName
));
m_log
(
cta
::
log
::
INFO
,
"Cleaner checking tape contains data"
,
params
);
if
(
drive
.
isTapeBlank
())
{
...
...
@@ -258,7 +258,7 @@ std::string castor::tape::tapeserver::daemon::CleanerSession::checkVolumeLabel(
tapeFile
::
VOL1
vol1
;
std
::
list
<
cta
::
log
::
Param
>
params
;
params
.
push_back
(
cta
::
log
::
Param
(
"TPVID"
,
m_vid
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
getU
nitName
()
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
u
nitName
));
try
{
drive
.
readExactBlock
((
void
*
)
&
vol1
,
sizeof
(
vol1
),
...
...
@@ -294,10 +294,10 @@ std::string castor::tape::tapeserver::daemon::CleanerSession::checkVolumeLabel(
//------------------------------------------------------------------------------
void
castor
::
tape
::
tapeserver
::
daemon
::
CleanerSession
::
unloadTape
(
const
std
::
string
&
vid
,
drive
::
DriveInterface
&
drive
)
{
const
cta
::
mediachanger
::
LibrarySlot
&
librarySlot
=
m_driveConfig
.
getL
ibrarySlot
();
const
cta
::
mediachanger
::
LibrarySlot
&
librarySlot
=
m_driveConfig
.
l
ibrarySlot
();
std
::
list
<
cta
::
log
::
Param
>
params
;
params
.
push_back
(
cta
::
log
::
Param
(
"TPVID"
,
vid
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
getU
nitName
()
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
u
nitName
));
params
.
push_back
(
cta
::
log
::
Param
(
"librarySlot"
,
librarySlot
.
str
()));
// We implement the same policy as with the tape sessions:
...
...
@@ -325,10 +325,10 @@ void castor::tape::tapeserver::daemon::CleanerSession::unloadTape(
//------------------------------------------------------------------------------
void
castor
::
tape
::
tapeserver
::
daemon
::
CleanerSession
::
dismountTape
(
const
std
::
string
&
vid
)
{
const
cta
::
mediachanger
::
LibrarySlot
&
librarySlot
=
m_driveConfig
.
getL
ibrarySlot
();
const
cta
::
mediachanger
::
LibrarySlot
&
librarySlot
=
m_driveConfig
.
l
ibrarySlot
();
std
::
list
<
cta
::
log
::
Param
>
params
;
params
.
push_back
(
cta
::
log
::
Param
(
"TPVID"
,
vid
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
getU
nitName
()
));
params
.
push_back
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
u
nitName
));
params
.
push_back
(
cta
::
log
::
Param
(
"librarySlot"
,
librarySlot
.
str
()));
try
{
...
...
tapeserver/castor/tape/tapeserver/daemon/CleanerSession.hpp
View file @
208c0b8f
...
...
@@ -26,9 +26,9 @@
#include
"common/log/LogContext.hpp"
#include
"common/log/Logger.hpp"
#include
"common/processCap/ProcessCap.hpp"
#include
"DriveConfig.hpp"
#include
"mediachanger/MediaChangerFacade.hpp"
#include
"Session.hpp"
#include
"tapeserver/daemon/TpconfigLine.hpp"
#include
"tapeserver/castor/tape/tapeserver/drive/DriveInterface.hpp"
#include
"tapeserver/castor/tape/tapeserver/file/Structures.hpp"
#include
"tapeserver/castor/tape/tapeserver/SCSI/Device.hpp"
...
...
@@ -67,7 +67,7 @@ namespace daemon {
cta
::
server
::
ProcessCap
&
capUtils
,
cta
::
mediachanger
::
MediaChangerFacade
&
mc
,
cta
::
log
::
Logger
&
log
,
const
DriveC
onfig
&
driveConfig
,
const
cta
::
tape
::
daemon
::
Tpc
onfig
Line
&
driveConfig
,
System
::
virtualWrapper
&
sysWrapper
,
const
std
::
string
&
vid
,
const
bool
waitMediaInDrive
,
...
...
@@ -103,7 +103,7 @@ namespace daemon {
/**
* The configuration of the tape drive to be cleaned.
*/
const
DriveC
onfig
m_driveConfig
;
const
cta
::
tape
::
daemon
::
Tpc
onfig
Line
m_driveConfig
;
/**
* The system wrapper used to find the device and instantiate the drive object
...
...
tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp
View file @
208c0b8f
...
...
@@ -50,7 +50,7 @@ castor::tape::tapeserver::daemon::DataTransferSession::DataTransferSession(
const
std
::
string
&
hostname
,
cta
::
log
::
Logger
&
log
,
System
::
virtualWrapper
&
sysWrapper
,
const
DriveC
onfig
&
driveConfig
,
const
cta
::
tape
::
daemon
::
Tpc
onfig
Line
&
driveConfig
,
cta
::
mediachanger
::
MediaChangerFacade
&
mc
,
cta
::
tape
::
daemon
::
TapedProxy
&
initialProcess
,
cta
::
server
::
ProcessCap
&
capUtils
,
...
...
@@ -60,7 +60,7 @@ castor::tape::tapeserver::daemon::DataTransferSession::DataTransferSession(
m_sysWrapper
(
sysWrapper
),
m_driveConfig
(
driveConfig
),
m_castorConf
(
castorConf
),
m_driveInfo
({
driveConfig
.
m_
unitName
,
cta
::
utils
::
getShortHostname
(),
driveConfig
.
m_logical
Library
}),
m_driveInfo
({
driveConfig
.
unitName
,
cta
::
utils
::
getShortHostname
(),
driveConfig
.
raw
Library
Slot
}),
m_mc
(
mc
),
m_intialProcess
(
initialProcess
),
m_capUtils
(
capUtils
),
...
...
@@ -90,7 +90,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
schedule:
while
(
true
)
{
try
{
auto
desiredState
=
m_scheduler
.
getDesiredDriveState
(
m_driveConfig
.
m_
unitName
);
auto
desiredState
=
m_scheduler
.
getDesiredDriveState
(
m_driveConfig
.
unitName
);
if
(
!
desiredState
.
up
)
{
// We wait a bit before polling the scheduler again.
// TODO: parametrize the duration?
...
...
@@ -108,7 +108,7 @@ schedule:
// 2b) Get initial mount information
std
::
unique_ptr
<
cta
::
TapeMount
>
tapeMount
;
try
{
tapeMount
.
reset
(
m_scheduler
.
getNextMount
(
m_driveConfig
.
getL
ogicalLibrary
()
,
m_driveConfig
.
getU
nitName
()
).
release
());
tapeMount
.
reset
(
m_scheduler
.
getNextMount
(
m_driveConfig
.
l
ogicalLibrary
,
m_driveConfig
.
u
nitName
).
release
());
}
catch
(
cta
::
exception
::
Exception
&
e
)
{
cta
::
log
::
ScopedParamContainer
localParams
(
lc
);
localParams
.
add
(
"errorMessage"
,
e
.
getMessageValue
());
...
...
@@ -168,7 +168,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
// to refer them to each other)
RecallReportPacker
rrp
(
retrieveMount
,
lc
);
rrp
.
disableBulk
();
//no bulk needed anymore
RecallWatchDog
rwd
(
15
,
60
*
10
,
m_intialProcess
,
m_driveConfig
.
getU
nitName
()
,
lc
);
RecallWatchDog
rwd
(
15
,
60
*
10
,
m_intialProcess
,
m_driveConfig
.
u
nitName
,
lc
);
RecallMemoryManager
mm
(
m_castorConf
.
nbBufs
,
m_castorConf
.
bufsz
,
lc
);
TapeServerReporter
tsr
(
m_intialProcess
,
m_driveConfig
,
...
...
@@ -263,7 +263,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
MigrationMemoryManager
mm
(
m_castorConf
.
nbBufs
,
m_castorConf
.
bufsz
,
lc
);
MigrationReportPacker
mrp
(
archiveMount
,
lc
);
MigrationWatchDog
mwd
(
15
,
60
*
10
,
m_intialProcess
,
m_driveConfig
.
getU
nitName
()
,
lc
);
MigrationWatchDog
mwd
(
15
,
60
*
10
,
m_intialProcess
,
m_driveConfig
.
u
nitName
,
lc
);
TapeWriteSingleThread
twst
(
*
drive
,
m_mc
,
tsr
,
...
...
@@ -383,16 +383,16 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
* @return the drive if found, NULL otherwise
*/
castor
::
tape
::
tapeserver
::
drive
::
DriveInterface
*
castor
::
tape
::
tapeserver
::
daemon
::
DataTransferSession
::
findDrive
(
const
DriveC
onfig
castor
::
tape
::
tapeserver
::
daemon
::
DataTransferSession
::
findDrive
(
const
cta
::
tape
::
daemon
::
Tpc
onfig
Line
&
driveConfig
,
cta
::
log
::
LogContext
&
lc
,
cta
::
TapeMount
*
mount
)
{
// Find the drive in the system's SCSI devices
castor
::
tape
::
SCSI
::
DeviceVector
dv
(
m_sysWrapper
);
castor
::
tape
::
SCSI
::
DeviceInfo
driveInfo
;
try
{
driveInfo
=
dv
.
findBySymlink
(
driveConfig
.
getD
evFilename
()
);
driveInfo
=
dv
.
findBySymlink
(
driveConfig
.
d
evFilename
);
}
catch
(
castor
::
tape
::
SCSI
::
DeviceVector
::
NotFound
&
e
)
{
// We could not find this drive in the system's SCSI devices
cta
::
log
::
LogContext
::
ScopedParam
sp09
(
lc
,
cta
::
log
::
Param
(
"devFilename"
,
driveConfig
.
getD
evFilename
()
));
cta
::
log
::
LogContext
::
ScopedParam
sp09
(
lc
,
cta
::
log
::
Param
(
"devFilename"
,
driveConfig
.
d
evFilename
));
lc
.
log
(
cta
::
log
::
ERR
,
"Drive not found on this path"
);
std
::
stringstream
errMsg
;
...
...
@@ -404,7 +404,7 @@ castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const DriveConf
return
NULL
;
}
catch
(
cta
::
exception
::
Exception
&
e
)
{
// We could not find this drive in the system's SCSI devices
cta
::
log
::
LogContext
::
ScopedParam
sp09
(
lc
,
cta
::
log
::
Param
(
"devFilename"
,
driveConfig
.
getD
evFilename
()
));
cta
::
log
::
LogContext
::
ScopedParam
sp09
(
lc
,
cta
::
log
::
Param
(
"devFilename"
,
driveConfig
.
d
evFilename
));
cta
::
log
::
LogContext
::
ScopedParam
sp10
(
lc
,
cta
::
log
::
Param
(
"errorMessage"
,
e
.
getMessageValue
()));
lc
.
log
(
cta
::
log
::
ERR
,
"Error looking to path to tape drive"
);
...
...
@@ -417,7 +417,7 @@ castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const DriveConf
return
NULL
;
}
catch
(...)
{
// We could not find this drive in the system's SCSI devices
cta
::
log
::
LogContext
::
ScopedParam
sp09
(
lc
,
cta
::
log
::
Param
(
"devFilename"
,
driveConfig
.
getD
evFilename
()
));
cta
::
log
::
LogContext
::
ScopedParam
sp09
(
lc
,
cta
::
log
::
Param
(
"devFilename"
,
driveConfig
.
d
evFilename
));
lc
.
log
(
cta
::
log
::
ERR
,
"Unexpected exception while looking for drive"
);
std
::
stringstream
errMsg
;
...
...
@@ -435,7 +435,7 @@ castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const DriveConf
return
drive
.
release
();
}
catch
(
cta
::
exception
::
Exception
&
e
)
{
// We could not find this drive in the system's SCSI devices
cta
::
log
::
LogContext
::
ScopedParam
sp09
(
lc
,
cta
::
log
::
Param
(
"devFilename"
,
driveConfig
.
getD
evFilename
()
));
cta
::
log
::
LogContext
::
ScopedParam
sp09
(
lc
,
cta
::
log
::
Param
(
"devFilename"
,
driveConfig
.
d
evFilename
));
cta
::
log
::
LogContext
::
ScopedParam
sp10
(
lc
,
cta
::
log
::
Param
(
"errorMessage"
,
e
.
getMessageValue
()));
lc
.
log
(
cta
::
log
::
ERR
,
"Error opening tape drive"
);
...
...
@@ -448,7 +448,7 @@ castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const DriveConf
return
NULL
;
}
catch
(...)
{
// We could not find this drive in the system's SCSI devices
cta
::
log
::
LogContext
::
ScopedParam
sp09
(
lc
,
cta
::
log
::
Param
(
"devFilename"
,
driveConfig
.
getD
evFilename
()
));
cta
::
log
::
LogContext
::
ScopedParam
sp09
(
lc
,
cta
::
log
::
Param
(
"devFilename"
,
driveConfig
.
d
evFilename
));
lc
.
log
(
cta
::
log
::
ERR
,
"Unexpected exception while opening drive"
);
std
::
stringstream
errMsg
;
...
...
tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.hpp
View file @
208c0b8f
...
...
@@ -29,7 +29,7 @@
#include
"mediachanger/MediaChangerFacade.hpp"
#include
"tapeserver/daemon/TapedProxy.hpp"
#include
"DataTransferConfig.hpp"
#include
"
DriveC
onfig.hpp"
#include
"
tapeserver/daemon/Tpc
onfig
Line
.hpp"
#include
"Session.hpp"
#include
"TapeSingleThreadInterface.hpp"
#include
"tapeserver/castor/tape/tapeserver/system/Wrapper.hpp"
...
...
@@ -59,7 +59,7 @@ namespace daemon {
const
std
::
string
&
hostname
,
cta
::
log
::
Logger
&
log
,
System
::
virtualWrapper
&
sysWrapper
,
const
DriveC
onfig
&
driveConfig
,
const
cta
::
tape
::
daemon
::
Tpc
onfig
Line
&
driveConfig
,
cta
::
mediachanger
::
MediaChangerFacade
&
mc
,
cta
::
tape
::
daemon
::
TapedProxy
&
initialProcess
,
cta
::
server
::
ProcessCap
&
capUtils
,
...
...
@@ -107,7 +107,7 @@ namespace daemon {
/**
* The configuration of the tape drive to be used by this session.
*/
const
DriveC
onfig
m_driveConfig
;
const
cta
::
tape
::
daemon
::
Tpc
onfig
Line
m_driveConfig
;
const
DataTransferConfig
&
m_castorConf
;
/**
* The drive information bundle allowing drive register update.
...
...
@@ -118,7 +118,7 @@ namespace daemon {
* all errors and hence does not throw exceptions. It returns NULL
* in case of failure. */
castor
::
tape
::
tapeserver
::
drive
::
DriveInterface
*
findDrive
(
const
DriveC
onfig
&
driveConfig
,
cta
::
log
::
LogContext
&
lc
,
cta
::
TapeMount
*
mount
);
const
cta
::
tape
::
daemon
::
Tpc
onfig
Line
&
driveConfig
,
cta
::
log
::
LogContext
&
lc
,
cta
::
TapeMount
*
mount
);
/** sub-part of execute for the read sessions */
EndOfSessionAction
executeRead
(
cta
::
log
::
LogContext
&
lc
,
cta
::
RetrieveMount
*
retrieveMount
);
...
...
tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
View file @
208c0b8f
...
...
@@ -423,13 +423,13 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayRecall) {
}
// 6) Report the drive's existence and put it up in the drive register.
DriveC
onfig
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
tape
::
daemon
::
Tpc
onfig
Line
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
common
::
dataStructures
::
DriveInfo
driveInfo
;
driveInfo
.
driveName
=
driveConfig
.
m_
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
m_logical
Library
;
driveInfo
.
driveName
=
driveConfig
.
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
raw
Library
Slot
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
m_
unitName
,
true
,
false
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
);
// 7) Create the data transfer session
DataTransferConfig
castorConf
;
...
...
@@ -616,13 +616,13 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongRecall) {
}
// 6) Report the drive's existence and put it up in the drive register.
DriveC
onfig
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
tape
::
daemon
::
Tpc
onfig
Line
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
common
::
dataStructures
::
DriveInfo
driveInfo
;
driveInfo
.
driveName
=
driveConfig
.
m_
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
m_logical
Library
;
driveInfo
.
driveName
=
driveConfig
.
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
raw
Library
Slot
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
m_
unitName
,
true
,
false
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
);
// 7) Create the data transfer session
DataTransferConfig
castorConf
;
...
...
@@ -781,13 +781,13 @@ TEST_P(DataTransferSessionTest, DataTransferSessionNoSuchDrive) {
}
// 7) Report the drive's existence and put it up in the drive register.
DriveC
onfig
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/noSuchDrive"
,
"manual"
);
cta
::
tape
::
daemon
::
Tpc
onfig
Line
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/noSuchDrive"
,
"manual"
);
cta
::
common
::
dataStructures
::
DriveInfo
driveInfo
;
driveInfo
.
driveName
=
driveConfig
.
m_
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
m_logical
Library
;
driveInfo
.
driveName
=
driveConfig
.
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
raw
Library
Slot
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
m_
unitName
,
true
,
false
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
);
// 8) Create the data transfer session
DataTransferConfig
castorConf
;
...
...
@@ -925,13 +925,13 @@ TEST_P(DataTransferSessionTest, DataTransferSessionFailtoMount) {
}
// 7) Report the drive's existence and put it up in the drive register.
DriveC
onfig
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
tape
::
daemon
::
Tpc
onfig
Line
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
common
::
dataStructures
::
DriveInfo
driveInfo
;
driveInfo
.
driveName
=
driveConfig
.
m_
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
m_logical
Library
;
driveInfo
.
driveName
=
driveConfig
.
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
raw
Library
Slot
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
m_
unitName
,
true
,
false
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
);
// 8) Create the data transfer session
DataTransferConfig
castorConf
;
...
...
@@ -1052,13 +1052,13 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayMigration) {
}
}
// Report the drive's existence and put it up in the drive register.
DriveC
onfig
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
tape
::
daemon
::
Tpc
onfig
Line
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
common
::
dataStructures
::
DriveInfo
driveInfo
;
driveInfo
.
driveName
=
driveConfig
.
m_
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
m_logical
Library
;
driveInfo
.
driveName
=
driveConfig
.
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
raw
Library
Slot
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
m_
unitName
,
true
,
false
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
);
// Create the data transfer session
DataTransferConfig
castorConf
;
...
...
@@ -1192,13 +1192,13 @@ TEST_P(DataTransferSessionTest, DataTransferSessionMissingFilesMigration) {
}
}
// Report the drive's existence and put it up in the drive register.
DriveC
onfig
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
tape
::
daemon
::
Tpc
onfig
Line
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
common
::
dataStructures
::
DriveInfo
driveInfo
;
driveInfo
.
driveName
=
driveConfig
.
m_
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
m_logical
Library
;
driveInfo
.
driveName
=
driveConfig
.
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
raw
Library
Slot
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
m_
unitName
,
true
,
false
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
);
// Create the data transfer session
DataTransferConfig
castorConf
;
...
...
@@ -1326,13 +1326,13 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullMigration) {
}
}
// Report the drive's existence and put it up in the drive register.
DriveC
onfig
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
tape
::
daemon
::
Tpc
onfig
Line
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
common
::
dataStructures
::
DriveInfo
driveInfo
;
driveInfo
.
driveName
=
driveConfig
.
m_
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
m_logical
Library
;
driveInfo
.
driveName
=
driveConfig
.
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
raw
Library
Slot
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
m_
unitName
,
true
,
false
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
);
// Create the data transfer session
DataTransferConfig
castorConf
;
...
...
@@ -1474,13 +1474,13 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullOnFlushMigration) {
}
}
// Report the drive's existence and put it up in the drive register.
DriveC
onfig
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
tape
::
daemon
::
Tpc
onfig
Line
driveConfig
(
"T10D6116"
,
"TestLogicalLibrary"
,
"/dev/tape_T10D6116"
,
"manual"
);
cta
::
common
::
dataStructures
::
DriveInfo
driveInfo
;
driveInfo
.
driveName
=
driveConfig
.
m_
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
m_logical
Library
;
driveInfo
.
driveName
=
driveConfig
.
unitName
;
driveInfo
.
logicalLibrary
=
driveConfig
.
raw
Library
Slot
;
// We need to create the drive in the registry before being able to put it up.
scheduler
.
reportDriveStatus
(
driveInfo
,
cta
::
common
::
dataStructures
::
MountType
::
NoMount
,
cta
::
common
::
dataStructures
::
DriveStatus
::
Down
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
m_
unitName
,
true
,
false
);
scheduler
.
setDesiredDriveState
(
s_adminOnAdminHost
,
driveConfig
.
unitName
,
true
,
false
);
// Create the data transfer session
DataTransferConfig
castorConf
;
...
...
tapeserver/castor/tape/tapeserver/daemon/DriveConfig.cpp
deleted
100644 → 0
View file @
5181643c
/******************************************************************************
*
* 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
*****************************************************************************/
#include
"castor/tape/tapeserver/daemon/DriveConfig.hpp"
#include
"common/exception/Exception.cpp"
#include
"mediachanger/LibrarySlotParser.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor
::
tape
::
tapeserver
::
daemon
::
DriveConfig
::
DriveConfig
()
throw
()
:
m_librarySlot
(
0
)
{
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor
::
tape
::
tapeserver
::
daemon
::
DriveConfig
::
DriveConfig
(
const
std
::
string
&
unitName
,
const
std
::
string
&
logicalLibrary
,
const
std
::
string
&
devFilename
,
const
std
::
string
&
librarySlot
)
:
m_unitName
(
unitName
),
m_logicalLibrary
(
logicalLibrary
),
m_devFilename
(
devFilename
),
m_librarySlot
(
cta
::
mediachanger
::
LibrarySlotParser
::
parse
(
librarySlot
))
{
}
//------------------------------------------------------------------------------
// copy constructor
//------------------------------------------------------------------------------
castor
::
tape
::
tapeserver
::
daemon
::
DriveConfig
::
DriveConfig
(
const
DriveConfig
&
obj
)
:
m_unitName
(
obj
.
m_unitName
),
m_logicalLibrary
(
obj
.
m_logicalLibrary
),
m_devFilename
(
obj
.
m_devFilename
),
m_librarySlot
(
0
==
obj
.
m_librarySlot
?
0
:
obj
.
m_librarySlot
->
clone
())
{
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor
::
tape
::
tapeserver
::
daemon
::
DriveConfig
::~
DriveConfig
()
throw
()
{
delete
m_librarySlot
;
}
//------------------------------------------------------------------------------
// assignment operator
//------------------------------------------------------------------------------
castor
::
tape
::
tapeserver
::
daemon
::
DriveConfig
&
castor
::
tape
::
tapeserver
::
daemon
::
DriveConfig
::
operator
=
(
const
DriveConfig
&
rhs
)
{
// If this is not a self assigment
if
(
this
!=
&
rhs
)
{
// Avoid a memory leak
delete
(
m_librarySlot
);
m_unitName
=
rhs
.
m_unitName
;
m_logicalLibrary
=
rhs
.
m_logicalLibrary
;
m_devFilename
=
rhs
.
m_devFilename
;
m_librarySlot
=
0
==
rhs
.
m_librarySlot
?
0
:
rhs
.
m_librarySlot
->
clone
();
}
return
*
this
;
}
//------------------------------------------------------------------------------
// getUnitName
//------------------------------------------------------------------------------
const
std
::
string
&
castor
::
tape
::
tapeserver
::
daemon
::
DriveConfig
::
getUnitName
()
const
throw
()
{
return
m_unitName
;
}
//------------------------------------------------------------------------------
// getLogicalLibrary
//------------------------------------------------------------------------------
const
std
::
string
&
castor
::
tape
::
tapeserver
::
daemon
::
DriveConfig
::
getLogicalLibrary
()
const
throw
()
{
return
m_logicalLibrary
;
}
//------------------------------------------------------------------------------
// getDevFilename
//------------------------------------------------------------------------------
const
std
::
string
&
castor
::
tape
::
tapeserver
::
daemon
::
DriveConfig
::
getDevFilename
()
const
throw
()
{
return
m_devFilename
;
}
//------------------------------------------------------------------------------
// getLibrarySlot
//------------------------------------------------------------------------------
const
cta
::
mediachanger
::
LibrarySlot
&
castor
::
tape
::
tapeserver
::
daemon
::
DriveConfig
::
getLibrarySlot
()
const
{
if
(
0
==
m_librarySlot
)
{
cta
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to get library slot: Value not set"
;
throw
ex
;
}
return
*
m_librarySlot
;
}
tapeserver/castor/tape/tapeserver/daemon/DriveConfig.hpp
deleted
100644 → 0
View file @
5181643c
/******************************************************************************