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
d86b3be9
Commit
d86b3be9
authored
Feb 16, 2015
by
Steven Murray
Browse files
Renamed ProbeSession to EmptyDriveProbe
parent
74ecd964
Changes
4
Hide whitespace changes
Inline
Side-by-side
castor/tape/tapeserver/daemon/CMakeLists.txt
View file @
d86b3be9
...
...
@@ -41,6 +41,7 @@ add_library(castorTapeServerDaemon
DiskWriteThreadPool.cpp
DriveConfig.cpp
DriveConfigMap.cpp
EmptyDriveProbe.cpp
TapeServerReporter.cpp
LabelCmdAcceptHandler.cpp
LabelCmdConnectionHandler.cpp
...
...
@@ -49,7 +50,6 @@ add_library(castorTapeServerDaemon
MigrationReportPacker.cpp
MigrationTaskInjector.cpp
DataTransferSession.cpp
ProbeSession.cpp
ProcessForker.cpp
ProcessForkerConnectionHandler.cpp
ProcessForkerProxy.cpp
...
...
castor/tape/tapeserver/daemon/CatalogueDrive.cpp
View file @
d86b3be9
...
...
@@ -24,7 +24,7 @@
#include "castor/exception/Exception.hpp"
#include "castor/tape/tapeserver/daemon/CatalogueDrive.hpp"
#include "castor/tape/tapeserver/daemon/Constants.hpp"
#include "castor/tape/tapeserver/daemon/
ProbeSession
.hpp"
#include "castor/tape/tapeserver/daemon/
EmptyDriveProbe
.hpp"
#include "castor/utils/utils.hpp"
#include "h/Ctape_constants.h"
#include "h/rmc_constants.h"
...
...
@@ -399,11 +399,9 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::
// checkDriveIsEmpty
//-----------------------------------------------------------------------------
void
castor
::
tape
::
tapeserver
::
daemon
::
CatalogueDrive
::
checkDriveIsEmpty
()
{
ProbeSession
probeSession
(
m_log
,
m_config
,
m_sysWrapper
);
EmptyDriveProbe
probe
(
m_log
,
m_config
,
m_sysWrapper
);
const
int
probeSessionExitCode
=
probeSession
.
execute
();
if
(
Session
::
MARK_DRIVE_AS_UP
!=
probeSessionExitCode
)
{
if
(
!
probe
.
driveIsEmpty
())
{
castor
::
exception
::
Exception
ex
(
ETDRVNOTREADYFORMNT
);
ex
.
getMessage
()
<<
"Drive "
<<
m_config
.
getUnitName
()
<<
" is not empty"
;
throw
ex
;
...
...
castor/tape/tapeserver/daemon/
ProbeSession
.cpp
→
castor/tape/tapeserver/daemon/
EmptyDriveProbe
.cpp
View file @
d86b3be9
...
...
@@ -21,12 +21,12 @@
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include "castor/tape/tapeserver/daemon/
ProbeSession
.hpp"
#include "castor/tape/tapeserver/daemon/
EmptyDriveProbe
.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor
::
tape
::
tapeserver
::
daemon
::
ProbeSession
::
ProbeSession
(
castor
::
tape
::
tapeserver
::
daemon
::
EmptyDriveProbe
::
EmptyDriveProbe
(
castor
::
log
::
Logger
&
log
,
const
DriveConfig
&
driveConfig
,
System
::
virtualWrapper
&
sysWrapper
)
:
...
...
@@ -36,14 +36,13 @@ castor::tape::tapeserver::daemon::ProbeSession::ProbeSession(
}
//------------------------------------------------------------------------------
//
execute
//
driveIsEmpty()
//------------------------------------------------------------------------------
castor
::
tape
::
tapeserver
::
daemon
::
Session
::
EndOfSessionAction
castor
::
tape
::
tapeserver
::
daemon
::
ProbeSession
::
execute
()
throw
()
{
bool
castor
::
tape
::
tapeserver
::
daemon
::
EmptyDriveProbe
::
driveIsEmpty
()
throw
()
{
std
::
string
errorMessage
;
try
{
return
exceptionThrowing
Execute
();
return
exceptionThrowing
DriveIsEmpty
();
}
catch
(
castor
::
exception
::
Exception
&
ex
)
{
errorMessage
=
ex
.
getMessage
().
str
();
}
catch
(
std
::
exception
&
se
)
{
...
...
@@ -57,14 +56,14 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
log
::
Param
(
"unitName"
,
m_driveConfig
.
getUnitName
()),
log
::
Param
(
"message"
,
errorMessage
)};
m_log
(
LOG_ERR
,
"Probe failed"
,
params
);
return
MARK_DRIVE_AS_DOWN
;
return
false
;
}
//------------------------------------------------------------------------------
// exceptionThrowing
Execute
// exceptionThrowing
DriveIsEmpty
//------------------------------------------------------------------------------
castor
::
tape
::
tapeserver
::
daemon
::
Session
::
EndOfSessionAction
castor
::
tape
::
tapeserver
::
daemon
::
ProbeSession
::
exceptionThrowing
Execute
()
{
bool
castor
::
tape
::
tapeserver
::
daemon
::
EmptyDriveProbe
::
exceptionThrowing
DriveIsEmpty
()
{
std
::
list
<
log
::
Param
>
params
;
params
.
push_back
(
log
::
Param
(
"unitName"
,
m_driveConfig
.
getUnitName
()));
...
...
@@ -73,10 +72,10 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
if
(
drive
.
hasTapeInPlace
())
{
m_log
(
LOG_INFO
,
"Probe found tape drive with a tape inside"
,
params
);
return
MARK_DRIVE_AS_DOWN
;
return
false
;
}
else
{
m_log
(
LOG_INFO
,
"Probe found tape drive is empty"
,
params
);
return
MARK_DRIVE_AS_UP
;
return
true
;
}
}
...
...
@@ -84,7 +83,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
// createDrive
//------------------------------------------------------------------------------
std
::
auto_ptr
<
castor
::
tape
::
tapeserver
::
drive
::
DriveInterface
>
castor
::
tape
::
tapeserver
::
daemon
::
ProbeSession
::
createDrive
()
{
castor
::
tape
::
tapeserver
::
daemon
::
EmptyDriveProbe
::
createDrive
()
{
SCSI
::
DeviceVector
dv
(
m_sysWrapper
);
SCSI
::
DeviceInfo
driveInfo
=
dv
.
findBySymlink
(
m_driveConfig
.
getDevFilename
());
...
...
castor/tape/tapeserver/daemon/
ProbeSession
.hpp
→
castor/tape/tapeserver/daemon/
EmptyDriveProbe
.hpp
View file @
d86b3be9
...
...
@@ -27,7 +27,6 @@
#include "castor/log/Logger.hpp"
#include "castor/mediachanger/MediaChangerFacade.hpp"
#include "castor/tape/tapeserver/daemon/DriveConfig.hpp"
#include "castor/tape/tapeserver/daemon/Session.hpp"
#include "castor/tape/tapeserver/drive/DriveInterface.hpp"
#include "castor/tape/tapeserver/file/Structures.hpp"
#include "castor/tape/tapeserver/SCSI/Device.hpp"
...
...
@@ -41,11 +40,9 @@ namespace tapeserver {
namespace
daemon
{
/**
* Class responsible for probing a tape drive to see if it empty and
* accessible. If the drive satisfies both of these criteria then the probe
* will recommend that the state of the drive should be marked as UP, else
* it will recommend DOWN.
* accessible.
*/
class
ProbeSession
:
public
Session
{
class
EmptyDriveProbe
{
public:
/**
...
...
@@ -55,19 +52,17 @@ namespace daemon {
* @param driveConfig Configuration of the tape drive to be probed.
* @param sysWrapper Object representing the operating system.
*/
ProbeSession
(
EmptyDriveProbe
(
castor
::
log
::
Logger
&
log
,
const
DriveConfig
&
driveConfig
,
System
::
virtualWrapper
&
sysWrapper
);
/**
* Execute the session and return the type of action to be performed
* immediately after the session has completed.
* Probes the tape drive to determine whether it is empty and accessible.
*
* @return Returns the type of action to be performed after the session has
* completed.
* @return True if the drive is empty and accessible.
*/
EndOfSessionAction
execute
()
throw
();
bool
driveIsEmpty
()
throw
();
private:
...
...
@@ -87,13 +82,11 @@ namespace daemon {
System
::
virtualWrapper
&
m_sysWrapper
;
/**
* Execute the session and return the type of action to be performed
* immediately after the session has completed.
* Probes the tape drive to determine whether it is empty and accessible.
*
* @return Returns the type of action to be performed after the session has
* completed.
* @return True if the drive is empty and accessible.
*/
EndOfSessionAction
exceptionThrowing
Execute
();
bool
exceptionThrowing
DriveIsEmpty
();
/**
* Creates and returns the object that represents the tape drive to be
...
...
@@ -103,7 +96,7 @@ namespace daemon {
*/
std
::
auto_ptr
<
drive
::
DriveInterface
>
createDrive
();
};
// class
ProbeSession
};
// class
EmptyDriveProbe
}
// namespace daemon
}
// namespace tapeserver
...
...
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