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
ab650fe2
Commit
ab650fe2
authored
Jan 23, 2015
by
Daniele Kruse
Browse files
Refactored code of the TEST UNIT READY
parent
673913c3
Changes
22
Hide whitespace changes
Inline
Side-by-side
castor/messages/ForkCleaner.proto
View file @
ab650fe2
...
...
@@ -31,7 +31,6 @@ message ForkCleaner {
required
string
vid
=
5
;
// Description of the cleaner job
// Warning, setting this value to 0 has the special meaning of NOT testing to
// see if the drive contains a tape.
required
uint32
drivereadydelayinseconds
=
6
;
required
bool
waitMediaInDrive
=
6
;
required
uint32
waitMediaInDriveTimeout
=
7
;
}
castor/messages/ForkProbe.proto
View file @
ab650fe2
...
...
@@ -26,7 +26,4 @@ message ForkProbe {
required
string
dgn
=
2
;
required
string
devfilename
=
3
;
required
string
libraryslot
=
4
;
// Description of the probe job
required
uint32
drivereadydelayinseconds
=
6
;
}
\ No newline at end of file
castor/tape/tapeserver/daemon/CatalogueCleanerSession.cpp
View file @
ab650fe2
...
...
@@ -36,10 +36,11 @@ castor::tape::tapeserver::daemon::CatalogueCleanerSession *
ProcessForkerProxy
&
processForker
,
const
std
::
string
&
vid
,
const
time_t
assignmentTime
,
const
uint32_t
driveReadyDelayInSeconds
)
{
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
)
{
const
pid_t
pid
=
processForker
.
forkCleaner
(
driveConfig
,
vid
,
driveReadyDelayInSeconds
);
const
pid_t
pid
=
processForker
.
forkCleaner
(
driveConfig
,
vid
,
waitMediaInDrive
,
waitMediaInDriveTimeout
);
return
new
CatalogueCleanerSession
(
log
,
...
...
castor/tape/tapeserver/daemon/CatalogueCleanerSession.hpp
View file @
ab650fe2
...
...
@@ -54,8 +54,10 @@ public:
* be set to the empty string.
* @param assignmentTime The time at which a job was assigned to the tape
* drive.
* @param driveReadyDelayInSeconds The maximum number of seconds to wait for
* the drive to be raedy with a tape inside of it.
* @param waitMediaInDrive true if we want to check the presence of the media in the drive before cleaning,
* false otherwise.
* @param waitMediaInDriveTimeout The maximum number of seconds to wait for
* the media to be ready for operations inside the drive.
* @return A newly created CatalogueCleanerSession object.
*/
static
CatalogueCleanerSession
*
create
(
...
...
@@ -65,7 +67,8 @@ public:
ProcessForkerProxy
&
processForker
,
const
std
::
string
&
vid
,
const
time_t
assignmentTime
,
const
uint32_t
driveReadyDelayInSeconds
);
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
);
/**
* Handles a tick in time. Time driven actions such as alarms should be
...
...
castor/tape/tapeserver/daemon/CatalogueDrive.cpp
View file @
ab650fe2
...
...
@@ -536,7 +536,8 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::receivedLabelJob(
castor
::
tape
::
tapeserver
::
daemon
::
CatalogueCleanerSession
*
castor
::
tape
::
tapeserver
::
daemon
::
CatalogueDrive
::
createCleaner
(
const
std
::
string
&
vid
,
const
time_t
assignmentTime
,
const
uint32_t
driveReadyDelayInSeconds
)
const
{
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
)
const
{
try
{
return
CatalogueCleanerSession
::
create
(
m_log
,
...
...
@@ -545,7 +546,8 @@ castor::tape::tapeserver::daemon::CatalogueCleanerSession
m_processForker
,
vid
,
assignmentTime
,
driveReadyDelayInSeconds
);
waitMediaInDrive
,
waitMediaInDriveTimeout
);
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to create cleaner session: "
<<
...
...
@@ -700,9 +702,10 @@ runningSessionKilled(uint32_t signal) {
session
->
sessionKilled
(
signal
);
if
(
CatalogueSession
::
SESSION_TYPE_CLEANER
!=
session
->
getType
())
{
const
uint32_t
driveReadyDelayInSeconds
=
60
;
const
uint32_t
waitMediaInDriveTimeout
=
60
;
const
bool
waitMediaInDrive
=
true
;
m_session
=
createCleaner
(
session
->
getVid
(),
session
->
getAssignmentTime
(),
driveReadyDelayInSeconds
);
waitMediaInDrive
,
waitMediaInDriveTimeout
);
}
else
{
changeState
(
DRIVE_STATE_DOWN
);
std
::
list
<
log
::
Param
>
params
;
...
...
@@ -725,9 +728,10 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::
session
->
sessionFailed
();
changeState
(
DRIVE_STATE_WAITSHUTDOWNCLEANER
);
const
uint32_t
driveReadyDelayInSeconds
=
60
;
const
uint32_t
waitMediaInDriveTimeout
=
60
;
const
bool
waitMediaInDrive
=
true
;
m_session
=
createCleaner
(
session
->
getVid
(),
session
->
getAssignmentTime
(),
driveReadyDelayInSeconds
);
waitMediaInDrive
,
waitMediaInDriveTimeout
);
}
//------------------------------------------------------------------------------
...
...
@@ -790,9 +794,10 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::
session
->
sessionFailed
();
if
(
CatalogueSession
::
SESSION_TYPE_CLEANER
!=
session
->
getType
())
{
const
uint32_t
driveReadyDelayInSeconds
=
60
;
const
uint32_t
waitMediaInDriveTimeout
=
60
;
const
bool
waitMediaInDrive
=
true
;
m_session
=
createCleaner
(
session
->
getVid
(),
session
->
getAssignmentTime
(),
driveReadyDelayInSeconds
);
waitMediaInDrive
,
waitMediaInDriveTimeout
);
}
else
{
changeState
(
DRIVE_STATE_DOWN
);
...
...
@@ -972,10 +977,11 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::shutdown() {
// Create a cleaner process to make 100% sure the tape drive is empty
const
std
::
string
vid
=
""
;
// Empty string means VID is not known
const
time_t
assignmentTime
=
time
(
NULL
);
// Setting driveReadyDelayInSeconds to 0 has the special meaning of
// NOT testing to see if the drive contains a tape
const
uint32_t
driveReadyDelayInSeconds
=
0
;
m_session
=
createCleaner
(
vid
,
assignmentTime
,
driveReadyDelayInSeconds
);
const
uint32_t
waitMediaInDriveTimeout
=
0
;
const
bool
waitMediaInDrive
=
false
;
m_session
=
createCleaner
(
vid
,
assignmentTime
,
waitMediaInDrive
,
waitMediaInDriveTimeout
);
// Else there is a running session
}
else
{
...
...
castor/tape/tapeserver/daemon/CatalogueDrive.hpp
View file @
ab650fe2
...
...
@@ -547,12 +547,15 @@ private:
* @param The assignment time associated with the tape drive or 0 if not
* known. The assignment time is given as the number of seconds elapsed
* since the Epoch.
* @param driveReadyDelayInSeconds The maximum number of seconds to wait for
* the drive to be raedy with a tape inside of it.
* @param waitMediaInDrive true if we want to check the presence of the media in the drive before cleaning,
* false otherwise.
* @param waitMediaInDriveTimeout The maximum number of seconds to wait for
* the media to be ready for operations inside the drive.
* @return The catalogue cleaner-session.
*/
CatalogueCleanerSession
*
createCleaner
(
const
std
::
string
&
vid
,
const
time_t
assignmentTime
,
const
uint32_t
driveReadyDelayInSeconds
)
const
;
const
time_t
assignmentTime
,
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
)
const
;
};
// class CatalogueDrive
...
...
castor/tape/tapeserver/daemon/CleanerSession.cpp
View file @
ab650fe2
...
...
@@ -33,14 +33,16 @@ castor::tape::tapeserver::daemon::CleanerSession::CleanerSession(
const
DriveConfig
&
driveConfig
,
System
::
virtualWrapper
&
sysWrapper
,
const
std
::
string
&
vid
,
const
uint32_t
driveReadyDelayInSeconds
)
:
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
)
:
m_capUtils
(
capUtils
),
m_mc
(
mc
),
m_log
(
log
),
m_driveConfig
(
driveConfig
),
m_sysWrapper
(
sysWrapper
),
m_vid
(
vid
),
m_driveReadyDelayInSeconds
(
driveReadyDelayInSeconds
)
{
m_waitMediaInDrive
(
waitMediaInDrive
),
m_waitMediaInDriveTimeout
(
waitMediaInDriveTimeout
)
{
}
//------------------------------------------------------------------------------
...
...
@@ -83,7 +85,9 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
std
::
auto_ptr
<
drive
::
DriveInterface
>
drivePtr
=
createDrive
();
drive
::
DriveInterface
&
drive
=
*
drivePtr
.
get
();
waitUntilDriveIsReady
(
drive
);
if
(
m_waitMediaInDrive
)
{
waitUntilMediaIsReady
(
drive
);
}
if
(
!
drive
.
hasTapeInPlace
())
{
m_log
(
LOG_INFO
,
"Cleaner found tape drive empty"
,
params
);
...
...
@@ -141,26 +145,22 @@ std::auto_ptr<castor::tape::tapeserver::drive::DriveInterface>
//------------------------------------------------------------------------------
// waitUntilDriveIsReady
//------------------------------------------------------------------------------
void
castor
::
tape
::
tapeserver
::
daemon
::
CleanerSession
::
waitUntilDriveIsReady
(
drive
::
DriveInterface
&
drive
)
{
// Warning, setting m_driveReadyDelayInSeconds to 0 has the special meaning of
// NOT testing to see if the drive contains a tape.
if
(
0
!=
m_driveReadyDelayInSeconds
)
{
std
::
list
<
log
::
Param
>
params
;
params
.
push_back
(
log
::
Param
(
"TPVID"
,
m_vid
));
params
.
push_back
(
log
::
Param
(
"unitName"
,
m_driveConfig
.
getUnitName
()));
params
.
push_back
(
log
::
Param
(
"driveReadyDelayInSeconds"
,
m_driveReadyDelayInSeconds
));
try
{
m_log
(
LOG_INFO
,
"Cleaner waiting for drive to be ready"
,
params
);
drive
.
waitUntilReady
(
m_driveReadyDelayInSeconds
);
m_log
(
LOG_INFO
,
"Cleaner detected drive is ready"
,
params
);
}
catch
(
castor
::
exception
::
Exception
&
ex
)
{
params
.
push_back
(
log
::
Param
(
"message"
,
ex
.
getMessage
().
str
()));
m_log
(
LOG_INFO
,
"Cleaner caught non-fatal exception whilst waiting for"
" drive to become ready"
,
params
);
}
void
castor
::
tape
::
tapeserver
::
daemon
::
CleanerSession
::
waitUntilMediaIsReady
(
drive
::
DriveInterface
&
drive
)
{
std
::
list
<
log
::
Param
>
params
;
params
.
push_back
(
log
::
Param
(
"TPVID"
,
m_vid
));
params
.
push_back
(
log
::
Param
(
"unitName"
,
m_driveConfig
.
getUnitName
()));
params
.
push_back
(
log
::
Param
(
"waitMediaInDriveTimeout"
,
m_waitMediaInDriveTimeout
));
try
{
m_log
(
LOG_INFO
,
"Cleaner waiting for drive to be ready"
,
params
);
drive
.
waitUntilReady
(
m_waitMediaInDriveTimeout
);
m_log
(
LOG_INFO
,
"Cleaner detected drive is ready"
,
params
);
}
catch
(
castor
::
exception
::
Exception
&
ex
)
{
params
.
push_back
(
log
::
Param
(
"message"
,
ex
.
getMessage
().
str
()));
m_log
(
LOG_INFO
,
"Cleaner caught non-fatal exception whilst waiting for"
" drive to become ready"
,
params
);
}
}
...
...
castor/tape/tapeserver/daemon/CleanerSession.hpp
View file @
ab650fe2
...
...
@@ -55,10 +55,10 @@ namespace daemon {
* @param sysWrapper Object representing the operating system.
* @param vid The volume identifier of the mounted tape if known,
* else the empty string.
* @param
driveReadyDelayInSeconds The maximum number of seconds to wait for
*
the drive to be ready with a tape inside of it. Warning, setting this
*
value to 0 has the special meaning of NOT testing to see if the drive
*
contains a tap
e.
* @param
waitMediaInDrive true if we want to check the presence of the media in the drive before cleaning,
*
false otherwise.
*
@param waitMediaInDriveTimeout The maximum number of seconds to wait for
*
the media to be ready for operations inside the driv
e.
*/
CleanerSession
(
server
::
ProcessCap
&
capUtils
,
...
...
@@ -67,7 +67,8 @@ namespace daemon {
const
DriveConfig
&
driveConfig
,
System
::
virtualWrapper
&
sysWrapper
,
const
std
::
string
&
vid
,
const
uint32_t
driveReadyDelayInSeconds
);
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
);
/**
* Execute the session and return the type of action to be performed
...
...
@@ -112,11 +113,16 @@ namespace daemon {
const
std
::
string
m_vid
;
/**
* The maximum number of seconds to wait for the drive to be raedy with a
* tape inside of it. Warning, setting this value to 0 has the special
* meaning of NOT testing to see if the drive contains a tape.
* true if we want to check the presence of the media in the drive before cleaning,
* false otherwise.
*/
const
bool
m_waitMediaInDrive
;
/**
* The maximum number of seconds to wait for
* the media to be ready for operations inside the drive.
*/
const
uint32_t
m_
driveReadyDelayInSeconds
;
const
uint32_t
m_
waitMediaInDriveTimeout
;
/**
* Execute the session and return the type of action to be performed
...
...
@@ -147,7 +153,7 @@ namespace daemon {
*
* @param drive The tape drive.
*/
void
waitUntil
Drive
IsReady
(
drive
::
DriveInterface
&
drive
);
void
waitUntil
Media
IsReady
(
drive
::
DriveInterface
&
drive
);
/**
* Rewinds the specified tape drive.
...
...
castor/tape/tapeserver/daemon/ProbeSession.cpp
View file @
ab650fe2
...
...
@@ -30,13 +30,11 @@ castor::tape::tapeserver::daemon::ProbeSession::ProbeSession(
server
::
ProcessCap
&
capUtils
,
castor
::
log
::
Logger
&
log
,
const
DriveConfig
&
driveConfig
,
System
::
virtualWrapper
&
sysWrapper
,
const
uint32_t
driveReadyDelayInSeconds
)
:
System
::
virtualWrapper
&
sysWrapper
)
:
m_capUtils
(
capUtils
),
m_log
(
log
),
m_driveConfig
(
driveConfig
),
m_sysWrapper
(
sysWrapper
),
m_driveReadyDelayInSeconds
(
driveReadyDelayInSeconds
)
{
m_sysWrapper
(
sysWrapper
)
{
}
//------------------------------------------------------------------------------
...
...
@@ -77,8 +75,6 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
std
::
auto_ptr
<
drive
::
DriveInterface
>
drivePtr
=
createDrive
();
drive
::
DriveInterface
&
drive
=
*
drivePtr
.
get
();
waitUntilDriveIsReady
(
drive
);
if
(
drive
.
hasTapeInPlace
())
{
m_log
(
LOG_INFO
,
"Probe found tape drive with a tape inside"
,
params
);
return
MARK_DRIVE_AS_DOWN
;
...
...
@@ -121,26 +117,3 @@ std::auto_ptr<castor::tape::tapeserver::drive::DriveInterface>
return
drive
;
}
//------------------------------------------------------------------------------
// waitUntilDriveIsReady
//------------------------------------------------------------------------------
void
castor
::
tape
::
tapeserver
::
daemon
::
ProbeSession
::
waitUntilDriveIsReady
(
drive
::
DriveInterface
&
drive
)
{
if
(
0
!=
m_driveReadyDelayInSeconds
)
{
std
::
list
<
log
::
Param
>
params
;
params
.
push_back
(
log
::
Param
(
"unitName"
,
m_driveConfig
.
getUnitName
()));
params
.
push_back
(
log
::
Param
(
"driveReadyDelayInSeconds"
,
m_driveReadyDelayInSeconds
));
try
{
m_log
(
LOG_INFO
,
"Probe waiting for drive to be ready"
,
params
);
drive
.
waitUntilReady
(
m_driveReadyDelayInSeconds
);
m_log
(
LOG_INFO
,
"Probe detected drive is ready"
,
params
);
}
catch
(
castor
::
exception
::
Exception
&
ex
)
{
params
.
push_back
(
log
::
Param
(
"message"
,
ex
.
getMessage
().
str
()));
m_log
(
LOG_INFO
,
"Probe caught non-fatal exception whilst waiting for"
" drive to become ready"
,
params
);
}
}
}
castor/tape/tapeserver/daemon/ProbeSession.hpp
View file @
ab650fe2
...
...
@@ -52,15 +52,12 @@ namespace daemon {
* @param log Object representing the API to the CASTOR logging system.
* @param driveConfig Configuration of the tape drive to be probed.
* @param sysWrapper Object representing the operating system.
* @param driveReadyDelayInSeconds The maximum number of seconds to wait for
* the drive to be raedy with a tape inside of it.
*/
ProbeSession
(
server
::
ProcessCap
&
capUtils
,
castor
::
log
::
Logger
&
log
,
const
DriveConfig
&
driveConfig
,
System
::
virtualWrapper
&
sysWrapper
,
const
uint32_t
driveReadyDelayInSeconds
);
System
::
virtualWrapper
&
sysWrapper
);
/**
* Execute the session and return the type of action to be performed
...
...
@@ -93,12 +90,6 @@ namespace daemon {
*/
System
::
virtualWrapper
&
m_sysWrapper
;
/**
* The maximum number of seconds to wait for the drive to be ready with a
* tape inside of it.
*/
const
uint32_t
m_driveReadyDelayInSeconds
;
/**
* Execute the session and return the type of action to be performed
* immediately after the session has completed.
...
...
@@ -122,13 +113,6 @@ namespace daemon {
* @return The tape drive.
*/
std
::
auto_ptr
<
drive
::
DriveInterface
>
createDrive
();
/**
* Waits for the specified drive to be ready.
*
* @param drive The tape drive.
*/
void
waitUntilDriveIsReady
(
drive
::
DriveInterface
&
drive
);
};
// class ProbeSession
...
...
castor/tape/tapeserver/daemon/ProcessForker.cpp
View file @
ab650fe2
...
...
@@ -291,8 +291,10 @@ castor::tape::tapeserver::daemon::ProcessForker::MsgHandlerResult
std
::
list
<
log
::
Param
>
params
;
params
.
push_back
(
log
::
Param
(
"unitName"
,
rqst
.
unitname
()));
params
.
push_back
(
log
::
Param
(
"TPVID"
,
rqst
.
vid
()));
params
.
push_back
(
log
::
Param
(
"driveReadyDelayInSeconds"
,
rqst
.
drivereadydelayinseconds
()));
params
.
push_back
(
log
::
Param
(
"waitMediaInDrive"
,
rqst
.
waitmediaindrive
()));
params
.
push_back
(
log
::
Param
(
"waitMediaInDriveTimeout"
,
rqst
.
waitmediaindrivetimeout
()));
m_log
(
LOG_INFO
,
"ProcessForker handling ForkCleaner message"
,
params
);
// Fork a label session
...
...
@@ -347,8 +349,6 @@ castor::tape::tapeserver::daemon::ProcessForker::MsgHandlerResult
// Log the contents of the incomming request
std
::
list
<
log
::
Param
>
params
;
params
.
push_back
(
log
::
Param
(
"unitName"
,
rqst
.
unitname
()));
params
.
push_back
(
log
::
Param
(
"driveReadyDelayInSeconds"
,
rqst
.
drivereadydelayinseconds
()));
m_log
(
LOG_INFO
,
"ProcessForker handling ForkProbe message"
,
params
);
// Fork a label session
...
...
@@ -527,6 +527,8 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
std
::
list
<
log
::
Param
>
params
;
params
.
push_back
(
log
::
Param
(
"unitName"
,
driveConfig
.
getUnitName
()));
params
.
push_back
(
log
::
Param
(
"TPVID"
,
rqst
.
vid
()));
params
.
push_back
(
log
::
Param
(
"waitMediaInDrive"
,
rqst
.
waitmediaindrive
()));
params
.
push_back
(
log
::
Param
(
"waitMediaInDriveTimeout"
,
rqst
.
waitmediaindrivetimeout
()));
m_log
(
LOG_INFO
,
"Cleaner-session child-process started"
,
params
);
const
int
sizeOfIOThreadPoolForZMQ
=
1
;
...
...
@@ -554,7 +556,8 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
driveConfig
,
sWrapper
,
rqst
.
vid
(),
rqst
.
drivereadydelayinseconds
());
rqst
.
waitmediaindrive
(),
rqst
.
waitmediaindrivetimeout
());
return
cleanerSession
.
execute
();
}
catch
(
castor
::
exception
::
Exception
&
ex
)
{
throw
ex
;
...
...
@@ -594,8 +597,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
capUtils
,
m_log
,
driveConfig
,
sWrapper
,
rqst
.
drivereadydelayinseconds
());
sWrapper
);
return
probeSession
.
execute
();
}
catch
(
castor
::
exception
::
Exception
&
ex
)
{
throw
ex
;
...
...
castor/tape/tapeserver/daemon/ProcessForkerProxy.hpp
View file @
ab650fe2
...
...
@@ -81,25 +81,23 @@ public:
* tape in the drive if there is in fact a tape in the drive and its volume
* identifier is known. If the volume identifier is not known then this
* parameter should be set to an empty string.
* @param
driveReadyDelayInSeconds The maximum number of seconds to wait for
*
the drive to be ready with a tape inside of it. Warning, setting this
*
value to 0 has the special meaning of NOT testing to see if the drive
*
contains a tap
e.
* @param
waitMediaInDrive true if we want to check the presence of the media in the drive before cleaning,
*
false otherwise.
*
@param waitMediaInDriveTimeout The maximum number of seconds to wait for
*
the media to be ready for operations inside the driv
e.
* @return The process identifier of the newly forked session.
*/
virtual
pid_t
forkCleaner
(
const
DriveConfig
&
driveConfig
,
const
std
::
string
&
vid
,
const
uint32_t
driveReadyDelayInSeconds
)
=
0
;
const
std
::
string
&
vid
,
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
)
=
0
;
/**
* Forks a probe session for the specified tape drive.
*
* @param driveConfig The configuration of the tape drive.
* @param driveReadyDelayInSeconds The maximum number of seconds to wait for
* the drive to be raedy with a tape inside of it.
* @return The process identifier of the newly forked session.
*/
virtual
pid_t
forkProbe
(
const
DriveConfig
&
driveConfig
,
const
uint32_t
driveReadyDelayInSeconds
)
=
0
;
virtual
pid_t
forkProbe
(
const
DriveConfig
&
driveConfig
)
=
0
;
};
// class ProcessForkerProxy
...
...
castor/tape/tapeserver/daemon/ProcessForkerProxyDummy.cpp
View file @
ab650fe2
...
...
@@ -56,7 +56,7 @@ pid_t castor::tape::tapeserver::daemon::ProcessForkerProxyDummy::
//------------------------------------------------------------------------------
pid_t
castor
::
tape
::
tapeserver
::
daemon
::
ProcessForkerProxyDummy
::
forkCleaner
(
const
DriveConfig
&
driveConfig
,
const
std
::
string
&
vid
,
const
uint32_t
driveReadyDelayInSeconds
)
{
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
)
{
// This is a dummy method and so intentionally does nothing
return
0
;
}
...
...
@@ -65,8 +65,7 @@ pid_t castor::tape::tapeserver::daemon::ProcessForkerProxyDummy::
// forkProbe
//------------------------------------------------------------------------------
pid_t
castor
::
tape
::
tapeserver
::
daemon
::
ProcessForkerProxyDummy
::
forkProbe
(
const
DriveConfig
&
driveConfig
,
const
uint32_t
driveReadyDelayInSeconds
)
{
forkProbe
(
const
DriveConfig
&
driveConfig
)
{
// This is a dummy method and so intentionally does nothing
return
0
;
}
castor/tape/tapeserver/daemon/ProcessForkerProxyDummy.hpp
View file @
ab650fe2
...
...
@@ -87,25 +87,23 @@ public:
* tape in the drive if there is in fact a tape in the drive and its volume
* identifier is known. If the volume identifier is not known then this
* parameter should be set to an empty string.
* @param
driveReadyDelayInSeconds The maximum number of seconds to wait for
*
the drive to be ready with a tape inside of it. Warning, setting this
*
value to 0 has the special meaning of NOT testing to see if the drive
*
contains a tap
e.
* @param
waitMediaInDrive true if we want to check the presence of the media in the drive before cleaning,
*
false otherwise.
*
@param waitMediaInDriveTimeout The maximum number of seconds to wait for
*
the media to be ready for operations inside the driv
e.
* @return The process identifier of the newly forked session.
*/
pid_t
forkCleaner
(
const
DriveConfig
&
driveConfig
,
const
std
::
string
&
vid
,
const
uint32_t
driveReadyDelayInSeconds
);
const
std
::
string
&
vid
,
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
);
/**
* Forks a probe session for the specified tape drive.
*
* @param driveConfig The configuration of the tape drive.
* @param driveReadyDelayInSeconds The maximum number of seconds to wait for
* the drive to be raedy with a tape inside of it.
* @return The process identifier of the newly forked session.
*/
virtual
pid_t
forkProbe
(
const
DriveConfig
&
driveConfig
,
const
uint32_t
driveReadyDelayInSeconds
);
virtual
pid_t
forkProbe
(
const
DriveConfig
&
driveConfig
);
};
// class ProcessForkerProxySocket
...
...
castor/tape/tapeserver/daemon/ProcessForkerProxySocket.cpp
View file @
ab650fe2
...
...
@@ -185,11 +185,12 @@ castor::messages::ForkLabel castor::tape::tapeserver::daemon::
//------------------------------------------------------------------------------
pid_t
castor
::
tape
::
tapeserver
::
daemon
::
ProcessForkerProxySocket
::
forkCleaner
(
const
DriveConfig
&
driveConfig
,
const
std
::
string
&
vid
,
const
uint32_t
driveReadyDelayInSeconds
)
{
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
)
{
// Request the process forker to fork a label session
const
messages
::
ForkCleaner
rqst
=
createForkCleanerMsg
(
driveConfig
,
vid
,
driveReadyDelayInSeconds
);
const
messages
::
ForkCleaner
rqst
=
createForkCleanerMsg
(
driveConfig
,
vid
,
waitMediaInDrive
,
waitMediaInDriveTimeout
);
ProcessForkerUtils
::
writeFrame
(
m_socketFd
,
rqst
);
// Read back the reply
...
...
@@ -209,7 +210,8 @@ pid_t castor::tape::tapeserver::daemon::ProcessForkerProxySocket::
castor
::
messages
::
ForkCleaner
castor
::
tape
::
tapeserver
::
daemon
::
ProcessForkerProxySocket
::
createForkCleanerMsg
(
const
DriveConfig
&
driveConfig
,
const
std
::
string
&
vid
,
const
uint32_t
driveReadyDelayInSeconds
)
{
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
)
{
messages
::
ForkCleaner
msg
;
// Description of the tape drive
...
...
@@ -219,7 +221,8 @@ castor::messages::ForkCleaner castor::tape::tapeserver::daemon::
msg
.
set_vid
(
vid
);
// Description of the cleaner job
msg
.
set_drivereadydelayinseconds
(
driveReadyDelayInSeconds
);
msg
.
set_waitmediaindrive
(
waitMediaInDrive
);
msg
.
set_waitmediaindrivetimeout
(
waitMediaInDriveTimeout
);
return
msg
;
}
...
...
@@ -228,12 +231,10 @@ castor::messages::ForkCleaner castor::tape::tapeserver::daemon::
// forkProbe
//------------------------------------------------------------------------------
pid_t
castor
::
tape
::
tapeserver
::
daemon
::
ProcessForkerProxySocket
::
forkProbe
(
const
DriveConfig
&
driveConfig
,
const
uint32_t
driveReadyDelayInSeconds
)
{
forkProbe
(
const
DriveConfig
&
driveConfig
)
{
// Request the process forker to fork a probe session
const
messages
::
ForkProbe
rqst
=
createForkProbeMsg
(
driveConfig
,
driveReadyDelayInSeconds
);
const
messages
::
ForkProbe
rqst
=
createForkProbeMsg
(
driveConfig
);
ProcessForkerUtils
::
writeFrame
(
m_socketFd
,
rqst
);
// Read back the reply
...
...
@@ -252,15 +253,11 @@ pid_t castor::tape::tapeserver::daemon::ProcessForkerProxySocket::
//------------------------------------------------------------------------------
castor
::
messages
::
ForkProbe
castor
::
tape
::
tapeserver
::
daemon
::
ProcessForkerProxySocket
::
createForkProbeMsg
(
const
DriveConfig
&
driveConfig
,
const
uint32_t
driveReadyDelayInSeconds
)
{
const
DriveConfig
&
driveConfig
)
{
messages
::
ForkProbe
msg
;
// Description of the tape drive
fillMsgWithDriveConfig
(
msg
,
driveConfig
);
// Description of the cleaner job
msg
.
set_drivereadydelayinseconds
(
driveReadyDelayInSeconds
);
return
msg
;
}
castor/tape/tapeserver/daemon/ProcessForkerProxySocket.hpp
View file @
ab650fe2
...
...
@@ -102,25 +102,22 @@ public:
* tape in the drive if there is in fact a tape in the drive and its volume
* identifier is known. If the volume identifier is not known then this
* parameter should be set to an empty string.
* @param
driveReadyDelayInSeconds The maximum number of seconds to wait for
*
the drive to be ready with a tape inside of it. Warning, setting this
*
value to 0 has the special meaning of NOT testing to see if the drive
*
contains a tap
e.
* @param
waitMediaInDrive true if we want to check the presence of the media in the drive before cleaning,
*
false otherwise.
*
@param waitMediaInDriveTimeout The maximum number of seconds to wait for
*
the media to be ready for operations inside the driv
e.
* @return The process identifier of the newly forked session.
*/
pid_t
forkCleaner
(
const
DriveConfig
&
driveConfig
,
const
std
::
string
&
vid
,
const
uint32_t
driveReadyDelayInSeconds
);
const
std
::
string
&
vid
,
const
bool
waitMediaInDrive
,
const
uint32_t
waitMediaInDriveTimeout
);