Skip to content
Snippets Groups Projects
Commit 7cda13a4 authored by Steven Murray's avatar Steven Murray
Browse files

Removed the Oracle library only feature forceDismountTape()

parent 39c7fd7a
No related branches found
No related tags found
No related merge requests found
......@@ -66,11 +66,6 @@ int cta::mediachanger::DismountCmd::exceptionThrowingMain(const int argc,
m_dbg << "DRIVE_SLOT = " << m_cmdLine.getDriveLibrarySlot().str() <<
std::endl;
if(m_cmdLine.getForce()) {
m_mc.forceDismountTape(m_cmdLine.getVid(),
m_cmdLine.getDriveLibrarySlot());
} else {
m_mc.dismountTape(m_cmdLine.getVid(), m_cmdLine.getDriveLibrarySlot());
}
m_mc.dismountTape(m_cmdLine.getVid(), m_cmdLine.getDriveLibrarySlot());
return 0;
}
......@@ -29,8 +29,7 @@
cta::mediachanger::DismountCmdLine::DismountCmdLine():
m_debug(false),
m_help(false),
m_driveLibrarySlot(0),
m_force(false) {
m_driveLibrarySlot(0) {
}
//------------------------------------------------------------------------------
......@@ -40,13 +39,11 @@ cta::mediachanger::DismountCmdLine::DismountCmdLine(const int argc,
char *const *const argv):
m_debug(false),
m_help(false),
m_driveLibrarySlot(0),
m_force(false) {
m_driveLibrarySlot(0) {
static struct option longopts[] = {
{"debug", 0, NULL, 'd'},
{"help" , 0, NULL, 'h'},
{"force", 0, NULL, 'f'},
{NULL , 0, NULL, 0}
};
......@@ -94,8 +91,7 @@ cta::mediachanger::DismountCmdLine::DismountCmdLine(
m_help(obj.m_help),
m_vid(obj.m_vid),
m_driveLibrarySlot(0 == obj.m_driveLibrarySlot ? 0 :
obj.m_driveLibrarySlot->clone()),
m_force(obj.m_force) {
obj.m_driveLibrarySlot->clone()) {
}
//-----------------------------------------------------------------------------
......@@ -120,19 +116,11 @@ cta::mediachanger::DismountCmdLine &cta::mediachanger::DismountCmdLine::
m_vid = rhs.m_vid;
m_driveLibrarySlot = 0 == rhs.m_driveLibrarySlot ? 0 :
rhs.m_driveLibrarySlot->clone();
m_force = rhs.m_force;
}
return *this;
}
//------------------------------------------------------------------------------
// getForce
//------------------------------------------------------------------------------
bool cta::mediachanger::DismountCmdLine::getForce() const {
return m_force;
}
//------------------------------------------------------------------------------
// getProgramName
//------------------------------------------------------------------------------
......@@ -151,9 +139,6 @@ void cta::mediachanger::DismountCmdLine::processOption(const int opt) {
case 'h':
m_help = true;
break;
case 'f':
m_force = true;
break;
case ':':
return handleMissingParameter(optopt);
case '?':
......@@ -193,9 +178,7 @@ std::string cta::mediachanger::DismountCmdLine::getUsage() {
"\n"
" -h|--help Print this help message and exit.\n"
"\n"
" -f|--force Force the dismount (rewind and eject the tape where necessary)."
"\n"
"Comments to: Castor.Support@cern.ch\n";
"Comments to: cta-support@cern.ch\n";
}
//------------------------------------------------------------------------------
......
......@@ -101,14 +101,6 @@ public:
*/
const LibrarySlot &getDriveLibrarySlot() const;
/**
* Gets the value of the force option.
*
* @return True if the dismount should be forced. Forcing a dismount means
* rewinding and ejecting the tape where necessary.
*/
bool getForce() const;
/**
* Return sthe program name.
*
......@@ -138,12 +130,6 @@ private:
*/
LibrarySlot *m_driveLibrarySlot;
/**
* True if the dismount should be forced. Forcing a dismount means
* rewinding and ejecting the tape where necessary.
*/
bool m_force;
/**
* Processes the specified option that was returned by getopt_long().
*
......
......@@ -81,7 +81,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, copy_constructor) {
DismountCmdLine cmdLine1(args->argc, args->argv);
ASSERT_FALSE(cmdLine1.getHelp());
ASSERT_FALSE(cmdLine1.getDebug());
ASSERT_FALSE(cmdLine1.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine1.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc1"),
cmdLine1.getDriveLibrarySlot().str());
......@@ -89,7 +88,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, copy_constructor) {
DismountCmdLine cmdLine2(cmdLine1);
ASSERT_FALSE(cmdLine2.getHelp());
ASSERT_FALSE(cmdLine2.getDebug());
ASSERT_FALSE(cmdLine2.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI,
cmdLine2.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc1"), cmdLine2.getDriveLibrarySlot().str());
......@@ -110,7 +108,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) {
DismountCmdLine cmdLine1(args1->argc, args1->argv);
ASSERT_FALSE(cmdLine1.getHelp());
ASSERT_FALSE(cmdLine1.getDebug());
ASSERT_FALSE(cmdLine1.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine1.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc1"), cmdLine1.getDriveLibrarySlot().str());
......@@ -126,7 +123,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) {
DismountCmdLine cmdLine2(args2->argc, args2->argv);
ASSERT_FALSE(cmdLine2.getHelp());
ASSERT_FALSE(cmdLine2.getDebug());
ASSERT_FALSE(cmdLine2.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine2.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc2"), cmdLine2.getDriveLibrarySlot().str());
......@@ -134,13 +130,11 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) {
ASSERT_FALSE(cmdLine1.getHelp());
ASSERT_FALSE(cmdLine1.getDebug());
ASSERT_FALSE(cmdLine1.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine1.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc2"), cmdLine1.getDriveLibrarySlot().str());
ASSERT_FALSE(cmdLine2.getHelp());
ASSERT_FALSE(cmdLine2.getDebug());
ASSERT_FALSE(cmdLine2.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine2.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc2"), cmdLine2.getDriveLibrarySlot().str());
}
......@@ -162,7 +156,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, scsi) {
ASSERT_FALSE(cmdLine->getHelp());
ASSERT_FALSE(cmdLine->getDebug());
ASSERT_FALSE(cmdLine->getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI,
cmdLine->getDriveLibrarySlot().getLibraryType());
}
......
......@@ -71,20 +71,6 @@ void MediaChangerFacade::dismountTape(const std::string &vid, const LibrarySlot
}
}
//------------------------------------------------------------------------------
// forceDismountTape
//------------------------------------------------------------------------------
void MediaChangerFacade::forceDismountTape(const std::string &vid, const LibrarySlot &slot) {
try {
return getProxy(slot.getLibraryType()).forceDismountTape(vid, slot);
} catch(cta::exception::Exception &ne) {
cta::exception::Exception ex;
ex.getMessage() << "Failed to force dismount tape: vid=" << vid << " slot=" << slot.str() << ": " <<
ne.getMessage().str();
throw ex;
}
}
//------------------------------------------------------------------------------
// getProxy
//------------------------------------------------------------------------------
......
......@@ -75,19 +75,6 @@ public:
*/
void dismountTape(const std::string &vid, const LibrarySlot &slot);
/**
* Requests the media changer to forcefully dismount the specified tape from
* the drive in the specifed library slot. Forcefully means rewinding and
* ejecting the tape where necessary.
*
* Please note that this method provides a best-effort service because not all
* media changers support forceful dismounts.
*
* @param vid The volume identifier of the tape.
* @param slot The library slot containing the tape drive.
*/
void forceDismountTape(const std::string &vid, const LibrarySlot &slot);
private:
/**
......
......@@ -68,19 +68,6 @@ public:
*/
virtual void dismountTape(const std::string &vid, const LibrarySlot &librarySlot) = 0;
/**
* Request the media changer daemon to forcefully dismount the specifed tape
* from the tape drive in the specified library slot. Forcefully means
* rewinding and ejecting the tape if necessary.
*
* Please note that this method provides a best-effort service because not all
* media changers support forceful dismounts.
*
* @param vid The volume identifier of the tape to be mounted.
* @param librarySlot The slot in the library that contains the tape drive.
*/
virtual void forceDismountTape(const std::string &vid, const LibrarySlot &librarySlot) = 0;
}; // class MediaChangerProxy
} // namespace mediachanger
......
......@@ -59,15 +59,5 @@ void MmcProxy::dismountTape( const std::string &vid, const LibrarySlot &libraryS
m_log(log::WARNING, "Tape should be manual dismounted", params);
}
//------------------------------------------------------------------------------
// forceDismountTape
//------------------------------------------------------------------------------
void MmcProxy::forceDismountTape(const std::string &vid, const LibrarySlot &librarySlot) {
std::list<log::Param> params = {
log::Param("tapeVid", vid),
log::Param("librarySlot", librarySlot.str())};
m_log(log::WARNING, "Tape should be manual dismounted", params);
}
} // namespace medichanger
} // namespace cta
......@@ -67,19 +67,6 @@ public:
*/
void dismountTape(const std::string &vid, const LibrarySlot &librarySlot) override;
/**
* Requests the media changer to forcefully dismount the specified tape from
* the drive in the specifed library slot. Forcefully means rewinding and
* ejecting the tape where necessary.
*
* Please note that this method provides a best-effort service because not all
* media changers support forceful dismounts.
*
* @param vid The volume identifier of the tape.
* @param librarySlot The library slot containing the tape drive.
*/
void forceDismountTape(const std::string &vid, const LibrarySlot &librarySlot) override;
private:
/**
......
......@@ -100,14 +100,6 @@ void RmcProxy::dismountTape(const std::string &vid, const LibrarySlot &librarySl
}
}
//------------------------------------------------------------------------------
// forceDismountTape
//------------------------------------------------------------------------------
void RmcProxy::forceDismountTape(const std::string &vid, const LibrarySlot &librarySlot) {
// SCSI libraries do not support forced dismounts
dismountTape(vid, librarySlot);
}
//-----------------------------------------------------------------------------
// connectToRmc
//-----------------------------------------------------------------------------
......
......@@ -88,19 +88,6 @@ public:
*/
void dismountTape(const std::string &vid, const LibrarySlot &librarySlot) override;
/**
* Requests the media changer to forcefully dismount the specified tape from
* the drive in the specifed library slot. Forcefully means rewinding and
* ejecting the tape where necessary.
*
* Please note that this method provides a best-effort service because not all
* media changers support forceful dismounts.
*
* @param vid The volume identifier of the tape.
* @param librarySlot The library slot containing the tape drive.
*/
void forceDismountTape(const std::string &vid, const LibrarySlot &librarySlot) override;
protected:
/**
......
......@@ -40,9 +40,6 @@ Turns on the printing of debug information.
.TP
\fB\-h, \-\-help
Prints the usage message.
.TP
\fB\-f, \-\-force
Force the dismount (rewind and eject the tape where necessary).
.SH "RETURN CODES"
.TP
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment