Commit 85cab6be authored by Steven Murray's avatar Steven Murray
Browse files

Created the libcastorserver.so library and the castor-lib-server rpm

parent 82b2ed27
......@@ -31,6 +31,7 @@ if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (rh)
add_subdirectory (job)
add_subdirectory (scheduler)
add_subdirectory (server)
add_subdirectory (stager/daemon)
add_subdirectory (tape)
add_subdirectory (vdqm)
......@@ -120,7 +121,6 @@ set (CLIENT_LIB_SRC_FILES
io/StreamStagePutDoneRequestCnv.cpp
io/StreamStagePutRequestCnv.cpp
io/StreamStageRmRequestCnv.cpp
io/StreamThreadNotificationCnv.cpp
io/StreamStgFilesDeletedCnv.cpp
io/StreamStgFilesDeletedResponseCnv.cpp
io/StreamAbortResponseCnv.cpp
......@@ -147,12 +147,6 @@ set (CLIENT_LIB_SRC_FILES
log/LogContext.cpp
log/Message.cpp
log/Param.cpp
metrics/Counter.cpp
metrics/InternalCounter.cpp
metrics/Histogram.cpp
metrics/MetricsCollector.cpp
metrics/UpdateThread.cpp
metrics/ObjTypeCounter.cpp
query/DiskPoolQueryResponse.cpp
query/FileSystemDescription.cpp
query/DiskServerDescription.cpp
......@@ -174,22 +168,6 @@ set (CLIENT_LIB_SRC_FILES
rh/FileQryResponse.cpp
rh/IOResponse.cpp
rh/BasicResponse.cpp
server/AuthListenerThreadPool.cpp
server/BaseThreadPool.cpp
server/Daemon.cpp
server/DynamicThreadPool.cpp
server/ListenerThreadPool.cpp
server/MultiThreadedDaemon.cpp
server/TCPListenerThreadPool.cpp
server/UDPListenerThreadPool.cpp
server/ForkedProcessPool.cpp
server/SignalThreadPool.cpp
server/DbAlertedThreadPool.cpp
server/Mutex.cpp
server/NotifierThread.cpp
server/SelectProcessThread.cpp
server/ThreadNotification.cpp
server/Queue.cpp
stager/CastorFile.cpp
stager/DiskCopyInfo.cpp
stager/DiskCopyForRecall.cpp
......@@ -245,7 +223,6 @@ set (CLIENT_LIB_SRC_FILES
stager/BulkRequestResult.cpp
stager/FileResult.cpp
utils/DebugBuf.cpp
utils/ProcessCap.cpp
utils/SmartFd.cpp
utils/SmartFILEPtr.cpp
utils/utils.cpp
......@@ -276,16 +253,6 @@ set (CLIENT_LIB_SRC_FILES
../client/src/stager/stager_errmsg.c
../client/src/stager/stager_mapper.c)
# Try to find the libcap library because it will not exist on Mac OS X
find_library (LIBCAP_LIB cap)
if (LIBCAP_LIB)
message(STATUS "Found the libcap library")
message(STATUS "Adding source to castor::utils to support process capabilities")
set (CLIENT_LIB_PROC_CAP_SRC_FILES
utils/SmartCap.cpp
utils/ProcessCap.cpp)
endif (LIBCAP_LIB)
add_library (castorclient SHARED
${CLIENT_LIB_SRC_FILES}
${CLIENT_LIB_PROC_CAP_SRC_FILES})
......
......@@ -32,7 +32,8 @@ set(GCBIN_SRCS
SynchronizationThread.cpp
CephGlobals.cpp)
add_executable (gcd ${GCBIN_SRCS})
target_link_libraries (gcd castorcommon castordlf castorns castorclient ${RADOS_LIBS})
target_link_libraries (gcd castorcommon castordlf castorns castorclient
castorserver ${RADOS_LIBS})
install (TARGETS gcd DESTINATION ${CASTOR_DEST_BIN_DIR})
################################################################################
......
......@@ -33,6 +33,7 @@ set(STAGERJOB_EXE_SRC_FILES
XRootPlugin.cpp
GridFTPPlugin.cpp)
add_executable(stagerjob ${STAGERJOB_EXE_SRC_FILES})
target_link_libraries(stagerjob castorcommon castordlf castorclient castorrfio)
target_link_libraries(stagerjob castorcommon castordlf castorclient castorrfio
castorserver)
install(TARGETS stagerjob DESTINATION ${CASTOR_DEST_BIN_DIR})
CastorInstallLogrotate(castor-job)
......@@ -33,10 +33,10 @@ set(RH_SRC_FILES Server.cpp RHThread.cpp RateLimiter.cpp RatingGroup.cpp
UserCounter.cpp SvcClassCounter.cpp)
add_executable (rhd ${RH_SRC_FILES})
target_link_libraries (rhd castorcommon castordlf castorclient castorcnvs
castorns castorcommonora castorsecurity -lmemcached -ldl)
castorns castorcommonora castorsecurity castorserver -lmemcached -ldl)
install (TARGETS rhd DESTINATION ${CASTOR_DEST_BIN_DIR})
CastorInstallDir(/var/spool/castor)
CastorInstallInitScript(rhd)
CastorInstallSysconfigExample(rhd)
CastorInstallLogrotate(castor-rh-server)
CastorInstallAdmManPage(rhd)
\ No newline at end of file
CastorInstallAdmManPage(rhd)
#
# castor/server/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 libcastortapeutils.so
################################################################################
set (SERVER_LIB_SRC_FILES
AuthListenerThreadPool.cpp
BaseThreadPool.cpp
CMakeLists.txt
Daemon.cpp
DbAlertedThreadPool.cpp
DynamicThreadPool.cpp
ForkedProcessPool.cpp
../io/StreamThreadNotificationCnv.cpp
ListenerThreadPool.cpp
../metrics/Counter.cpp
../metrics/InternalCounter.cpp
../metrics/Histogram.cpp
../metrics/MetricsCollector.cpp
../metrics/UpdateThread.cpp
../metrics/ObjTypeCounter.cpp
MultiThreadedDaemon.cpp
Mutex.cpp
NotifierThread.cpp
ProcessCap.cpp
Queue.cpp
SelectProcessThread.cpp
SignalThreadPool.cpp
SmartCap.cpp
TCPListenerThreadPool.cpp
ThreadNotification.cpp
UDPListenerThreadPool.cpp)
add_library (castorserver SHARED ${SERVER_LIB_SRC_FILES})
CastorSetLibraryVersions (castorserver)
#target_link_libraries (castortapeutils castorcommon zmq)
install (TARGETS castorserver LIBRARY DESTINATION ${CASTOR_DEST_LIB_DIR}
NAMELINK_SKIP)
/******************************************************************************
* castor/utils/ProcessCap.cpp
* castor/server/ProcessCap.cpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
......@@ -23,8 +23,8 @@
*****************************************************************************/
#include "castor/exception/Exception.hpp"
#include "castor/utils/ProcessCap.hpp"
#include "castor/utils/SmartCap.hpp"
#include "castor/server/ProcessCap.hpp"
#include "castor/server/SmartCap.hpp"
#include "h/serrno.h"
#include <errno.h>
......@@ -32,14 +32,14 @@
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor::utils::ProcessCap::~ProcessCap()
castor::server::ProcessCap::~ProcessCap()
throw() {
}
//------------------------------------------------------------------------------
// getProcText
//------------------------------------------------------------------------------
std::string castor::utils::ProcessCap::getProcText() {
std::string castor::server::ProcessCap::getProcText() {
try {
SmartCap cap(getProc());
return toText((cap_t)cap.get());
......@@ -55,7 +55,7 @@ std::string castor::utils::ProcessCap::getProcText() {
//------------------------------------------------------------------------------
// getProc
//------------------------------------------------------------------------------
cap_t castor::utils::ProcessCap::getProc() {
cap_t castor::server::ProcessCap::getProc() {
cap_t cap = cap_get_proc();
if(NULL == cap) {
char errBuf[81];
......@@ -71,7 +71,7 @@ cap_t castor::utils::ProcessCap::getProc() {
//------------------------------------------------------------------------------
// toText
//------------------------------------------------------------------------------
std::string castor::utils::ProcessCap::toText(
std::string castor::server::ProcessCap::toText(
const cap_t cap) {
// Create a C++ string with the result of calling cap_to_text()
char *const text = cap_to_text(cap, NULL);
......@@ -102,7 +102,7 @@ std::string castor::utils::ProcessCap::toText(
//------------------------------------------------------------------------------
// setProcText
//------------------------------------------------------------------------------
void castor::utils::ProcessCap::setProcText(const std::string &text) {
void castor::server::ProcessCap::setProcText(const std::string &text) {
try {
SmartCap cap(fromText(text));
setProc(cap.get());
......@@ -117,7 +117,7 @@ void castor::utils::ProcessCap::setProcText(const std::string &text) {
//------------------------------------------------------------------------------
// fromText
//------------------------------------------------------------------------------
cap_t castor::utils::ProcessCap::fromText(const std::string &text) {
cap_t castor::server::ProcessCap::fromText(const std::string &text) {
const cap_t cap = cap_from_text(text.c_str());
if(NULL == cap) {
char errBuf[81];
......@@ -135,7 +135,7 @@ cap_t castor::utils::ProcessCap::fromText(const std::string &text) {
//------------------------------------------------------------------------------
// setProc
//------------------------------------------------------------------------------
void castor::utils::ProcessCap::setProc(const cap_t cap) {
void castor::server::ProcessCap::setProc(const cap_t cap) {
if(cap_set_proc(cap)) {
char errBuf[81];
sstrerror_r(errno, errBuf, sizeof(errBuf));
......
/******************************************************************************
* castor/utils/ProcessCap.hpp
* castor/server/ProcessCap.hpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
......@@ -28,7 +28,7 @@
#include <sys/capability.h>
namespace castor {
namespace utils {
namespace server {
/**
* Class providing support for UNIX capabilities.
......@@ -96,5 +96,5 @@ private:
}; // class ProcessCap
} // namespace utils
} // namespace server
} // namespace castor
/******************************************************************************
* castor/utils/ProcessCapDummy.cpp
* castor/server/ProcessCapDummy.cpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
......@@ -22,25 +22,25 @@
* @author Steven.Murray@cern.ch
*****************************************************************************/
#include "castor/utils/ProcessCapDummy.hpp"
#include "castor/server/ProcessCapDummy.hpp"
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor::utils::ProcessCapDummy::~ProcessCapDummy()
castor::server::ProcessCapDummy::~ProcessCapDummy()
throw() {
}
//------------------------------------------------------------------------------
// getProcText
//------------------------------------------------------------------------------
std::string castor::utils::ProcessCapDummy::getProcText() {
std::string castor::server::ProcessCapDummy::getProcText() {
return m_text;
}
//------------------------------------------------------------------------------
// setProcText
//------------------------------------------------------------------------------
void castor::utils::ProcessCapDummy::setProcText(const std::string &text) {
void castor::server::ProcessCapDummy::setProcText(const std::string &text) {
m_text = text;
}
/******************************************************************************
* castor/utils/ProcessCapDummy.hpp
* castor/server/ProcessCapDummy.hpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
......@@ -24,13 +24,13 @@
#pragma once
#include "castor/utils/ProcessCap.hpp"
#include "castor/server/ProcessCap.hpp"
#include <string>
#include <sys/capability.h>
namespace castor {
namespace utils {
namespace server {
/**
* A dummy class that pretends to provide support for UNIX capabilities.
......@@ -70,5 +70,5 @@ private:
}; // class ProcessCapDummy
} // namespace utils
} // namespace server
} // namespace castor
/******************************************************************************
* castor/utils/SmartCap.cpp
* castor/server/SmartCap.cpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
......@@ -23,26 +23,26 @@
*****************************************************************************/
#include "castor/exception/Exception.hpp"
#include "castor/utils/SmartCap.hpp"
#include "castor/server/SmartCap.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::utils::SmartCap::SmartCap() throw():
castor::server::SmartCap::SmartCap() throw():
m_cap(NULL) {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::utils::SmartCap::SmartCap(cap_t cap) throw():
castor::server::SmartCap::SmartCap(cap_t cap) throw():
m_cap(cap) {
}
//------------------------------------------------------------------------------
// reset
//------------------------------------------------------------------------------
void castor::utils::SmartCap::reset(cap_t cap) throw() {
void castor::server::SmartCap::reset(cap_t cap) throw() {
// If the new capability state is not the one already owned
if(cap != m_cap) {
......@@ -60,7 +60,7 @@ void castor::utils::SmartCap::reset(cap_t cap) throw() {
//------------------------------------------------------------------------------
// operator=
//------------------------------------------------------------------------------
castor::utils::SmartCap &castor::utils::SmartCap::operator=(SmartCap& obj) {
castor::server::SmartCap &castor::server::SmartCap::operator=(SmartCap& obj) {
reset(obj.release());
return *this;
}
......@@ -68,21 +68,21 @@ castor::utils::SmartCap &castor::utils::SmartCap::operator=(SmartCap& obj) {
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor::utils::SmartCap::~SmartCap() throw() {
castor::server::SmartCap::~SmartCap() throw() {
reset();
}
//------------------------------------------------------------------------------
// get
//------------------------------------------------------------------------------
cap_t castor::utils::SmartCap::get() const throw() {
cap_t castor::server::SmartCap::get() const throw() {
return m_cap;
}
//------------------------------------------------------------------------------
// release
//------------------------------------------------------------------------------
cap_t castor::utils::SmartCap::release() {
cap_t castor::server::SmartCap::release() {
// If this smart pointer does not own a capbility state
if(NULL == m_cap) {
castor::exception::Exception ex;
......
/******************************************************************************
* castor/utils/SmartCap.hpp
* castor/server/SmartCap.hpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
......@@ -28,7 +28,7 @@
#include <sys/capability.h>
namespace castor {
namespace utils {
namespace server {
/**
* A smart pointer that owns a capability state.
......@@ -117,6 +117,6 @@ private:
}; // class SmartCap
} // namespace utils
} // namespace server
} // namespace castor
/******************************************************************************
* castor/utils/SmartCapTest.cpp
* castor/server/SmartCapTest.cpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
......@@ -23,13 +23,13 @@
*****************************************************************************/
#include "castor/exception/Exception.hpp"
#include "castor/utils/SmartCap.hpp"
#include "castor/server/SmartCap.hpp"
#include <gtest/gtest.h>
namespace unitTests {
class castor_utils_SmartCapTest : public ::testing::Test {
class castor_server_SmartCapTest : public ::testing::Test {
protected:
virtual void SetUp() {
......@@ -39,21 +39,21 @@ protected:
}
};
TEST_F(castor_utils_SmartCapTest, default_constructor) {
castor::utils::SmartCap smartPtr;
TEST_F(castor_server_SmartCapTest, default_constructor) {
castor::server::SmartCap smartPtr;
ASSERT_EQ((cap_t)NULL, smartPtr.get());
}
TEST_F(castor_utils_SmartCapTest, constructor) {
TEST_F(castor_server_SmartCapTest, constructor) {
cap_t cap = cap_get_proc();
ASSERT_NE((cap_t)NULL, cap);
castor::utils::SmartCap smartPtr(cap);
castor::server::SmartCap smartPtr(cap);
ASSERT_EQ(cap, smartPtr.get());
}
TEST_F(castor_utils_SmartCapTest, reset) {
castor::utils::SmartCap smartPtr;
TEST_F(castor_server_SmartCapTest, reset) {
castor::server::SmartCap smartPtr;
ASSERT_EQ((cap_t)NULL, smartPtr.get());
cap_t cap = cap_get_proc();
......@@ -63,12 +63,12 @@ TEST_F(castor_utils_SmartCapTest, reset) {
ASSERT_EQ(cap, smartPtr.get());
}
TEST_F(castor_utils_SmartCapTest, assignment) {
TEST_F(castor_server_SmartCapTest, assignment) {
cap_t cap = cap_get_proc();
ASSERT_NE((cap_t)NULL, cap);
castor::utils::SmartCap smartPtr1;
castor::utils::SmartCap smartPtr2;
castor::server::SmartCap smartPtr1;
castor::server::SmartCap smartPtr2;
ASSERT_EQ((cap_t)NULL, smartPtr1.get());
ASSERT_EQ((cap_t)NULL, smartPtr2.get());
......@@ -81,8 +81,8 @@ TEST_F(castor_utils_SmartCapTest, assignment) {
ASSERT_EQ(cap, smartPtr2.get());
}
TEST_F(castor_utils_SmartCapTest, releaseNull) {
castor::utils::SmartCap smartPtr;
TEST_F(castor_server_SmartCapTest, releaseNull) {
castor::server::SmartCap smartPtr;
ASSERT_THROW(smartPtr.release(), castor::exception::Exception);
}
......
......@@ -48,7 +48,7 @@ set_target_properties (stagerd PROPERTIES
COMPILE_FLAGS ${ORACLE_CPPFLAGS}
LINK_FLAGS "-L${ORACLE_LIBDIR} -locci -lclntsh")
target_link_libraries (stagerd castorclient castorcnvs castorcommon castorns
castorupv castordlf castorcommonora)
castorupv castordlf castorcommonora castorserver)
install (TARGETS stagerd DESTINATION ${CASTOR_DEST_BIN_DIR})
CastorInstallAdmManPage (stagerd)
CastorInstallLogRotate (castor-stager-server)
......
......@@ -33,7 +33,7 @@ if (${COMPILE_SERVER} STREQUAL "1")
RmcDaemonMain.cpp)
add_executable (newrmcd ${RMCD_SRC_FILES})
target_link_libraries (newrmcd castorclient castorcommon castorlegacymsg
castortapereactor zmq)
castorserver castortapereactor zmq)
#install (TARGETS newrmcd DESTINATION ${CASTOR_DEST_LIB_DIR})
#CastorInstallExeManPage(newrmcd)
......
......@@ -60,7 +60,7 @@ set (TAPEBRIDGE_SRC_FILES
VmgrTxRx.cpp)
add_executable (tapebridged ${TAPEBRIDGE_SRC_FILES})
target_link_libraries (tapebridged castorcommon castorlegacymsg castortapebridge
castortapegatewayprotocol castortapeutils)
castortapegatewayprotocol castortapeutils castorserver)
install (TARGETS tapebridged DESTINATION ${CASTOR_DEST_BIN_DIR})
CastorInstallAdmManPage (tapebridged)
CastorInstallLogrotate (castor-tapebridge-server)
......
......@@ -45,7 +45,7 @@ set_target_properties (tapegatewayd PROPERTIES
LINK_FLAGS "-L${ORACLE_LIBDIR} -locci -lclntsh")
target_link_libraries (tapegatewayd castorclient castorcnvs castorcommon
castorcommonora castorns castortapegatewayprotocol castortapeutils castorvdqm
castorvmgr)
castorvmgr castorserver)
install (TARGETS tapegatewayd DESTINATION ${CASTOR_DEST_BIN_DIR})
CastorInstallAdmManPage (tapegatewayd)
CastorInstallLogrotate (castor-tapegateway-server)
......
......@@ -56,6 +56,7 @@ target_link_libraries(tapeserverd
castorcommon
castorclient
castorlegacymsg
castorserver
castortapegatewayprotocol
castortapereactor
castorTapeServerThreading
......
......@@ -64,7 +64,7 @@ castor::tape::tapeserver::daemon::DataTransferSession::DataTransferSession(
const utils::DriveConfig & driveConfig,
castor::legacymsg::RmcProxy & rmc,
castor::messages::TapeserverProxy & initialProcess,
castor::utils::ProcessCap &capUtils,
castor::server::ProcessCap &capUtils,
const CastorConf & castorConf):
m_request(clientRequest),
m_logger(logger),
......
......@@ -28,11 +28,11 @@
#include "castor/messages/TapeserverProxy.hpp"
#include "castor/log/Logger.hpp"
#include "castor/log/LogContext.hpp"
#include "castor/server/ProcessCap.hpp"
#include "castor/tape/tapeserver/system/Wrapper.hpp"
#include "castor/tape/utils/utils.hpp"
#include "castor/tape/tapeserver/client/ClientProxy.hpp"
#include "castor/tape/tapeserver/daemon/TapeSingleThreadInterface.hpp"
#include "castor/utils/ProcessCap.hpp"
namespace castor {
namespace legacymsg {
......@@ -104,7 +104,7 @@ namespace daemon {
const utils::DriveConfig & driveConfig,
castor::legacymsg::RmcProxy & rmc,
castor::messages::TapeserverProxy & initialProcess,
castor::utils::ProcessCap &capUtils,
castor::server::ProcessCap &capUtils,
const CastorConf & castorConf);
/** The only method. It will execute (like a task, that it is) */
int execute() ;
......@@ -156,7 +156,7 @@ namespace daemon {
/** Reference to the tape server's parent process to report detailed status */
castor::messages::TapeserverProxy & m_intialProcess;
/** Object providing utilities for working UNIX capabilities. */
castor::utils::ProcessCap &m_capUtils;
castor::server::ProcessCap &m_capUtils;
/** copy of the process's argc to allow "command line reporting"
* i.e. snprintf to argv's, which will be visible in 'ps' */
int m_argc;
......
......@@ -33,6 +33,7 @@
#include "castor/legacymsg/RmcProxyDummy.hpp"
#include "castor/log/StringLogger.hpp"
#include "castor/messages/TapeserverProxyDummy.hpp"
#include "castor/server/ProcessCapDummy.hpp"
#include "castor/tape/tapegateway/EndNotificationErrorReport.hpp"
#include "castor/tape/tapegateway/NoMoreFiles.hpp"
#include "castor/tape/tapegateway/NotificationAcknowledge.hpp"
......@@ -45,7 +46,6 @@
#include "castor/tape/tapeserver/system/Wrapper.hpp"
#include "castor/tape/tapeserver/threading/Threading.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
#include "castor/utils/ProcessCapDummy.hpp"
#include "h/Ctape.h"
#include "h/smc_struct.h"
......@@ -71,8 +71,6 @@ private:
client::ClientSimulator & m_sim;
};
TEST(tapeServer, DataTransferSessionGooddayRecall) {
// TpcpClients only supports 32 bits session number
// This number has to be less than 2^31 as in addition there is a mix
......@@ -166,7 +164,7 @@ TEST(tapeServer, DataTransferSessionGooddayRecall) {
castorConf.tapebridgeBulkRequestRecallMaxFiles = 1000;
castorConf.tapeserverdDiskThreads = 1;
castor::legacymsg::RmcProxyDummy rmc;
castor::utils::ProcessCap capUtils;
castor::server::ProcessCap capUtils;
castor::messages::TapeserverProxyDummy initialProcess;