Commit 18c3e7c7 authored by Steven Murray's avatar Steven Murray
Browse files

The tapeserverd label-session now uses MediaChangerFacade

parent 87d5a575
......@@ -44,14 +44,14 @@
//------------------------------------------------------------------------------
castor::tape::tapeserver::daemon::LabelSession::LabelSession(
messages::TapeserverProxy &tapeserver,
legacymsg::RmcProxy &rmc,
mediachanger::MediaChangerFacade &mc,
const legacymsg::TapeLabelRqstMsgBody &clientRequest,
castor::log::Logger &log,
System::virtualWrapper &sysWrapper,
const utils::DriveConfig &driveConfig,
const bool force):
m_tapeserver(tapeserver),
m_rmc(rmc),
m_mc(mc),
m_request(clientRequest),
m_log(log),
m_sysWrapper(sysWrapper),
......@@ -82,9 +82,12 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
drive->unloadTape();
m_log(LOG_INFO, "The tape has been successfully unloaded after labeling",
params);
m_rmc.dismountTape(m_request.vid, m_driveConfig.librarySlot.str());
m_log(LOG_INFO, "The tape has been successfully unmounted after labeling",
params);
m_mc.dismountTape(m_request.vid, m_driveConfig.librarySlot.str());
if(mediachanger::TAPE_LIBRARY_TYPE_MANUAL !=
m_driveConfig.librarySlot.getLibraryType()) {
m_log(LOG_INFO, "The tape has been successfully unmounted after labeling",
params);
}
return MARK_DRIVE_AS_UP;
} catch(castor::exception::Exception &ex) {
......@@ -131,12 +134,15 @@ std::auto_ptr<castor::tape::tapeserver::drive::DriveInterface>
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::LabelSession::mountTape() {
try {
m_rmc.mountTapeReadWrite(m_request.vid, m_driveConfig.librarySlot.str());
const log::Param params[] = {
log::Param("vid", m_request.vid),
log::Param("unitName", m_request.drive),
log::Param("librarySlot", m_driveConfig.librarySlot.str())};
m_log(LOG_INFO, "Tape successfully mounted for labeling", params);
m_mc.mountTapeReadWrite(m_request.vid, m_driveConfig.librarySlot.str());
if(mediachanger::TAPE_LIBRARY_TYPE_MANUAL !=
m_driveConfig.librarySlot.getLibraryType()) {
const log::Param params[] = {
log::Param("vid", m_request.vid),
log::Param("unitName", m_request.drive),
log::Param("librarySlot", m_driveConfig.librarySlot.str())};
m_log(LOG_INFO, "Tape successfully mounted for labeling", params);
}
} catch(castor::exception::Exception &ne) {
castor::exception::Exception ex;
ex.getMessage() << "Failed to mount tape for labeling: " <<
......
......@@ -24,9 +24,9 @@
#pragma once
#include "castor/legacymsg/TapeLabelRqstMsgBody.hpp"
#include "castor/legacymsg/RmcProxy.hpp"
#include "castor/log/LogContext.hpp"
#include "castor/log/Logger.hpp"
#include "castor/mediachanger/MediaChangerFacade.hpp"
#include "castor/messages/TapeserverProxy.hpp"
#include "castor/tape/tapeserver/client/ClientProxy.hpp"
#include "castor/tape/tapeserver/system/Wrapper.hpp"
......@@ -53,7 +53,7 @@ public:
* Constructor
*
* @param tapeserver Proxy object representing the tapeserverd daemon.
* @param rmc Proxy object representing the rmcd daemon.
* @param mc Object representing the media changer.
* @param clientRequest The request to label a tape received from the label
* tape command.
* @param log Object representing the API to the CASTOR logging system.
......@@ -65,7 +65,7 @@ public:
*/
LabelSession(
messages::TapeserverProxy &tapeserver,
legacymsg::RmcProxy &rmc,
mediachanger::MediaChangerFacade &mc,
const legacymsg::TapeLabelRqstMsgBody &clientRequest,
castor::log::Logger &log,
System::virtualWrapper &sysWrapper,
......@@ -152,9 +152,9 @@ private:
messages::TapeserverProxy &m_tapeserver;
/**
* The object representing the rmcd daemon.
* The object representing the media changer.
*/
legacymsg::RmcProxy &m_rmc;
mediachanger::MediaChangerFacade &m_mc;
/**
* The label request message body
......
......@@ -862,15 +862,23 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
messages::TapeserverProxyZmq tapeserver(m_log,
TAPESERVER_INTERNAL_LISTENING_PORT, zmqContext.get());
messages::AcsProxyZmq acs(m_log,
acs::DEFAULT_ACS_SERVER_INTERNAL_LISTENING_PORT, zmqContext.get());
mediachanger::MmcProxyLog mmc(m_log);
// The network timeout of rmc communications should be several minutes due
// to the time it takes to mount and unmount tapes
const int rmcNetTimeout = 600; // Timeout in seconds
legacymsg::RmcProxyTcpIp rmc(m_log, rqst.rmcport(), rmcNetTimeout);
mediachanger::MediaChangerFacade mediaChangerFacade(acs, mmc, rmc);
legacymsg::NsProxy_TapeAlwaysEmpty ns;
castor::tape::System::realWrapper sWrapper;
LabelSession labelsession(
tapeserver,
rmc,
mediaChangerFacade,
labelJob,
m_log,
sWrapper,
......
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