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
651ba1a1
Commit
651ba1a1
authored
Dec 02, 2014
by
Steven Murray
Browse files
Added VdqmProxy::getDriveStatus()
parent
55394bb9
Changes
67
Hide whitespace changes
Inline
Side-by-side
castor/acs/AcsDaemon.cpp
View file @
651ba1a1
...
...
@@ -26,6 +26,8 @@
#include
"castor/acs/Constants.hpp"
#include
"castor/acs/AcsDaemon.hpp"
#include
"castor/acs/AcsMessageHandler.hpp"
#include
"h/serrno.h"
#include
<memory>
#include
<signal.h>
...
...
castor/acs/AcsMessageHandler.cpp
View file @
651ba1a1
...
...
@@ -33,6 +33,7 @@
#include
"castor/messages/AcsMountTapeReadWrite.pb.h"
#include
"castor/messages/AcsDismountTape.pb.h"
#include
"castor/messages/AcsForceDismountTape.pb.h"
#include
"h/serrno.h"
#include
<sstream>
...
...
castor/acs/AcsRequestDismountTape.cpp
View file @
651ba1a1
...
...
@@ -23,6 +23,7 @@
#include
"castor/acs/AcsRequestDismountTape.hpp"
#include
"castor/exception/DismountFailed.hpp"
#include
"h/serrno.h"
//-----------------------------------------------------------------------------
// constructor
...
...
castor/db/ora/OraCnvSvc.cpp
View file @
651ba1a1
...
...
@@ -22,7 +22,6 @@
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
// Include Files
#include
"castor/Constants.hpp"
#include
"castor/IConverter.hpp"
#include
"castor/ICnvSvc.hpp"
...
...
@@ -31,19 +30,19 @@
#include
"castor/SvcFactory.hpp"
#include
"castor/db/DbParamsSvc.hpp"
#include
"castor/BaseAddress.hpp"
#include
"castor/db/ora/OraCnvSvc.hpp"
#include
"castor/db/ora/OraStatement.hpp"
#include
"castor/exception/BadVersion.hpp"
#include
"castor/exception/Exception.hpp"
#include
"castor/exception/InvalidArgument.hpp"
#include
"h/serrno.h"
#include
<sstream>
#include
<iomanip>
#include
<sys/types.h>
#include
<unistd.h>
#include
<linux/unistd.h>
// Local Files
#include
"castor/db/ora/OraCnvSvc.hpp"
//------------------------------------------------------------------------------
// External C function used for getting configuration from castor.conf file
//------------------------------------------------------------------------------
...
...
castor/db/ora/OraVdqmSvc.cpp
View file @
651ba1a1
...
...
@@ -37,9 +37,10 @@
#include
"castor/vdqm/TapeDriveCompatibility.hpp"
#include
"castor/vdqm/TapeRequest.hpp"
#include
"castor/vdqm/TapeServer.hpp"
#include
"h/serrno.h"
#include
"h/vdqm_constants.h"
#include
"
occi.h
"
#include
<
occi.h
>
#include
<Cuuid.h>
#include
<errno.h>
#include
<net.h>
...
...
castor/dlf/Dlf.cpp
View file @
651ba1a1
...
...
@@ -26,6 +26,7 @@
// Include Files
#include
"castor/dlf/Dlf.hpp"
#include
"castor/exception/Exception.hpp"
#include
"h/serrno.h"
#include
<errno.h>
...
...
castor/exception/Exception.cpp
View file @
651ba1a1
...
...
@@ -22,8 +22,9 @@
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#define _XOPEN_SOURCE 600
// Local Files
#include
"Exception.hpp"
#include
"castor/exception/Exception.hpp"
#include
"h/serrno.h"
//------------------------------------------------------------------------------
// constructor
...
...
castor/exception/Exception.hpp
View file @
651ba1a1
...
...
@@ -24,11 +24,10 @@
#pragma once
// Include Files
#include
"castor/exception/Backtrace.hpp"
#include
<serrno.h>
#include
<sstream>
#include
<exception>
#include
<sstream>
namespace
castor
{
...
...
castor/exception/TimeOut.cpp
View file @
651ba1a1
...
...
@@ -22,9 +22,8 @@
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
// Include Files
#include
"errno.h"
#include
"castor/exception/TimeOut.hpp"
#include
"h/serrno.h"
// -----------------------------------------------------------------------
// Constructor
...
...
castor/gc/DeletionThread.cpp
View file @
651ba1a1
...
...
@@ -22,7 +22,6 @@
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
// Include files
#include
"castor/gc/DeletionThread.hpp"
#include
"castor/gc/CephGlobals.hpp"
#include
"castor/Services.hpp"
...
...
@@ -30,7 +29,9 @@
#include
"castor/stager/IGCSvc.hpp"
#include
"castor/stager/GCLocalFile.hpp"
#include
"castor/System.hpp"
#include
"getconfent.h"
#include
"h/getconfent.h"
#include
"h/serrno.h"
#include
<radosstriper/libradosstriper.hpp>
#include
<vector>
...
...
castor/legacymsg/RmcProxyTcpIp.hpp
View file @
651ba1a1
...
...
@@ -28,6 +28,7 @@
#include
"castor/legacymsg/RmcUnmountMsgBody.hpp"
#include
"castor/utils/SmartFd.hpp"
#include
"h/rmc_constants.h"
#include
"h/serrno.h"
#include
<unistd.h>
#include
<sys/types.h>
...
...
castor/legacymsg/VdqmProxy.hpp
View file @
651ba1a1
...
...
@@ -88,8 +88,8 @@ public:
* @param unitName The unit name of the tape drive.
* @param dgn The device group name of the tape drive.
*/
virtual
void
setDriveDown
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
=
0
;
virtual
void
setDriveDown
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
=
0
;
/**
* Sets the status of the specified tape drive to up.
...
...
@@ -99,8 +99,8 @@ public:
* @param unitName The unit name of the tape drive.
* @param dgn The device group name of the tape drive.
*/
virtual
void
setDriveUp
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
=
0
;
virtual
void
setDriveUp
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
=
0
;
/**
* Assigns the specified mount session process to the specified tape
...
...
@@ -114,9 +114,9 @@ public:
* @param sessionPid The process ID of the tape-server daemon's mount-session
* process.
*/
virtual
void
assignDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
uint32_t
mountTransactionId
,
const
pid_t
sessionPid
)
=
0
;
virtual
void
assignDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
uint32_t
mountTransactionId
,
const
pid_t
sessionPid
)
=
0
;
/**
* Notifies the vdqmd daemon of the specified tape mount.
...
...
@@ -129,9 +129,9 @@ public:
* @param sessionPid The process ID of the tape-server daemon's mount-session
* process.
*/
virtual
void
tapeMounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
,
const
pid_t
sessionPid
)
=
0
;
virtual
void
tapeMounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
,
const
pid_t
sessionPid
)
=
0
;
/**
* Releases the specified tape drive.
...
...
@@ -145,9 +145,9 @@ public:
* @param sessionPid The process ID of the tape-server daemon's mount-session
* process.
*/
virtual
void
releaseDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
bool
forceUnmount
,
const
pid_t
sessionPid
)
=
0
;
virtual
void
releaseDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
bool
forceUnmount
,
const
pid_t
sessionPid
)
=
0
;
/**
* Notifies the vdqmd daemon that the specified tape has been dismounted.
...
...
@@ -158,8 +158,19 @@ public:
* @param dgn The device group name of the tape drive.
* @param vid The volume identifier of the mounted tape.
*/
virtual
void
tapeUnmounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
)
=
0
;
virtual
void
tapeUnmounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
)
=
0
;
/**
* Queries the vdqmd daemon for the status of the specified tape drive.
*
* @param unitName The unit name of the tap drive.
* @param dgn The device group name of the tape drive.
* @return The status of the tape drive.
*/
virtual
int
getDriveStatus
(
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
=
0
;
};
// class VdqmProxy
...
...
castor/legacymsg/VdqmProxyDummy.cpp
View file @
651ba1a1
...
...
@@ -77,8 +77,18 @@ void castor::legacymsg::VdqmProxyDummy::tapeMounted(const std::string &server, c
void
castor
::
legacymsg
::
VdqmProxyDummy
::
releaseDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
bool
forceUnmount
,
const
pid_t
sessionPid
)
{
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
// tapeUnmounted
//------------------------------------------------------------------------------
void
castor
::
legacymsg
::
VdqmProxyDummy
::
tapeUnmounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
)
{
}
//-----------------------------------------------------------------------------
// getDriveStatus
//-----------------------------------------------------------------------------
void
castor
::
legacymsg
::
VdqmProxyDummy
::
tapeUnmounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
)
{
int
castor
::
legacymsg
::
VdqmProxyDummy
::
getDriveStatus
(
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
{
return
0
;
}
castor/legacymsg/VdqmProxyDummy.hpp
View file @
651ba1a1
...
...
@@ -63,7 +63,7 @@ public:
* daemon.
* @return The job request from the vdqm.
*/
RtcpJobRqstMsgBody
receiveJob
(
const
int
connection
)
;
RtcpJobRqstMsgBody
receiveJob
(
const
int
connection
);
/**
* Sets the status of the specified tape drive to down.
...
...
@@ -73,7 +73,8 @@ public:
* @param unitName The unit name of the tape drive.
* @param dgn The device group name of the tape drive.
*/
void
setDriveDown
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
;
void
setDriveDown
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
);
/**
* Sets the status of the specified tape drive to up.
...
...
@@ -83,7 +84,8 @@ public:
* @param unitName The unit name of the tape drive.
* @param dgn The device group name of the tape drive.
*/
void
setDriveUp
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
;
void
setDriveUp
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
);
/**
* Sets the status of the specified tape drive to assign.
...
...
@@ -96,7 +98,9 @@ public:
* @param sessionPid The process ID of the tape-server daemon's mount-session
* process.
*/
void
assignDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
uint32_t
mountTransactionId
,
const
pid_t
sessionPid
)
;
void
assignDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
uint32_t
mountTransactionId
,
const
pid_t
sessionPid
);
/**
* Notifies the vdqmd daemon of the specified tape mount.
...
...
@@ -109,7 +113,8 @@ public:
* @param sessionPid The process ID of the tape-server daemon's mount-session
* process.
*/
void
tapeMounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
,
const
pid_t
sessionPid
)
;
void
tapeMounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
,
const
pid_t
sessionPid
);
/**
* Sets the status of the specified tape drive to release.
...
...
@@ -123,7 +128,8 @@ public:
* @param sessionPid The process ID of the tape-server daemon's mount-session
* process.
*/
void
releaseDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
bool
forceUnmount
,
const
pid_t
sessionPid
)
;
void
releaseDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
bool
forceUnmount
,
const
pid_t
sessionPid
);
/**
* Notifies the vdqmd daemon that the specified tape has been dismounted.
...
...
@@ -134,7 +140,17 @@ public:
* @param dgn The device group name of the tape drive.
* @param vid The volume identifier of the mounted tape.
*/
void
tapeUnmounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
)
;
void
tapeUnmounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
);
/**
* Queries the vdqmd daemon for the status of the specified tape drive.
*
* @param unitName The unit name of the tap drive.
* @param dgn The device group name of the tape drive.
* @return The status of the tape drive.
*/
int
getDriveStatus
(
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
);
private:
...
...
castor/legacymsg/VdqmProxyTcpIp.cpp
View file @
651ba1a1
...
...
@@ -51,7 +51,7 @@ castor::legacymsg::VdqmProxyTcpIp::~VdqmProxyTcpIp() throw() {
// setDriveDown
//------------------------------------------------------------------------------
void
castor
::
legacymsg
::
VdqmProxyTcpIp
::
setDriveDown
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
{
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
{
try
{
// Check parameters
if
(
server
.
empty
())
{
...
...
@@ -70,13 +70,13 @@ void castor::legacymsg::VdqmProxyTcpIp::setDriveDown(const std::string &server,
throw
ex
;
}
legacymsg
::
VdqmDrvRqstMsgBody
body
;
body
.
status
=
VDQM_UNIT_DOWN
;
castor
::
utils
::
copyString
(
body
.
server
,
server
);
castor
::
utils
::
copyString
(
body
.
drive
,
unitName
);
castor
::
utils
::
copyString
(
body
.
dgn
,
dgn
);
legacymsg
::
VdqmDrvRqstMsgBody
rqst
;
rqst
.
status
=
VDQM_UNIT_DOWN
;
castor
::
utils
::
copyString
(
rqst
.
server
,
server
);
castor
::
utils
::
copyString
(
rqst
.
drive
,
unitName
);
castor
::
utils
::
copyString
(
rqst
.
dgn
,
dgn
);
se
tDriveStatus
(
body
);
se
ndRqstRecvReply
(
rqst
);
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to set state of tape drive"
...
...
@@ -90,7 +90,7 @@ void castor::legacymsg::VdqmProxyTcpIp::setDriveDown(const std::string &server,
// setDriveUp
//------------------------------------------------------------------------------
void
castor
::
legacymsg
::
VdqmProxyTcpIp
::
setDriveUp
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
{
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
)
{
try
{
// Check parameters
if
(
server
.
empty
())
{
...
...
@@ -109,13 +109,13 @@ void castor::legacymsg::VdqmProxyTcpIp::setDriveUp(const std::string &server,
throw
ex
;
}
legacymsg
::
VdqmDrvRqstMsgBody
body
;
body
.
status
=
VDQM_UNIT_UP
;
castor
::
utils
::
copyString
(
body
.
server
,
server
);
castor
::
utils
::
copyString
(
body
.
drive
,
unitName
);
castor
::
utils
::
copyString
(
body
.
dgn
,
dgn
);
legacymsg
::
VdqmDrvRqstMsgBody
rqst
;
rqst
.
status
=
VDQM_UNIT_UP
;
castor
::
utils
::
copyString
(
rqst
.
server
,
server
);
castor
::
utils
::
copyString
(
rqst
.
drive
,
unitName
);
castor
::
utils
::
copyString
(
rqst
.
dgn
,
dgn
);
se
tDriveStatus
(
body
);
se
ndRqstRecvReply
(
rqst
);
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to set state of tape drive"
...
...
@@ -130,7 +130,7 @@ void castor::legacymsg::VdqmProxyTcpIp::setDriveUp(const std::string &server,
//------------------------------------------------------------------------------
void
castor
::
legacymsg
::
VdqmProxyTcpIp
::
assignDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
uint32_t
mountTransactionId
,
const
pid_t
sessionPid
)
{
const
uint32_t
mountTransactionId
,
const
pid_t
sessionPid
)
{
try
{
// Check parameters
if
(
server
.
empty
())
{
...
...
@@ -149,15 +149,15 @@ void castor::legacymsg::VdqmProxyTcpIp::assignDrive(const std::string &server,
throw
ex
;
}
legacymsg
::
VdqmDrvRqstMsgBody
body
;
body
.
status
=
VDQM_UNIT_ASSIGN
;
body
.
volReqId
=
mountTransactionId
;
body
.
jobId
=
sessionPid
;
castor
::
utils
::
copyString
(
body
.
server
,
server
);
castor
::
utils
::
copyString
(
body
.
drive
,
unitName
);
castor
::
utils
::
copyString
(
body
.
dgn
,
dgn
);
legacymsg
::
VdqmDrvRqstMsgBody
rqst
;
rqst
.
status
=
VDQM_UNIT_ASSIGN
;
rqst
.
volReqId
=
mountTransactionId
;
rqst
.
jobId
=
sessionPid
;
castor
::
utils
::
copyString
(
rqst
.
server
,
server
);
castor
::
utils
::
copyString
(
rqst
.
drive
,
unitName
);
castor
::
utils
::
copyString
(
rqst
.
dgn
,
dgn
);
se
tDriveStatus
(
body
);
se
ndRqstRecvReply
(
rqst
);
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to assign drive"
...
...
@@ -173,7 +173,7 @@ void castor::legacymsg::VdqmProxyTcpIp::assignDrive(const std::string &server,
//------------------------------------------------------------------------------
void
castor
::
legacymsg
::
VdqmProxyTcpIp
::
tapeMounted
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
std
::
string
&
vid
,
const
pid_t
sessionPid
)
{
const
pid_t
sessionPid
)
{
try
{
// Check parameters
if
(
server
.
empty
())
{
...
...
@@ -197,15 +197,15 @@ void castor::legacymsg::VdqmProxyTcpIp::tapeMounted(const std::string &server,
throw
ex
;
}
legacymsg
::
VdqmDrvRqstMsgBody
body
;
body
.
status
=
VDQM_VOL_MOUNT
;
body
.
jobId
=
sessionPid
;
castor
::
utils
::
copyString
(
body
.
volId
,
vid
);
castor
::
utils
::
copyString
(
body
.
server
,
server
);
castor
::
utils
::
copyString
(
body
.
drive
,
unitName
);
castor
::
utils
::
copyString
(
body
.
dgn
,
dgn
);
legacymsg
::
VdqmDrvRqstMsgBody
rqst
;
rqst
.
status
=
VDQM_VOL_MOUNT
;
rqst
.
jobId
=
sessionPid
;
castor
::
utils
::
copyString
(
rqst
.
volId
,
vid
);
castor
::
utils
::
copyString
(
rqst
.
server
,
server
);
castor
::
utils
::
copyString
(
rqst
.
drive
,
unitName
);
castor
::
utils
::
copyString
(
rqst
.
dgn
,
dgn
);
se
tDriveStatus
(
body
);
se
ndRqstRecvReply
(
rqst
);
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to notify vdqm that tape is mounted"
...
...
@@ -221,12 +221,10 @@ void castor::legacymsg::VdqmProxyTcpIp::tapeMounted(const std::string &server,
//------------------------------------------------------------------------------
void
castor
::
legacymsg
::
VdqmProxyTcpIp
::
releaseDrive
(
const
std
::
string
&
server
,
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
bool
forceUnmount
,
const
pid_t
sessionPid
)
{
const
pid_t
sessionPid
)
{
int
status
=
VDQM_UNIT_RELEASE
;
if
(
forceUnmount
)
{
status
|=
VDQM_FORCE_UNMOUNT
;
}
const
int
status
=
forceUnmount
?
VDQM_UNIT_RELEASE
|
VDQM_FORCE_UNMOUNT
:
VDQM_UNIT_RELEASE
;
try
{
// Check parameters
...
...
@@ -246,14 +244,14 @@ void castor::legacymsg::VdqmProxyTcpIp::releaseDrive(const std::string &server,
throw
ex
;
}
legacymsg
::
VdqmDrvRqstMsgBody
body
;
body
.
status
=
status
;
body
.
jobId
=
sessionPid
;
castor
::
utils
::
copyString
(
body
.
server
,
server
);
castor
::
utils
::
copyString
(
body
.
drive
,
unitName
);
castor
::
utils
::
copyString
(
body
.
dgn
,
dgn
);
legacymsg
::
VdqmDrvRqstMsgBody
rqst
;
rqst
.
status
=
status
;
rqst
.
jobId
=
sessionPid
;
castor
::
utils
::
copyString
(
rqst
.
server
,
server
);
castor
::
utils
::
copyString
(
rqst
.
drive
,
unitName
);
castor
::
utils
::
copyString
(
rqst
.
dgn
,
dgn
);
se
tDriveStatus
(
body
);
se
ndRqstRecvReply
(
rqst
);
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to release tape drive"
...
...
@@ -265,21 +263,23 @@ void castor::legacymsg::VdqmProxyTcpIp::releaseDrive(const std::string &server,
}
//------------------------------------------------------------------------------
// se
tDriveStatus
// se
ndRqstRecvReply
//------------------------------------------------------------------------------
void
castor
::
legacymsg
::
VdqmProxyTcpIp
::
setDriveStatus
(
const
legacymsg
::
VdqmDrvRqstMsgBody
&
body
)
{
castor
::
legacymsg
::
VdqmDrvRqstMsgBody
castor
::
legacymsg
::
VdqmProxyTcpIp
::
sendRqstRecvReply
(
const
legacymsg
::
VdqmDrvRqstMsgBody
&
rqst
)
{
castor
::
utils
::
SmartFd
fd
(
connectToVdqm
());
writeDriveStatusMsg
(
fd
.
get
(),
body
);
writeDriveStatusMsg
(
fd
.
get
(),
rqst
);
readCommitAck
(
fd
.
get
());
const
legacymsg
::
MessageHeader
header
=
readDriveStatusMsgHeader
(
fd
.
get
());
readDriveStatusMsgBody
(
fd
.
get
(),
header
.
lenOrStatus
);
const
legacymsg
::
VdqmDrvRqstMsgBody
reply
=
readDriveStatusMsgBody
(
fd
.
get
(),
header
.
lenOrStatus
);
writeCommitAck
(
fd
.
get
());
return
reply
;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
// connectToVdqm
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
int
castor
::
legacymsg
::
VdqmProxyTcpIp
::
connectToVdqm
()
const
{
castor
::
utils
::
SmartFd
smartConnectSock
;
try
{
...
...
@@ -295,11 +295,11 @@ int castor::legacymsg::VdqmProxyTcpIp::connectToVdqm() const {
return
smartConnectSock
.
release
();
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
// writeDriveStatusMsg
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
void
castor
::
legacymsg
::
VdqmProxyTcpIp
::
writeDriveStatusMsg
(
const
int
fd
,
const
legacymsg
::
VdqmDrvRqstMsgBody
&
body
)
{
const
legacymsg
::
VdqmDrvRqstMsgBody
&
body
)
{
char
buf
[
VDQM_MSGBUFSIZ
];
const
size_t
len
=
legacymsg
::
marshal
(
buf
,
body
);
...
...
@@ -313,10 +313,10 @@ void castor::legacymsg::VdqmProxyTcpIp::writeDriveStatusMsg(const int fd,
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
// readCommitAck
//-----------------------------------------------------------------------------
void
castor
::
legacymsg
::
VdqmProxyTcpIp
::
readCommitAck
(
const
int
fd
)
{
//-----------------------------------------------------------------------------
-
void
castor
::
legacymsg
::
VdqmProxyTcpIp
::
readCommitAck
(
const
int
fd
)
{
legacymsg
::
MessageHeader
ack
;
try
{
...
...
@@ -340,10 +340,9 @@ void castor::legacymsg::VdqmProxyTcpIp::readCommitAck(const int fd) {
return
;
}
else
if
(
0
<
ack
.
reqType
)
{
// VDQM_COMMIT ack is reporting an error
char
errBuf
[
80
];
sstrerror_r
(
ack
.
reqType
,
errBuf
,
sizeof
(
errBuf
));
const
std
::
string
errStr
=
utils
::
serrnoToString
(
ack
.
reqType
);
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"VDQM_COMMIT ack reported an error: "
<<
err
Buf
;
ex
.
getMessage
()
<<
"VDQM_COMMIT ack reported an error: "
<<
err
Str
;
throw
ex
;
}
else
{
// VDQM_COMMIT ack contains an invalid request type
...
...
@@ -354,11 +353,11 @@ void castor::legacymsg::VdqmProxyTcpIp::readCommitAck(const int fd) {
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
// readAck
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
castor
::
legacymsg
::
MessageHeader
castor
::
legacymsg
::
VdqmProxyTcpIp
::
readAck
(
const
int
fd
)
{
const
int
fd
)
{
char
buf
[
12
];
// Magic + type + len
legacymsg
::
MessageHeader
ack
;
...
...
@@ -378,9 +377,9 @@ castor::legacymsg::MessageHeader castor::legacymsg::VdqmProxyTcpIp::readAck(
return
ack
;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
// readDriveStatusMsgHeader
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
castor
::
legacymsg
::
MessageHeader
castor
::
legacymsg
::
VdqmProxyTcpIp
::
readDriveStatusMsgHeader
(
const
int
fd
)
{
char
buf
[
12
];
// Magic + type + len
...
...
@@ -420,11 +419,11 @@ castor::legacymsg::MessageHeader castor::legacymsg::VdqmProxyTcpIp::
return
header
;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
// readDriveStatusMsgBody
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-
castor
::
legacymsg
::
VdqmDrvRqstMsgBody
castor
::
legacymsg
::
VdqmProxyTcpIp
::
readDriveStatusMsgBody
(
const
int
fd
,
const
uint32_t
bodyLen
)
{
readDriveStatusMsgBody
(
const
int
fd
,
const
uint32_t
bodyLen
)
{
char
buf
[
VDQM_MSGBUFSIZ
];
if
(
sizeof
(
buf
)
<
bodyLen
)
{
...
...
@@ -451,10 +450,10 @@ castor::legacymsg::VdqmDrvRqstMsgBody castor::legacymsg::VdqmProxyTcpIp::
return
body
;
}