From 7cda13a4a258cc50e576eca1e706b7fc8786ef2c Mon Sep 17 00:00:00 2001 From: Steven Murray <Steven.Murray@cern.ch> Date: Mon, 19 Apr 2021 21:04:52 +0200 Subject: [PATCH] Removed the Oracle library only feature forceDismountTape() --- mediachanger/DismountCmd.cpp | 7 +----- mediachanger/DismountCmdLine.cpp | 25 ++++----------------- mediachanger/DismountCmdLine.hpp | 14 ------------ mediachanger/DismountCmdLineTest.cpp | 7 ------ mediachanger/MediaChangerFacade.cpp | 14 ------------ mediachanger/MediaChangerFacade.hpp | 13 ----------- mediachanger/MediaChangerProxy.hpp | 13 ----------- mediachanger/MmcProxy.cpp | 10 --------- mediachanger/MmcProxy.hpp | 13 ----------- mediachanger/RmcProxy.cpp | 8 ------- mediachanger/RmcProxy.hpp | 13 ----------- mediachanger/cta-mediachanger-dismount.1cta | 3 --- 12 files changed, 5 insertions(+), 135 deletions(-) diff --git a/mediachanger/DismountCmd.cpp b/mediachanger/DismountCmd.cpp index 87d8dd6937..3e0dbe93cf 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 cb759d84d5..e454b09405 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 784f4c89d2..3872398eef 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 7503f50c84..d73cd8789a 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 9a686409da..1add0b4cbb 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 eac2cd3a2a..9a47b132c7 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 31e60acc12..d649e7be5d 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 a33ff12768..924e57db09 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 59ffcdbe89..7dbaf8ea1b 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 133a077a17..7776fcf352 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 b936565548..7efb1b4956 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 6d254e70b9..cc91521e0b 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 -- GitLab