Commit 7deb1aa0 authored by Eric Cano's avatar Eric Cano
Browse files

Removed taped, rtcpd and tapebridged, which are replaced by tapeserverd.

The corresponding tape libraries have also been removed, at the exception of tpstat and tpconfig, which are still in use.
Their protocol has been re-implemented in tapeserverd. The configuration file TPCONFIG is also still kept in the tape/ directory.
parent edc85cbc
......@@ -185,7 +185,6 @@ ELSE(DEFINED PackageOnly)
add_subdirectory (security)
add_subdirectory (shlib)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (tapebridge)
add_subdirectory (traffic-shaping)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (upv)
......@@ -193,10 +192,7 @@ ELSE(DEFINED PackageOnly)
add_subdirectory (vmgr)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (xrootd)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (tape)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (rtcopy)
add_subdirectory (tape)
add_subdirectory (test)
endif (${COMPILE_SERVER} STREQUAL "1")
ENDIF(DEFINED PackageOnly)
......
......@@ -26,7 +26,6 @@ add_subdirectory (gatewayprotocol)
add_subdirectory (label)
add_subdirectory (reactor)
add_subdirectory (rmc)
add_subdirectory (tapebridge)
add_subdirectory (tapegateway)
add_subdirectory (tapeserver)
add_subdirectory (tpcp)
......
/******************************************************************************
*
* 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/exception/InvalidArgument.hpp"
#include "castor/io/ClientSocket.hpp"
#include "castor/io/io.hpp"
#include "castor/legacymsg/CommonMarshal.hpp"
#include "castor/legacymsg/MessageHeader.hpp"
#include "castor/tape/tapebridge/Constants.hpp"
#include "castor/tape/tapebridge/BridgeClientInfo2Sender.hpp"
#include "castor/tape/utils/utils.hpp"
#include "h/net.h"
#include "h/osdep.h"
#include "h/rtcp_constants.h"
#include "h/serrno.h"
#include "h/tapeBridgeClientInfo2MsgBody.h"
#include "h/tapebridge_constants.h"
#include "h/tapebridge_marshall.h"
#include "h/vdqm_constants.h"
#include <errno.h>
#include <string.h>
#include <unistd.h>
//------------------------------------------------------------------------------
// send
//------------------------------------------------------------------------------
void castor::tape::tapebridge::BridgeClientInfo2Sender::send(
const std::string &rtcpdHost,
const unsigned int rtcpdPort,
const int netReadWriteTimeout,
tapeBridgeClientInfo2MsgBody_t &msgBody,
legacymsg::RtcpJobReplyMsgBody &reply)
{
if(rtcpdHost.length() == 0) {
TAPE_THROW_EX(castor::exception::InvalidArgument,
": Length of rtcpdHost string is 0");
}
char buf[RTCPMSGBUFSIZE];
const int hdrPlusBodyLen = tapebridge_marshallTapeBridgeClientInfo2Msg(buf,
sizeof(buf), &msgBody);
int save_serrno = serrno;
if(hdrPlusBodyLen < 0) {
TAPE_THROW_CODE(save_serrno,
": Failed to marhsall tapeBridgeClientInfo2MsgBody_t"
": " << sstrerror(save_serrno));
}
// Connect to the rtcpd daemon
castor::io::ClientSocket sock(rtcpdPort, rtcpdHost);
sock.setTimeout(netReadWriteTimeout);
try {
sock.connect();
} catch(castor::exception::Exception &ex) {
TAPE_THROW_CODE(ECONNABORTED,
": Failed to connect to rtcpd"
": rtcpdHost: " << rtcpdHost <<
": rtcpdPort: " << rtcpdPort <<
": " << ex.getMessage().str());
}
// Send the job submission request message to the rtcpd or tape tapebridge
// daemon
try {
io::writeBytes(sock.socket(), netReadWriteTimeout, hdrPlusBodyLen, buf);
} catch(castor::exception::Exception &ex) {
TAPE_THROW_CODE(SECOMERR,
": Failed to send the TAPEBRIDGE_CLIENTINFO2 message to rtcpd" <<
": " << ex.getMessage().str());
}
// Read the reply from rtcpd daemon
readReply(sock, netReadWriteTimeout, reply);
}
//------------------------------------------------------------------------------
// readReply
//------------------------------------------------------------------------------
void castor::tape::tapebridge::BridgeClientInfo2Sender::readReply(
castor::io::AbstractTCPSocket &sock,
const int netReadWriteTimeout,
legacymsg::RtcpJobReplyMsgBody &reply)
{
// Read in the message header
char headerBuf[3 * sizeof(uint32_t)]; // magic + request type + len
try {
io::readBytes(sock.socket(), netReadWriteTimeout, sizeof(headerBuf),
headerBuf);
} catch (castor::exception::Exception &ex) {
TAPE_THROW_CODE(SECOMERR,
": Failed to read message header from rtcpd"
": " << ex.getMessage().str());
}
// Unmarshal the messager header
legacymsg::MessageHeader header;
try {
const char *p = headerBuf;
size_t remainingLen = sizeof(headerBuf);
legacymsg::unmarshal(p, remainingLen, header);
} catch(castor::exception::Exception &ex) {
TAPE_THROW_CODE(EBADMSG,
": Failed to unmarshal message header from rtcpd"
": " << ex.getMessage().str());
}
// If the magic number is invalid
if(header.magic != RTCOPY_MAGIC && header.magic != RTCOPY_MAGIC_OLD0) {
TAPE_THROW_CODE(EBADMSG,
std::hex <<
": Invalid magic number from rtcpd"
": Expected: 0x" << RTCOPY_MAGIC << " or 0x" << RTCOPY_MAGIC_OLD0 <<
": Received: 0x" << header.magic);
}
// If the request type is invalid
if(header.reqType != TAPEBRIDGE_CLIENTINFO2 &&
header.reqType != VDQM_CLIENTINFO) {
TAPE_THROW_CODE(EBADMSG,
std::hex <<
": Invalid request type from rtpcd"
": Expected: either TAPEBRIDGE_CLIENTINFO2=0x" <<
TAPEBRIDGE_CLIENTINFO2 <<
" or VDQM_CLIENTINFO=0x" << VDQM_CLIENTINFO <<
": Received: 0x" << header.reqType);
}
// If the request type is VDQM_CLIENTINFO then raise an exception because
// this means the rtcpd daemon was unable to determine that its client is the
// tapebridged daemon. It has therefore replied assuming the client is the
// vdqmd daemon.
if(header.reqType == VDQM_CLIENTINFO) {
TAPE_THROW_CODE(EBADMSG,
": rtcpd could not determine its client is in fact tapebridged.");
}
// If the message body is not large enough for a status number and an empty
// error string
{
const size_t minimumLen = sizeof(uint32_t) + 1;
if(header.lenOrStatus < minimumLen) {
TAPE_THROW_CODE(EMSGSIZE,
": Invalid header from rtcpd"
": Message body not large enough for a status number and an empty "
"string: Minimum size expected: " << minimumLen <<
": Received: " << header.lenOrStatus);
}
}
// Length of message header = 3 * sizeof(uint32_t)
char bodyBuf[RTCPMSGBUFSIZE - 3 * sizeof(uint32_t)];
// If the message body is larger than the message body buffer
if(header.lenOrStatus > sizeof(bodyBuf)) {
TAPE_THROW_CODE(EMSGSIZE,
": Message body from rtcpd is too large" <<
": Maximum: " << sizeof(bodyBuf) <<
": Received: " << header.lenOrStatus);
}
// Read the message body
try {
io::readBytes(sock.socket(), netReadWriteTimeout, header.lenOrStatus,
bodyBuf);
} catch (castor::exception::Exception &ex) {
TAPE_THROW_CODE(SECOMERR,
": Failed to read message body from rtpcd"
": " << ex.getMessage().str());
}
// Unmarshal the job submission reply
try {
const char *p = bodyBuf;
size_t remainingLen = header.lenOrStatus;
legacymsg::unmarshal(p, remainingLen, reply);
} catch(castor::exception::Exception &ex) {
TAPE_THROW_EX(castor::exception::Exception,
": Failed to unmarshal job submission reply"
": " << ex.getMessage().str());
}
}
/******************************************************************************
*
* 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
*****************************************************************************/
#pragma once
#include "castor/io/AbstractTCPSocket.hpp"
#include "castor/legacymsg/RtcpMarshal.hpp"
#include "h/tapebridge_marshall.h"
namespace castor {
namespace tape {
namespace tapebridge {
/**
* A helper class for sending client information from the tape-bridge to the
* rtcpd daemon.
*/
class BridgeClientInfo2Sender {
public:
/**
* Sends a TAPEBRIDGE_CLIENT info message to the rtcpd daemon and receives
* the reply.
*
* @param rtcpdHost The hostname of the rtcpd daemon.
* @param rtcpdPort The port number of the rtcpd daemon.
* @param netReadWriteTimeout The timeout in seconds to be used when
* performing network reads and writes.
* @param msgBody The body of the message to be sent.
* @param reply The reply from rtcpd which may be positive or
* negative.
*/
static void send(
const std::string &rtcpdHost,
const unsigned int rtcpdPort,
const int netReadWriteTimeout,
tapeBridgeClientInfo2MsgBody_t &msgBody,
legacymsg::RtcpJobReplyMsgBody &reply)
;
private:
/**
* Reads the reply of rtcpd daemon.
*
* @param sock The socket of the connection to the rtcpd
* daemon.
* @param netReadWriteTimeout The timeout to be used when performing
* network reads and writes.
* @param reply The reply from the rtcpd daemon.
*/
static void readReply(
castor::io::AbstractTCPSocket &sock,
const int netReadWriteTimeout,
legacymsg::RtcpJobReplyMsgBody &reply)
;
}; // class BridgeClientInfo2Sender
} // namespace tapebridge
} // namespace tape
} // namespace castor
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/******************************************************************************
*
* 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/tapebridge/BulkRequestConfigParams.hpp"
#include "castor/tape/tapebridge/Constants.hpp"
//-----------------------------------------------------------------------------
// constructor
//-----------------------------------------------------------------------------
castor::tape::tapebridge::BulkRequestConfigParams::BulkRequestConfigParams():
m_bulkRequestMigrationMaxBytes("TAPEBRIDGE", "BULKREQUESTMIGRATIONMAXBYTES"),
m_bulkRequestMigrationMaxFiles("TAPEBRIDGE", "BULKREQUESTMIGRATIONMAXFILES"),
m_bulkRequestRecallMaxBytes("TAPEBRIDGE", "BULKREQUESTRECALLMAXBYTES"),
m_bulkRequestRecallMaxFiles("TAPEBRIDGE", "BULKREQUESTRECALLMAXFILES") {
// Do nothing
}
//-----------------------------------------------------------------------------
// getBulkRequestMigrationMaxBytes
//-----------------------------------------------------------------------------
const castor::tape::tapebridge::ConfigParam<uint64_t> &
castor::tape::tapebridge::BulkRequestConfigParams::
getBulkRequestMigrationMaxBytes() const {
return m_bulkRequestMigrationMaxBytes;
}
//-----------------------------------------------------------------------------
// getBulkRequestMigrationMaxFiles
//-----------------------------------------------------------------------------
const castor::tape::tapebridge::ConfigParam<uint64_t> &
castor::tape::tapebridge::BulkRequestConfigParams::
getBulkRequestMigrationMaxFiles() const {
return m_bulkRequestMigrationMaxFiles;
}
//-----------------------------------------------------------------------------
// getBulkRequestRecallMaxBytes
//-----------------------------------------------------------------------------
const castor::tape::tapebridge::ConfigParam<uint64_t> &
castor::tape::tapebridge::BulkRequestConfigParams::
getBulkRequestRecallMaxBytes() const {
return m_bulkRequestRecallMaxBytes;
}
//-----------------------------------------------------------------------------
// getBulkRequestRecallMaxFiles
//-----------------------------------------------------------------------------
const castor::tape::tapebridge::ConfigParam<uint64_t> &
castor::tape::tapebridge::BulkRequestConfigParams::
getBulkRequestRecallMaxFiles() const {
return m_bulkRequestRecallMaxFiles;
}
//-----------------------------------------------------------------------------
// determineConfigParams
//-----------------------------------------------------------------------------
void castor::tape::tapebridge::BulkRequestConfigParams::determineConfigParams()
throw(castor::exception::InvalidArgument, castor::exception::Exception) {
determineBulkRequestMigrationMaxBytes();
determineBulkRequestMigrationMaxFiles();
determineBulkRequestRecallMaxBytes();
determineBulkRequestRecallMaxFiles();
}
//-----------------------------------------------------------------------------
// determineBulkRequestMigrationMaxBytes
//-----------------------------------------------------------------------------
void castor::tape::tapebridge::BulkRequestConfigParams::
determineBulkRequestMigrationMaxBytes()
throw(castor::exception::InvalidArgument, castor::exception::Exception) {
determineUint64ConfigParam(m_bulkRequestMigrationMaxBytes,
TAPEBRIDGE_BULKREQUESTMIGRATIONMAXBYTES);
}
//-----------------------------------------------------------------------------
// determineBulkRequestMigrationMaxFiles
//-----------------------------------------------------------------------------
void castor::tape::tapebridge::BulkRequestConfigParams::
determineBulkRequestMigrationMaxFiles()
throw(castor::exception::InvalidArgument, castor::exception::Exception) {
determineUint64ConfigParam(m_bulkRequestMigrationMaxFiles,
TAPEBRIDGE_BULKREQUESTMIGRATIONMAXFILES);
}
//-----------------------------------------------------------------------------
// determineBulkRequestRecallMaxBytes
//-----------------------------------------------------------------------------
void castor::tape::tapebridge::BulkRequestConfigParams::
determineBulkRequestRecallMaxBytes()
throw(castor::exception::InvalidArgument, castor::exception::Exception) {
determineUint64ConfigParam(m_bulkRequestRecallMaxBytes,
TAPEBRIDGE_BULKREQUESTRECALLMAXBYTES);
}
//-----------------------------------------------------------------------------
// determineBulkRequestRecallMaxFiles
//-----------------------------------------------------------------------------
void castor::tape::tapebridge::BulkRequestConfigParams::
determineBulkRequestRecallMaxFiles()
throw(castor::exception::InvalidArgument, castor::exception::Exception) {
determineUint64ConfigParam(m_bulkRequestRecallMaxFiles,
TAPEBRIDGE_BULKREQUESTRECALLMAXFILES);
}
//-----------------------------------------------------------------------------
// setBulkRequestMigrationMaxBytes
//-----------------------------------------------------------------------------
void castor::tape::tapebridge::BulkRequestConfigParams::
setBulkRequestMigrationMaxBytes(
const uint64_t value,
const ConfigParamSource::Enum source) {
m_bulkRequestMigrationMaxBytes.setValueAndSource(value, source);
}
//-----------------------------------------------------------------------------
// setBulkRequestMigrationMaxFiles
//-----------------------------------------------------------------------------
void castor::tape::tapebridge::BulkRequestConfigParams::
setBulkRequestMigrationMaxFiles(
const uint64_t value,
const ConfigParamSource::Enum source) {
m_bulkRequestMigrationMaxFiles.setValueAndSource(value, source);
}
//-----------------------------------------------------------------------------
// setBulkRequestRecallMaxBytes
//-----------------------------------------------------------------------------
void castor::tape::tapebridge::BulkRequestConfigParams::
setBulkRequestRecallMaxBytes(
const uint64_t value,
const ConfigParamSource::Enum source) {
m_bulkRequestRecallMaxBytes.setValueAndSource(value, source);
}
//-----------------------------------------------------------------------------
// setBulkRequestRecallMaxFiles
//-----------------------------------------------------------------------------
void castor::tape::tapebridge::BulkRequestConfigParams::
setBulkRequestRecallMaxFiles(
const uint64_t value,
const ConfigParamSource::Enum source) {
m_bulkRequestRecallMaxFiles.setValueAndSource(value, source);
}
This diff is collapsed.
#
# castor/tape/tapebridge/CMakeLists.txt
#
# 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.
#
#
# Steven.Murray@cern.ch
#
cmake_minimum_required (VERSION 2.6)
################################################################################
# Rules to build and install tapebridged
################################################################################
set (TAPEBRIDGE_SRC_FILES
BridgeClientInfo2Sender.cpp
BridgeProtocolEngine.cpp
BridgeSocketCatalogue.cpp
BulkRequestConfigParams.cpp
ClientAddress.cpp
ClientAddressLocal.cpp
ClientAddressTcpIp.cpp
ClientProxy.cpp
ConfigParams.cpp
ConfigParamSource.cpp
FileToMigrate.cpp
FileToRecall.cpp
GetMoreWorkConnection.cpp
DlfMessageStrings.cpp
IClientProxy.cpp
IFileCloser.cpp
ILegacyTxRx.cpp
LegacyTxRx.cpp
LogHelper.cpp
MigrationReportConnection.cpp
PendingMigrationsStore.cpp
RtcpJobSubmitter.cpp
RtcpTxRx.cpp
SessionError.cpp
SessionErrorList.cpp
SessionException.cpp
SystemFileCloser.cpp
TapeBridgeDaemon.cpp
TapeBridgeMain.cpp
TapeFlushConfigParams.cpp
VdqmRequestHandler.cpp
VmgrTxRx.cpp)
add_executable (tapebridged ${TAPEBRIDGE_SRC_FILES})
target_link_libraries (tapebridged castorcommon castorlegacymsg castortapebridge
castortapegatewayprotocol castortapeutils castorserver)
install (TARGETS tapebridged DESTINATION ${CASTOR_DEST_BIN_DIR})
CastorInstallAdmManPage (tapebridged)
CastorInstallLogrotate (castor-tapebridge-server)
CastorInstallSysconfigExample (tapebridged)
CastorInstallInitScript (tapebridged)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0%