Commit 063dd874 authored by Steven Murray's avatar Steven Murray
Browse files

Removed the Oracle library only feature forceDismountTape()

parent 00093474
...@@ -66,11 +66,6 @@ int cta::mediachanger::DismountCmd::exceptionThrowingMain(const int argc, ...@@ -66,11 +66,6 @@ int cta::mediachanger::DismountCmd::exceptionThrowingMain(const int argc,
m_dbg << "DRIVE_SLOT = " << m_cmdLine.getDriveLibrarySlot().str() << m_dbg << "DRIVE_SLOT = " << m_cmdLine.getDriveLibrarySlot().str() <<
std::endl; std::endl;
if(m_cmdLine.getForce()) { m_mc.dismountTape(m_cmdLine.getVid(), m_cmdLine.getDriveLibrarySlot());
m_mc.forceDismountTape(m_cmdLine.getVid(),
m_cmdLine.getDriveLibrarySlot());
} else {
m_mc.dismountTape(m_cmdLine.getVid(), m_cmdLine.getDriveLibrarySlot());
}
return 0; return 0;
} }
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
cta::mediachanger::DismountCmdLine::DismountCmdLine(): cta::mediachanger::DismountCmdLine::DismountCmdLine():
m_debug(false), m_debug(false),
m_help(false), m_help(false),
m_driveLibrarySlot(0), m_driveLibrarySlot(0) {
m_force(false) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -40,13 +39,11 @@ cta::mediachanger::DismountCmdLine::DismountCmdLine(const int argc, ...@@ -40,13 +39,11 @@ cta::mediachanger::DismountCmdLine::DismountCmdLine(const int argc,
char *const *const argv): char *const *const argv):
m_debug(false), m_debug(false),
m_help(false), m_help(false),
m_driveLibrarySlot(0), m_driveLibrarySlot(0) {
m_force(false) {
static struct option longopts[] = { static struct option longopts[] = {
{"debug", 0, NULL, 'd'}, {"debug", 0, NULL, 'd'},
{"help" , 0, NULL, 'h'}, {"help" , 0, NULL, 'h'},
{"force", 0, NULL, 'f'},
{NULL , 0, NULL, 0} {NULL , 0, NULL, 0}
}; };
...@@ -94,8 +91,7 @@ cta::mediachanger::DismountCmdLine::DismountCmdLine( ...@@ -94,8 +91,7 @@ cta::mediachanger::DismountCmdLine::DismountCmdLine(
m_help(obj.m_help), m_help(obj.m_help),
m_vid(obj.m_vid), m_vid(obj.m_vid),
m_driveLibrarySlot(0 == obj.m_driveLibrarySlot ? 0 : m_driveLibrarySlot(0 == obj.m_driveLibrarySlot ? 0 :
obj.m_driveLibrarySlot->clone()), obj.m_driveLibrarySlot->clone()) {
m_force(obj.m_force) {
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -120,19 +116,11 @@ cta::mediachanger::DismountCmdLine &cta::mediachanger::DismountCmdLine:: ...@@ -120,19 +116,11 @@ cta::mediachanger::DismountCmdLine &cta::mediachanger::DismountCmdLine::
m_vid = rhs.m_vid; m_vid = rhs.m_vid;
m_driveLibrarySlot = 0 == rhs.m_driveLibrarySlot ? 0 : m_driveLibrarySlot = 0 == rhs.m_driveLibrarySlot ? 0 :
rhs.m_driveLibrarySlot->clone(); rhs.m_driveLibrarySlot->clone();
m_force = rhs.m_force;
} }
return *this; return *this;
} }
//------------------------------------------------------------------------------
// getForce
//------------------------------------------------------------------------------
bool cta::mediachanger::DismountCmdLine::getForce() const {
return m_force;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// getProgramName // getProgramName
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -151,9 +139,6 @@ void cta::mediachanger::DismountCmdLine::processOption(const int opt) { ...@@ -151,9 +139,6 @@ void cta::mediachanger::DismountCmdLine::processOption(const int opt) {
case 'h': case 'h':
m_help = true; m_help = true;
break; break;
case 'f':
m_force = true;
break;
case ':': case ':':
return handleMissingParameter(optopt); return handleMissingParameter(optopt);
case '?': case '?':
...@@ -193,9 +178,7 @@ std::string cta::mediachanger::DismountCmdLine::getUsage() { ...@@ -193,9 +178,7 @@ std::string cta::mediachanger::DismountCmdLine::getUsage() {
"\n" "\n"
" -h|--help Print this help message and exit.\n" " -h|--help Print this help message and exit.\n"
"\n" "\n"
" -f|--force Force the dismount (rewind and eject the tape where necessary)." "Comments to: cta-support@cern.ch\n";
"\n"
"Comments to: Castor.Support@cern.ch\n";
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -101,14 +101,6 @@ public: ...@@ -101,14 +101,6 @@ public:
*/ */
const LibrarySlot &getDriveLibrarySlot() const; 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. * Return sthe program name.
* *
...@@ -138,12 +130,6 @@ private: ...@@ -138,12 +130,6 @@ private:
*/ */
LibrarySlot *m_driveLibrarySlot; 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(). * Processes the specified option that was returned by getopt_long().
* *
......
...@@ -81,7 +81,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, copy_constructor) { ...@@ -81,7 +81,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, copy_constructor) {
DismountCmdLine cmdLine1(args->argc, args->argv); DismountCmdLine cmdLine1(args->argc, args->argv);
ASSERT_FALSE(cmdLine1.getHelp()); ASSERT_FALSE(cmdLine1.getHelp());
ASSERT_FALSE(cmdLine1.getDebug()); ASSERT_FALSE(cmdLine1.getDebug());
ASSERT_FALSE(cmdLine1.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine1.getDriveLibrarySlot().getLibraryType()); ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine1.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc1"), ASSERT_EQ(std::string("smc1"),
cmdLine1.getDriveLibrarySlot().str()); cmdLine1.getDriveLibrarySlot().str());
...@@ -89,7 +88,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, copy_constructor) { ...@@ -89,7 +88,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, copy_constructor) {
DismountCmdLine cmdLine2(cmdLine1); DismountCmdLine cmdLine2(cmdLine1);
ASSERT_FALSE(cmdLine2.getHelp()); ASSERT_FALSE(cmdLine2.getHelp());
ASSERT_FALSE(cmdLine2.getDebug()); ASSERT_FALSE(cmdLine2.getDebug());
ASSERT_FALSE(cmdLine2.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI,
cmdLine2.getDriveLibrarySlot().getLibraryType()); cmdLine2.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc1"), cmdLine2.getDriveLibrarySlot().str()); ASSERT_EQ(std::string("smc1"), cmdLine2.getDriveLibrarySlot().str());
...@@ -110,7 +108,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) { ...@@ -110,7 +108,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) {
DismountCmdLine cmdLine1(args1->argc, args1->argv); DismountCmdLine cmdLine1(args1->argc, args1->argv);
ASSERT_FALSE(cmdLine1.getHelp()); ASSERT_FALSE(cmdLine1.getHelp());
ASSERT_FALSE(cmdLine1.getDebug()); ASSERT_FALSE(cmdLine1.getDebug());
ASSERT_FALSE(cmdLine1.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine1.getDriveLibrarySlot().getLibraryType()); ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine1.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc1"), cmdLine1.getDriveLibrarySlot().str()); ASSERT_EQ(std::string("smc1"), cmdLine1.getDriveLibrarySlot().str());
...@@ -126,7 +123,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) { ...@@ -126,7 +123,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) {
DismountCmdLine cmdLine2(args2->argc, args2->argv); DismountCmdLine cmdLine2(args2->argc, args2->argv);
ASSERT_FALSE(cmdLine2.getHelp()); ASSERT_FALSE(cmdLine2.getHelp());
ASSERT_FALSE(cmdLine2.getDebug()); ASSERT_FALSE(cmdLine2.getDebug());
ASSERT_FALSE(cmdLine2.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine2.getDriveLibrarySlot().getLibraryType()); ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine2.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc2"), cmdLine2.getDriveLibrarySlot().str()); ASSERT_EQ(std::string("smc2"), cmdLine2.getDriveLibrarySlot().str());
...@@ -134,13 +130,11 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) { ...@@ -134,13 +130,11 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) {
ASSERT_FALSE(cmdLine1.getHelp()); ASSERT_FALSE(cmdLine1.getHelp());
ASSERT_FALSE(cmdLine1.getDebug()); ASSERT_FALSE(cmdLine1.getDebug());
ASSERT_FALSE(cmdLine1.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine1.getDriveLibrarySlot().getLibraryType()); ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine1.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc2"), cmdLine1.getDriveLibrarySlot().str()); ASSERT_EQ(std::string("smc2"), cmdLine1.getDriveLibrarySlot().str());
ASSERT_FALSE(cmdLine2.getHelp()); ASSERT_FALSE(cmdLine2.getHelp());
ASSERT_FALSE(cmdLine2.getDebug()); ASSERT_FALSE(cmdLine2.getDebug());
ASSERT_FALSE(cmdLine2.getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine2.getDriveLibrarySlot().getLibraryType()); ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, cmdLine2.getDriveLibrarySlot().getLibraryType());
ASSERT_EQ(std::string("smc2"), cmdLine2.getDriveLibrarySlot().str()); ASSERT_EQ(std::string("smc2"), cmdLine2.getDriveLibrarySlot().str());
} }
...@@ -162,7 +156,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, scsi) { ...@@ -162,7 +156,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, scsi) {
ASSERT_FALSE(cmdLine->getHelp()); ASSERT_FALSE(cmdLine->getHelp());
ASSERT_FALSE(cmdLine->getDebug()); ASSERT_FALSE(cmdLine->getDebug());
ASSERT_FALSE(cmdLine->getForce());
ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI, ASSERT_EQ(TAPE_LIBRARY_TYPE_SCSI,
cmdLine->getDriveLibrarySlot().getLibraryType()); cmdLine->getDriveLibrarySlot().getLibraryType());
} }
......
...@@ -71,20 +71,6 @@ void MediaChangerFacade::dismountTape(const std::string &vid, const LibrarySlot ...@@ -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 // getProxy
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -75,19 +75,6 @@ public: ...@@ -75,19 +75,6 @@ public:
*/ */
void dismountTape(const std::string &vid, const LibrarySlot &slot); 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: private:
/** /**
......
...@@ -68,19 +68,6 @@ public: ...@@ -68,19 +68,6 @@ public:
*/ */
virtual void dismountTape(const std::string &vid, const LibrarySlot &librarySlot) = 0; 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 }; // class MediaChangerProxy
} // namespace mediachanger } // namespace mediachanger
......
...@@ -59,15 +59,5 @@ void MmcProxy::dismountTape( const std::string &vid, const LibrarySlot &libraryS ...@@ -59,15 +59,5 @@ void MmcProxy::dismountTape( const std::string &vid, const LibrarySlot &libraryS
m_log(log::WARNING, "Tape should be manual dismounted", params); 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 medichanger
} // namespace cta } // namespace cta
...@@ -67,19 +67,6 @@ public: ...@@ -67,19 +67,6 @@ public:
*/ */
void dismountTape(const std::string &vid, const LibrarySlot &librarySlot) override; 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: private:
/** /**
......
...@@ -100,14 +100,6 @@ void RmcProxy::dismountTape(const std::string &vid, const LibrarySlot &librarySl ...@@ -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 // connectToRmc
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -88,19 +88,6 @@ public: ...@@ -88,19 +88,6 @@ public:
*/ */
void dismountTape(const std::string &vid, const LibrarySlot &librarySlot) override; 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: protected:
/** /**
......
...@@ -40,9 +40,6 @@ Turns on the printing of debug information. ...@@ -40,9 +40,6 @@ Turns on the printing of debug information.
.TP .TP
\fB\-h, \-\-help \fB\-h, \-\-help
Prints the usage message. Prints the usage message.
.TP
\fB\-f, \-\-force
Force the dismount (rewind and eject the tape where necessary).
.SH "RETURN CODES" .SH "RETURN CODES"
.TP .TP
......
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