diff --git a/mediachanger/DismountCmd.cpp b/mediachanger/DismountCmd.cpp index 87d8dd6937111822b36f73db4cc724067225ff72..3e0dbe93cf4e9aba5ce634bd1fe63466d98491e0 100644 --- a/mediachanger/DismountCmd.cpp +++ b/mediachanger/DismountCmd.cpp @@ -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; } diff --git a/mediachanger/DismountCmdLine.cpp b/mediachanger/DismountCmdLine.cpp index cb759d84d56c8ddace96d4a386a832cd3d5ef018..e454b09405618a5ac784f1213172f6812356e968 100644 --- a/mediachanger/DismountCmdLine.cpp +++ b/mediachanger/DismountCmdLine.cpp @@ -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"; } //------------------------------------------------------------------------------ diff --git a/mediachanger/DismountCmdLine.hpp b/mediachanger/DismountCmdLine.hpp index 784f4c89d2c52b59634b0454da869c03cebb2a3a..3872398eef73079b40320e150a492ed213e0f1a5 100644 --- a/mediachanger/DismountCmdLine.hpp +++ b/mediachanger/DismountCmdLine.hpp @@ -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(). * diff --git a/mediachanger/DismountCmdLineTest.cpp b/mediachanger/DismountCmdLineTest.cpp index 7503f50c849f3d410e5103e53cad6194d2916669..d73cd8789ab80ee7a20c88c3aaf45a59426ef270 100644 --- a/mediachanger/DismountCmdLineTest.cpp +++ b/mediachanger/DismountCmdLineTest.cpp @@ -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()); } diff --git a/mediachanger/MediaChangerFacade.cpp b/mediachanger/MediaChangerFacade.cpp index 9a686409da434bd87ca276a7b8e95c3d3b25487b..1add0b4cbbaa67b2ffd9dfa29b4c7b71a471b66d 100644 --- a/mediachanger/MediaChangerFacade.cpp +++ b/mediachanger/MediaChangerFacade.cpp @@ -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 //------------------------------------------------------------------------------ diff --git a/mediachanger/MediaChangerFacade.hpp b/mediachanger/MediaChangerFacade.hpp index eac2cd3a2a8c83332b1b413025b2affdd8799c43..9a47b132c798f818ce827e2fe9f1d005f5e046fc 100644 --- a/mediachanger/MediaChangerFacade.hpp +++ b/mediachanger/MediaChangerFacade.hpp @@ -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: /** diff --git a/mediachanger/MediaChangerProxy.hpp b/mediachanger/MediaChangerProxy.hpp index 31e60acc128ca3ad1f97a86e89fe3c14827bf173..d649e7be5da0977b71a166ad553b79bd01ece2f7 100644 --- a/mediachanger/MediaChangerProxy.hpp +++ b/mediachanger/MediaChangerProxy.hpp @@ -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 diff --git a/mediachanger/MmcProxy.cpp b/mediachanger/MmcProxy.cpp index a33ff12768da307a202dfa9c33f4aa4c9a248263..924e57db0962affc7fd9d50bbb2ecd95c734def9 100644 --- a/mediachanger/MmcProxy.cpp +++ b/mediachanger/MmcProxy.cpp @@ -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 diff --git a/mediachanger/MmcProxy.hpp b/mediachanger/MmcProxy.hpp index 59ffcdbe89cee0bfe70f58199477f9fc2e25efd4..7dbaf8ea1be82941781c57048c5902e6516d481f 100644 --- a/mediachanger/MmcProxy.hpp +++ b/mediachanger/MmcProxy.hpp @@ -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: /** diff --git a/mediachanger/RmcProxy.cpp b/mediachanger/RmcProxy.cpp index 133a077a1752a860a2d1c4c4aeba3553bd39e098..7776fcf35285b7ca87ec9df68895f347186aed5a 100644 --- a/mediachanger/RmcProxy.cpp +++ b/mediachanger/RmcProxy.cpp @@ -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 //----------------------------------------------------------------------------- diff --git a/mediachanger/RmcProxy.hpp b/mediachanger/RmcProxy.hpp index b936565548c5d06280ce67ecb9e817f05ecf1106..7efb1b4956d5e32e8aa288617337a123bb29c8bb 100644 --- a/mediachanger/RmcProxy.hpp +++ b/mediachanger/RmcProxy.hpp @@ -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: /** diff --git a/mediachanger/cta-mediachanger-dismount.1cta b/mediachanger/cta-mediachanger-dismount.1cta index 6d254e70b9abc1503f48be171ab7406679675cc0..cc91521e0b43d43a03b3b836a736f46b4adb0367 100644 --- a/mediachanger/cta-mediachanger-dismount.1cta +++ b/mediachanger/cta-mediachanger-dismount.1cta @@ -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