Skip to content
GitLab
Menu
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
7a924217
Commit
7a924217
authored
Sep 27, 2017
by
Steven Murray
Browse files
setProcessCapabilities() now called at start of DataTransferSession::execute()
parent
b4013289
Changes
5
Hide whitespace changes
Inline
Side-by-side
tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp
View file @
7a924217
...
...
@@ -69,6 +69,27 @@ castor::tape::tapeserver::daemon::DataTransferSession::DataTransferSession(
{
}
//------------------------------------------------------------------------------
// setProcessCapabilities
//------------------------------------------------------------------------------
/**
* This function will try to set the cap_sys_rawio capability that is needed
* for by tape thread to access /dev/nst
*/
void
castor
::
tape
::
tapeserver
::
daemon
::
DataTransferSession
::
setProcessCapabilities
(
const
std
::
string
&
capabilities
){
cta
::
log
::
LogContext
lc
(
m_log
);
try
{
m_capUtils
.
setProcText
(
capabilities
);
cta
::
log
::
LogContext
::
ScopedParam
sp
(
lc
,
cta
::
log
::
Param
(
"capabilities"
,
m_capUtils
.
getProcText
()));
lc
.
log
(
cta
::
log
::
INFO
,
"Set process capabilities for using tape"
);
}
catch
(
const
cta
::
exception
::
Exception
&
ne
)
{
lc
.
log
(
cta
::
log
::
ERR
,
"Failed to set process capabilities for using the tape "
);
}
}
//------------------------------------------------------------------------------
//DataTransferSession::execute
//------------------------------------------------------------------------------
...
...
@@ -87,6 +108,8 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
// Create a sticky thread name, which will be overridden by the other threads
lc
.
pushOrReplace
(
cta
::
log
::
Param
(
"thread"
,
"MainThread"
));
lc
.
pushOrReplace
(
cta
::
log
::
Param
(
"unitName"
,
m_driveConfig
.
unitName
));
setProcessCapabilities
(
"cap_sys_rawio+ep"
);
// 2a) Determine if we want to mount at all (for now)
// This variable will allow us to see if we switched from down to up and start a
...
...
tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.hpp
View file @
7a924217
...
...
@@ -88,6 +88,13 @@ namespace daemon {
*/
EndOfSessionAction
execute
();
/**
* Sets the capabilities of the process and logs the result.
*
* @param capabilities The string representation of the capabilities.
*/
void
setProcessCapabilities
(
const
std
::
string
&
capabilities
);
/** Temporary method used for debugging while building the session class */
std
::
string
getVid
()
{
return
m_volInfo
.
vid
;
}
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.cpp
View file @
7a924217
...
...
@@ -205,12 +205,8 @@ const char *castor::tape::tapeserver::daemon::TapeReadSingleThread::
void
castor
::
tape
::
tapeserver
::
daemon
::
TapeReadSingleThread
::
run
()
{
m_logContext
.
pushOrReplace
(
cta
::
log
::
Param
(
"thread"
,
"TapeRead"
));
cta
::
utils
::
Timer
timer
,
totalTimer
;
std
::
string
currentErrorToCount
=
"Error_
setCapabilities
"
;
std
::
string
currentErrorToCount
=
"Error_
tapeMountForRead
"
;
try
{
// Set capabilities allowing rawio (and hence arbitrary SCSI commands)
// through the st driver file descriptor.
setCapabilities
();
// Report the parameters of the session to the main thread
typedef
cta
::
log
::
Param
Param
;
m_watchdog
.
addParameter
(
Param
(
"TPVID"
,
m_volInfo
.
vid
));
...
...
@@ -227,7 +223,6 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::run() {
// will also take care of the TapeServerReporter and of RecallTaskInjector
TapeCleaning
tapeCleaner
(
*
this
,
timer
);
// Before anything, the tape should be mounted
currentErrorToCount
=
"Error_tapeMountForRead"
;
m_rrp
.
reportDriveStatus
(
cta
::
common
::
dataStructures
::
DriveStatus
::
Mounting
);
mountTapeReadOnly
();
currentErrorToCount
=
"Error_tapeLoad"
;
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeSingleThreadInterface.hpp
View file @
7a924217
...
...
@@ -95,22 +95,6 @@ protected:
/** Encryption helper object */
EncryptionControl
m_encryptionControl
;
/**
* This function will try to set the cap_sys_rawio capability that is needed
* for by tape thread to access /dev/nst
*/
void
setCapabilities
(){
try
{
m_capUtils
.
setProcText
(
"cap_sys_rawio+ep"
);
cta
::
log
::
LogContext
::
ScopedParam
sp
(
m_logContext
,
cta
::
log
::
Param
(
"capabilities"
,
m_capUtils
.
getProcText
()));
m_logContext
.
log
(
cta
::
log
::
INFO
,
"Set process capabilities for using tape"
);
}
catch
(
const
cta
::
exception
::
Exception
&
ne
)
{
m_logContext
.
log
(
cta
::
log
::
ERR
,
"Failed to set process capabilities for using the tape "
);
}
}
/**
* Try to mount the tape for read-only access, get an exception if it fails
*/
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.cpp
View file @
7a924217
...
...
@@ -272,13 +272,9 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
// process we're in, and to count the error if it occurs.
// We will not record errors for an empty string. This will allow us to
// prevent counting where error happened upstream.
std
::
string
currentErrorToCount
=
"Error_
setCapabilities
"
;
std
::
string
currentErrorToCount
=
"Error_
tapeMountForWrite
"
;
try
{
// Set capabilities allowing rawio (and hence arbitrary SCSI commands)
// through the st driver file descriptor.
setCapabilities
();
// Report the parameters of the session to the main thread
typedef
cta
::
log
::
Param
Param
;
m_watchdog
.
addParameter
(
Param
(
"TPVID"
,
m_volInfo
.
vid
));
...
...
@@ -298,7 +294,6 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
// will also take care of the TapeServerReporter
//
TapeCleaning
cleaner
(
*
this
,
timer
);
currentErrorToCount
=
"Error_tapeMountForWrite"
;
m_reportPacker
.
reportDriveStatus
(
cta
::
common
::
dataStructures
::
DriveStatus
::
Mounting
,
m_logContext
);
// Before anything, the tape should be mounted
// This call does the logging of the mount
...
...
Write
Preview
Supports
Markdown
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