Commit a96397d3 authored by Eric Cano's avatar Eric Cano
Browse files

Catching up with master branch.

parents 361b9012 27f0834b
...@@ -38,6 +38,7 @@ castor/tape/rechandler/rechandlerd ...@@ -38,6 +38,7 @@ castor/tape/rechandler/rechandlerd
castor/tape/rmc/castor-tape-acs-dismount castor/tape/rmc/castor-tape-acs-dismount
castor/tape/rmc/castor-tape-acs-mount castor/tape/rmc/castor-tape-acs-mount
castor/tape/rmc/castor-tape-acs-queryvolume castor/tape/rmc/castor-tape-acs-queryvolume
castor/tape/rmc/castor-tape-mount
castor/tape/tapebridge/tapebridged castor/tape/tapebridge/tapebridged
castor/tape/tapegateway/tapegatewayd castor/tape/tapegateway/tapegatewayd
castor/tape/tpcp/dumptp castor/tape/tpcp/dumptp
......
...@@ -339,15 +339,15 @@ ELSE(DEFINED PackageOnly) ...@@ -339,15 +339,15 @@ ELSE(DEFINED PackageOnly)
set_property (DIRECTORY PROPERTY COMPILE_DEFINITIONS _LARGEFILE64_SOURCE) set_property (DIRECTORY PROPERTY COMPILE_DEFINITIONS _LARGEFILE64_SOURCE)
################################################################################ ##############################################################################
# Rules to install the shared log and spool directories # Rules to install the shared log and spool directories
################################################################################ ##############################################################################
CastorInstallDir (/var/log/castor) CastorInstallDir (/var/log/castor)
CastorInstallDir (/var/log/spool/castor) CastorInstallDir (/var/log/spool/castor)
################################################################################ ##############################################################################
# Include the subdirectories of the project # Include the subdirectories of the project
################################################################################ ##############################################################################
# Some directories have client components, and get included unconditionnaly # Some directories have client components, and get included unconditionnaly
# inside them, we can filter further down what we need or not. # inside them, we can filter further down what we need or not.
......
...@@ -118,12 +118,12 @@ protected: ...@@ -118,12 +118,12 @@ protected:
*/ */
virtual void waitAllThreads() throw (); virtual void waitAllThreads() throw ();
private:
/** /**
* Prints out the online help * Prints out the online help
*/ */
void help(const std::string &programName) throw(); virtual void help(const std::string &programName) throw();
private:
/** /**
* Sets up the signal handling for this multi-threaded daemon. * Sets up the signal handling for this multi-threaded daemon.
......
...@@ -24,7 +24,7 @@ cmake_minimum_required (VERSION 2.6) ...@@ -24,7 +24,7 @@ cmake_minimum_required (VERSION 2.6)
add_subdirectory (gatewayprotocol) add_subdirectory (gatewayprotocol)
add_subdirectory (legacymsg) add_subdirectory (legacymsg)
#add_subdirectory (rmc) add_subdirectory (rmc)
add_subdirectory (tapebridge) add_subdirectory (tapebridge)
add_subdirectory (tapegateway) add_subdirectory (tapegateway)
add_subdirectory (tapeserver) add_subdirectory (tapeserver)
......
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
castor::tape::rmc::AcsCmd::AcsCmd(std::istream &inStream, castor::tape::rmc::AcsCmd::AcsCmd(std::istream &inStream,
std::ostream &outStream, std::ostream &errStream, Acs &acs) throw(): std::ostream &outStream, std::ostream &errStream, Acs &acs) throw():
m_in(inStream), m_out(outStream), m_err(errStream), m_acs(acs), Cmd(inStream, outStream, errStream), m_acs(acs) {
m_debugBuf(outStream), m_dbg(&m_debugBuf) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -45,25 +44,9 @@ castor::tape::rmc::AcsCmd::~AcsCmd() throw() { ...@@ -45,25 +44,9 @@ castor::tape::rmc::AcsCmd::~AcsCmd() throw() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// bool2Str // bool2Str
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
std::string castor::tape::rmc::AcsCmd::bool2Str(bool &value) const std::string castor::tape::rmc::AcsCmd::bool2Str(const BOOLEAN value) const
throw() { throw() {
if(value) { return value ? "TRUE" : "FALSE";
return "TRUE";
} else {
return "FALSE";
}
}
//------------------------------------------------------------------------------
// bool2Str
//------------------------------------------------------------------------------
std::string castor::tape::rmc::AcsCmd::bool2Str(BOOLEAN &value) const
throw() {
if(value) {
return "TRUE";
} else {
return "FALSE";
}
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "castor/exception/Mismatch.hpp" #include "castor/exception/Mismatch.hpp"
#include "castor/exception/RequestFailed.hpp" #include "castor/exception/RequestFailed.hpp"
#include "castor/tape/rmc/Acs.hpp" #include "castor/tape/rmc/Acs.hpp"
#include "castor/tape/rmc/DebugBuf.hpp" #include "castor/tape/rmc/Cmd.hpp"
#include <istream> #include <istream>
#include <ostream> #include <ostream>
...@@ -48,7 +48,7 @@ namespace rmc { ...@@ -48,7 +48,7 @@ namespace rmc {
* Abstract class implementing common code and data structures for command-line * Abstract class implementing common code and data structures for command-line
* tools that interact with ACLS compatible tape libraries. * tools that interact with ACLS compatible tape libraries.
*/ */
class AcsCmd { class AcsCmd: public Cmd {
public: public:
/** /**
* Constructor. * Constructor.
...@@ -68,49 +68,17 @@ public: ...@@ -68,49 +68,17 @@ public:
protected: protected:
/**
* Standard input stream.
*/
std::istream &m_in;
/**
* Standard output stream.
*/
std::ostream &m_out;
/**
* Standard error stream.
*/
std::ostream &m_err;
/** /**
* Wrapper around the ACSLS C-API. * Wrapper around the ACSLS C-API.
*/ */
Acs &m_acs; Acs &m_acs;
/**
* Debug stream buffer that inserts a standard debug preamble before each
* message-line written to it.
*/
DebugBuf m_debugBuf;
/**
* Stream used to write debug messages.
*
* This stream will insert a standard debug preamble before each message-line
* written to it.
*/
std::ostream m_dbg;
/**
* Returns the string representation of the specfied boolean value.
*/
std::string bool2Str(bool &value) const throw();
/** /**
* Returns the string representation of the specfied boolean value. * Returns the string representation of the specfied boolean value.
*
* @param value The boolean value.
*/ */
std::string bool2Str(BOOLEAN &value) const throw(); std::string bool2Str(const BOOLEAN value) const throw();
/** /**
* Requests responses from ACSLS in a loop until the RT_FINAL response is * Requests responses from ACSLS in a loop until the RT_FINAL response is
......
...@@ -102,11 +102,13 @@ void castor::tape::rmc::AcsDismountCmd::usage(std::ostream &os) ...@@ -102,11 +102,13 @@ void castor::tape::rmc::AcsDismountCmd::usage(std::ostream &os)
const throw() { const throw() {
os << os <<
"Usage:\n" "Usage:\n"
"\n"
" castor-tape-acs-dismount [options] VID DRIVE\n" " castor-tape-acs-dismount [options] VID DRIVE\n"
"\n" "\n"
"Where:\n" "Where:\n"
"\n" "\n"
" VID The VID of the volume to be dismounted.\n" " VID The VID of the volume to be dismounted.\n"
"\n"
" DRIVE The drive from which the volume is to be dismounted.\n" " DRIVE The drive from which the volume is to be dismounted.\n"
" The format of DRIVE is:\n" " The format of DRIVE is:\n"
"\n" "\n"
...@@ -115,12 +117,16 @@ void castor::tape::rmc::AcsDismountCmd::usage(std::ostream &os) ...@@ -115,12 +117,16 @@ void castor::tape::rmc::AcsDismountCmd::usage(std::ostream &os)
"Options:\n" "Options:\n"
"\n" "\n"
" -d|--debug Turn on the printing of debug information.\n" " -d|--debug Turn on the printing of debug information.\n"
"\n"
" -f|--force Force the dismount.\n" " -f|--force Force the dismount.\n"
"\n"
" -h|--help Print this help message and exit.\n" " -h|--help Print this help message and exit.\n"
"\n"
" -q|--query SECONDS Time to wait between queries to ACS for responses.\n" " -q|--query SECONDS Time to wait between queries to ACS for responses.\n"
" SECONDS must be an integer value greater than 0.\n" " SECONDS must be an integer value greater than 0.\n"
" The default value of SECONDS is " " The default value of SECONDS is "
<< m_defaultQueryInterval << ".\n" << m_defaultQueryInterval << ".\n"
"\n"
" -t|--timeout SECONDS Time to wait for the dismount to conclude. SECONDS\n" " -t|--timeout SECONDS Time to wait for the dismount to conclude. SECONDS\n"
" must be an integer value greater than 0. The\n" " must be an integer value greater than 0. The\n"
" default value of SECONDS is " " default value of SECONDS is "
......
...@@ -43,7 +43,7 @@ struct AcsDismountCmdLine { ...@@ -43,7 +43,7 @@ struct AcsDismountCmdLine {
/** /**
* Constructor. * Constructor.
* *
* Initialises all BOOLEAN member-variables to FALSE, all integer * Initialises all boolean member-variables to false, all integer
* member-variables to 0 and the volume identifier to an empty string. * member-variables to 0 and the volume identifier to an empty string.
*/ */
AcsDismountCmdLine() throw(); AcsDismountCmdLine() throw();
......
...@@ -220,6 +220,7 @@ void castor::tape::rmc::AcsMountCmd::usage(std::ostream &os) ...@@ -220,6 +220,7 @@ void castor::tape::rmc::AcsMountCmd::usage(std::ostream &os)
const throw() { const throw() {
os << os <<
"Usage:\n" "Usage:\n"
"\n"
" castor-tape-acs-mount [options] VID DRIVE\n" " castor-tape-acs-mount [options] VID DRIVE\n"
"\n" "\n"
"Where:\n" "Where:\n"
...@@ -233,12 +234,16 @@ void castor::tape::rmc::AcsMountCmd::usage(std::ostream &os) ...@@ -233,12 +234,16 @@ void castor::tape::rmc::AcsMountCmd::usage(std::ostream &os)
"Options:\n" "Options:\n"
"\n" "\n"
" -d|--debug Turn on the printing of debug information.\n" " -d|--debug Turn on the printing of debug information.\n"
"\n"
" -h|--help Print this help message and exit.\n" " -h|--help Print this help message and exit.\n"
"\n"
" -q|--query SECONDS Time to wait between queries to ACS for responses.\n" " -q|--query SECONDS Time to wait between queries to ACS for responses.\n"
" SECONDS must be an integer value greater than 0.\n" " SECONDS must be an integer value greater than 0.\n"
" The default value of SECONDS is " " The default value of SECONDS is "
<< m_defaultQueryInterval << ".\n" << m_defaultQueryInterval << ".\n"
"\n"
" -r|--readOnly Request the volume is mounted for read-only access\n" " -r|--readOnly Request the volume is mounted for read-only access\n"
"\n"
" -t|--timeout SECONDS Time to wait for the mount to conclude. SECONDS\n" " -t|--timeout SECONDS Time to wait for the mount to conclude. SECONDS\n"
" must be an integer value greater than 0. The\n" " must be an integer value greater than 0. The\n"
" default value of SECONDS is " " default value of SECONDS is "
......
...@@ -22,62 +22,148 @@ ...@@ -22,62 +22,148 @@
# #
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.6)
################################################################################ if (${COMPILE_SERVER} STREQUAL "1")
# Rules to build and install castor-tape-acs-mount ##############################################################################
################################################################################ # Rules to build and install rmcd
set (ACS_MOUNT_SRC_FILES ##############################################################################
Acs.cpp set (RMCD_SRC_FILES
AcsCmd.cpp RmcDaemon.cpp
AcsImpl.cpp RmcdCmdLine.cpp
AcsMountCmd.cpp RmcdMain.cpp)
AcsMountCmdLine.cpp add_executable (newrmcd ${RMCD_SRC_FILES})
AcsMountMain.cpp target_link_libraries (newrmcd castorclient castorcommon)
DebugBuf.cpp) #install (TARGETS newrmcd DESTINATION ${CASTOR_DEST_LIB_DIR})
add_executable (castor-tape-acs-mount ${ACS_MOUNT_SRC_FILES}) #CastorInstallExeManPage(newrmcd)
set_target_properties (castor-tape-acs-mount PROPERTIES
COMPILE_FLAGS -I/usr/include/CDK
COMPILE_DEFINITIONS LINUX)
target_link_libraries (castor-tape-acs-mount castorcommon castortapeutils
${STK_API_LIB} ${STK_UTL_LIB} ${STK_IPC_LIB} ${STK_CL_LIB})
install (TARGETS castor-tape-acs-mount DESTINATION ${CASTOR_DEST_LIB_DIR})
CastorInstallExeManPage(castor-tape-acs-mount)
################################################################################ ##############################################################################
# Rules to build and install castor-tape-acs-dismount # Rules to build and install castor-tape-mount
################################################################################ ##############################################################################
set (ACS_DISMOUNT_SRC_FILES set (MOUNT_SRC_FILES
Acs.cpp DebugBuf.cpp
AcsCmd.cpp Cmd.cpp
AcsImpl.cpp MountCmd.cpp
AcsDismountCmd.cpp MountCmdLine.cpp
AcsDismountCmdLine.cpp MountMain.cpp)
AcsDismountMain.cpp add_executable (castor-tape-mount ${MOUNT_SRC_FILES})
DebugBuf.cpp) target_link_libraries (castor-tape-mount castorcommon castorrmc)
add_executable (castor-tape-acs-dismount ${ACS_DISMOUNT_SRC_FILES}) #install (TARGETS castor-tape-mount DESTINATION ${CASTOR_DEST_LIB_DIR})
target_link_libraries (castor-tape-acs-dismount castorcommon castortapeutils #CastorInstallExeManPage(castor-tape-mount)
${STK_API_LIB} ${STK_UTL_LIB} ${STK_IPC_LIB} ${STK_CL_LIB})
set_target_properties (castor-tape-acs-dismount PROPERTIES
COMPILE_FLAGS -I/usr/include/CDK
COMPILE_DEFINITIONS LINUX)
install (TARGETS castor-tape-acs-dismount DESTINATION ${CASTOR_DEST_LIB_DIR})
CastorInstallExeManPage(castor-tape-acs-dismount)
################################################################################ ##############################################################################
# Rules to build and install castor-tape-acs-queryvolume # Try to find the four STK client libaries: libapi.so, libutl.so, libipc.so
################################################################################ # and libcl.so
set (ACS_QUERYVOLUME_SRC_FILES ##############################################################################
Acs.cpp find_library (STK_API_LIB api
AcsCmd.cpp PATHS /usr/lib64/CDK /usr/lib/CDK NO_DEFAULT_PATH)
AcsImpl.cpp if (STK_API_LIB)
AcsQueryVolumeCmd.cpp message(STATUS "Found the STK api library: ${STK_API_LIB}")
AcsQueryVolumeCmdLine.cpp endif (STK_API_LIB)
AcsQueryVolumeMain.cpp find_library (STK_UTL_LIB utl
DebugBuf.cpp) PATHS /usr/lib64/CDK /usr/lib/CDK NO_DEFAULT_PATH)
add_executable (castor-tape-acs-queryvolume ${ACS_QUERYVOLUME_SRC_FILES}) if (STK_UTL_LIB)
target_link_libraries (castor-tape-acs-queryvolume castorcommon castortapeutils message(STATUS "Found the STK utl library: ${STK_UTL_LIB}")
${STK_API_LIB} ${STK_UTL_LIB} ${STK_IPC_LIB} ${STK_CL_LIB}) endif (STK_UTL_LIB)
set_target_properties (castor-tape-acs-queryvolume PROPERTIES find_library (STK_IPC_LIB ipc
COMPILE_FLAGS -I/usr/include/CDK PATHS /usr/lib64/CDK /usr/lib/CDK NO_DEFAULT_PATH)
COMPILE_DEFINITIONS LINUX) if (STK_IPC_LIB)
install (TARGETS castor-tape-acs-queryvolume DESTINATION ${CASTOR_DEST_LIB_DIR}) message(STATUS "Found the STK ipc library: ${STK_IPC_LIB}")
CastorInstallExeManPage(castor-tape-acs-queryvolume) endif (STK_IPC_LIB)
find_library (STK_CL_LIB cl PATHS /usr/lib64/CDK /usr/lib/CDK NO_DEFAULT_PATH)
if (STK_CL_LIB)
message(STATUS "Found the STK cl library: ${STK_CL_LIB}")
endif (STK_CL_LIB)
##############################################################################
# Add the castor-tape-acs-dismount, castor-tape-acs-mount and
# castor-tape-queryvolume targets if all four STK client libaries
# (libapi.so, libutl.so, libipc.so and libcl.so) have been found
##############################################################################
if (STK_API_LIB AND STK_UTL_LIB AND STK_IPC_LIB AND STK_CL_LIB)
message(STATUS "Found all four STK libraries")
############################################################################
# Rules to build and install castor-tape-acs-dismount
############################################################################
message(STATUS "Adding castor-tape-acs-dismount target")
set (ACS_DISMOUNT_SRC_FILES
Acs.cpp
AcsCmd.cpp
AcsImpl.cpp
AcsDismountCmd.cpp
AcsDismountCmdLine.cpp
AcsDismountMain.cpp
Cmd.cpp
DebugBuf.cpp)
add_executable (castor-tape-acs-dismount ${ACS_DISMOUNT_SRC_FILES})
set_target_properties (castor-tape-acs-dismount PROPERTIES
COMPILE_FLAGS -I/usr/include/CDK
COMPILE_DEFINITIONS LINUX)
target_link_libraries (castor-tape-acs-dismount
castorclient
castorcommon
castortapeutils
${STK_API_LIB}
${STK_UTL_LIB}
${STK_IPC_LIB}
${STK_CL_LIB})
#install (TARGETS castor-tape-acs-dismount
# DESTINATION ${CASTOR_DEST_LIB_DIR})
#CastorInstallExeManPage(castor-tape-acs-dismount)
############################################################################
# Rules to build and install castor-tape-acs-mount
############################################################################
set (ACS_MOUNT_SRC_FILES
Acs.cpp
AcsCmd.cpp
AcsImpl.cpp
AcsMountCmd.cpp
AcsMountCmdLine.cpp
AcsMountMain.cpp
Cmd.cpp
DebugBuf.cpp)
add_executable (castor-tape-acs-mount ${ACS_MOUNT_SRC_FILES})
set_target_properties (castor-tape-acs-mount PROPERTIES
COMPILE_FLAGS -I/usr/include/CDK
COMPILE_DEFINITIONS LINUX)
target_link_libraries (castor-tape-acs-mount
castorclient
castorcommon
castortapeutils
${STK_API_LIB}
${STK_UTL_LIB}
${STK_IPC_LIB}
${STK_CL_LIB})
#install (TARGETS castor-tape-acs-mount DESTINATION ${CASTOR_DEST_LIB_DIR})
#CastorInstallExeManPage(castor-tape-acs-mount)
############################################################################
# Rules to build and install castor-tape-acs-queryvolume
############################################################################
message(STATUS "Adding castor-tape-acs-queryvolume target")
set (ACS_QUERYVOLUME_SRC_FILES
Acs.cpp
AcsCmd.cpp
AcsImpl.cpp
AcsQueryVolumeCmd.cpp
AcsQueryVolumeCmdLine.cpp
AcsQueryVolumeMain.cpp
Cmd.cpp
DebugBuf.cpp)
add_executable (castor-tape-acs-queryvolume ${ACS_QUERYVOLUME_SRC_FILES})
target_link_libraries (castor-tape-acs-queryvolume
castorclient
castorcommon
castortapeutils
${STK_API_LIB}
${STK_UTL_LIB}
${STK_IPC_LIB}
${STK_CL_LIB})
set_target_properties (castor-tape-acs-queryvolume PROPERTIES
COMPILE_FLAGS -I/usr/include/CDK
COMPILE_DEFINITIONS LINUX)
#install (TARGETS castor-tape-acs-queryvolume
# DESTINATION ${CASTOR_DEST_LIB_DIR})
#CastorInstallExeManPage(castor-tape-acs-queryvolume)
endif (STK_API_LIB AND STK_UTL_LIB AND STK_IPC_LIB AND STK_CL_LIB)
endif (${COMPILE_SERVER} STREQUAL "1")
/******************************************************************************
* castor/tape/rmc/Cmd.cpp
*
* 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 Steven.Murray@cern.ch
*****************************************************************************/
#include "castor/tape/rmc/Cmd.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::tape::rmc::Cmd::Cmd(std::istream &inStream,
std::ostream &outStream, std::ostream &errStream) throw():
m_in(inStream), m_out(outStream), m_err(errStream), m_debugBuf(outStream),
m_dbg(&m_debugBuf) {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor::tape::rmc::Cmd::~Cmd() throw() {
}
//------------------------------------------------------------------------------
// bool2Str
//------------------------------------------------------------------------------
std::string castor::tape::rmc::Cmd::bool2Str(const bool value) const throw() {
return value ? "TRUE" : "FALSE";
}
/******************************************************************************
* castor/tape/rmc/Cmd.hpp
*
* 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 Steven.Murray@cern.ch
*****************************************************************************/
#ifndef CASTOR_TAPE_RMC_CMD_HPP
#define CASTOR_TAPE_RMC_CMD_HPP 1
#include "castor/tape/rmc/DebugBuf.hpp"
#include <istream>
#include <ostream>
#include <string>
namespace castor {
namespace tape {
namespace rmc {
/**
* Abstract class implementing common code and data structures for a
* command-line tool.
*/
class Cmd {
public:
/**
* Constructor.
*
* @param inStream Standard input stream.
* @param outStream Standard output stream.
* @param errStream Standard error stream.
*/
Cmd(std::istream &inStream, std::ostream &outStream, std::ostream &errStream)
throw();