Commit a1daca81 authored by Steven Murray's avatar Steven Murray
Browse files

Added TapeDaemonConfig

parent 3da42586
......@@ -36,6 +36,7 @@ add_library(castorTapeServerDaemon
RecallReportPacker.cpp
Session.cpp
TapeMessageHandler.cpp
TapeDaemonConfig.cpp
TapeDaemonMain.cpp
TapeReadSingleThread.cpp
TapeWriteSingleThread.cpp
......
......@@ -29,7 +29,8 @@
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::DataTransferConfig::DataTransferConfig():
castor::tape::tapeserver::daemon::DataTransferConfig::DataTransferConfig()
throw():
bufsz(0),
nbBufs(0),
bulkRequestMigrationMaxBytes(0),
......@@ -44,7 +45,7 @@ castor::tape::tapeserver::daemon::DataTransferConfig::DataTransferConfig():
//------------------------------------------------------------------------------
// createFromCastorConf
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::DataTransferConfig::DataTransferConfig
castor::tape::tapeserver::daemon::DataTransferConfig
castor::tape::tapeserver::daemon::DataTransferConfig::createFromCastorConf(
log::Logger *const log) {
common::CastorConfiguration &castorConf =
......
......@@ -119,10 +119,10 @@ struct DataTransferConfig {
std::string xrootPrivateKey;
/**
* Constructor that sets all integer memebr-variables to 0 and all string
* Constructor that sets all integer member-variables to 0 and all string
* member-variables to the empty string.
*/
DataTransferConfig();
DataTransferConfig() throw();
/**
* Returns a configuration structure based on the contents of
......
......@@ -38,6 +38,7 @@
#include "castor/tape/tapeserver/daemon/ProcessForkerConnectionHandler.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerProxySocket.hpp"
#include "castor/tape/tapeserver/daemon/TapeDaemon.hpp"
#include "castor/tape/tapeserver/daemon/TapeDaemonConfig.hpp"
#include "castor/tape/tapeserver/daemon/TapeMessageHandler.hpp"
#include "castor/tape/tapeserver/daemon/VdqmAcceptHandler.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
......@@ -190,14 +191,8 @@ void castor::tape::tapeserver::daemon::TapeDaemon::exceptionThrowingMain(
logStartOfDaemon(argc, argv);
parseCommandLine(argc, argv);
common::CastorConfiguration &castorConf =
common::CastorConfiguration::getConfig();
const time_t waitJobTimeoutInSecs = castorConf.getConfEntInt("TAPESERVERD",
"WAITJOBTIMEOUT", (time_t)TAPESERVER_WAITJOBTIMEOUT_DEFAULT, &m_log);
const time_t mountTimeoutInSecs = castorConf.getConfEntInt("TAPESERVERD",
"MOUNTTIMEOUT", (time_t)TAPESERVER_MOUNTTIMEOUT_DEFAULT, &m_log);
const time_t blockMoveTimeoutInSec = castorConf.getConfEntInt("TAPESERVERD",
"BLKMOVETIMEOUT", (time_t)TAPESERVER_BLKMOVETIMEOUT_DEFAULT, &m_log);
const TapeDaemonConfig config =
TapeDaemonConfig::createFromCastorConf(&m_log);
// Process must be able to change user now and should be permitted to perform
// raw IO in the future
......@@ -216,9 +211,17 @@ void castor::tape::tapeserver::daemon::TapeDaemon::exceptionThrowingMain(
const ProcessForkerOneTimeConfig processForkerConfig =
ProcessForkerOneTimeConfig::createFromCastorConf(&m_log);
m_processForker = new ProcessForkerProxySocket(m_log, cmdPair.tapeDaemon);
m_catalogue = new Catalogue(m_netTimeout, m_log, *m_processForker, m_cupv,
m_vdqm, m_vmgr, m_hostName, waitJobTimeoutInSecs, mountTimeoutInSecs,
blockMoveTimeoutInSec);
m_catalogue = new Catalogue(
m_netTimeout,
m_log,
*m_processForker,
m_cupv,
m_vdqm,
m_vmgr,
m_hostName,
config.waitJobTimeoutInSecs,
config.mountTimeoutInSecs,
config.blockMoveTimeoutInSec);
m_catalogue->populate(m_driveConfigs);
......
/******************************************************************************
*
* 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/common/CastorConfiguration.hpp"
#include "castor/tape/tapeserver/Constants.hpp"
#include "castor/tape/tapeserver/daemon/Constants.hpp"
#include "castor/tape/tapeserver/daemon/TapeDaemonConfig.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::TapeDaemonConfig::TapeDaemonConfig() throw():
waitJobTimeoutInSecs(0),
mountTimeoutInSecs(0),
blockMoveTimeoutInSec(0) {
}
//------------------------------------------------------------------------------
// createFromCastorConf
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::TapeDaemonConfig
castor::tape::tapeserver::daemon::TapeDaemonConfig::createFromCastorConf(
log::Logger *const log) {
common::CastorConfiguration &castorConf =
common::CastorConfiguration::getConfig();
TapeDaemonConfig config;
config.dataTransferConfig = DataTransferConfig::createFromCastorConf(log);
config.waitJobTimeoutInSecs = castorConf.getConfEntInt("TAPESERVERD",
"WAITJOBTIMEOUT", (time_t)TAPESERVER_WAITJOBTIMEOUT_DEFAULT, log);
config.mountTimeoutInSecs = castorConf.getConfEntInt("TAPESERVERD",
"MOUNTTIMEOUT", (time_t)TAPESERVER_MOUNTTIMEOUT_DEFAULT, log);
config.blockMoveTimeoutInSec = castorConf.getConfEntInt("TAPESERVERD",
"BLKMOVETIMEOUT", (time_t)TAPESERVER_BLKMOVETIMEOUT_DEFAULT, log);
return config;
}
/******************************************************************************
*
* 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/log/Logger.hpp"
#include "castor/tape/tapeserver/daemon/DataTransferConfig.hpp"
#include <stdint.h>
#include <string>
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
/**
* The contents of the castor.conf file to be used by the tape-server daemon.
*
* The pre-extraction of the contents by the caller instead of direct
* getconfent() calls facilitates unit-testing.
*/
struct TapeDaemonConfig {
/**
* The contents of the castor.conf file to be used by the
* DataTransferSession.
*
* The pre-extraction of the contents by the caller instead of direct
* getconfent() calls facilitates unit-testing.
*/
DataTransferConfig dataTransferConfig;
/**
* The maximum time in seconds that the data-transfer session can take to get
* the transfer job from the client.
*/
time_t waitJobTimeoutInSecs;
/**
* The maximum time in seconds that the data-transfer session can take to
* mount a tape.
*/
time_t mountTimeoutInSecs;
/**
* The maximum time in seconds the data-transfer session of tapeserverd can
* cease to move data blocks
*/
time_t blockMoveTimeoutInSec;
/**
* Constructor that sets all integer member-variables to 0 and all string
* member-variables to the empty string.
*/
TapeDaemonConfig() throw();
/**
* Returns a configuration structure based on the contents of
* /etc/castor/castor.conf and compile-time constants.
*
* @param log pointer to NULL or an optional logger object.
* @return The configuration structure.
*/
static TapeDaemonConfig createFromCastorConf(
log::Logger *const log = NULL);
}; // TapeDaemonConfig
} // namespace daemon
} // namespace tapeserver
} // namespace tape
} // namespace castor
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment