diff --git a/common/dataStructures/MountType.cpp b/common/dataStructures/MountType.cpp index b31a47f4ad9d389f19798d80be37c07a823d7372..5cc860ad69f9fc79a5363677d2c1c1645a9cfd59 100644 --- a/common/dataStructures/MountType.cpp +++ b/common/dataStructures/MountType.cpp @@ -20,8 +20,10 @@ std::string cta::common::dataStructures::toString(cta::common::dataStructures::MountType type) { switch(type) { - case cta::common::dataStructures::MountType::Archive: - return "Archive"; + case cta::common::dataStructures::MountType::ArchiveForUser: + return "ArchiveForUser"; + case cta::common::dataStructures::MountType::ArchiveForRepack: + return "ArchiveForRepack"; case cta::common::dataStructures::MountType::Retrieve: return "Retrieve"; case cta::common::dataStructures::MountType::Label: diff --git a/common/dataStructures/MountType.hpp b/common/dataStructures/MountType.hpp index c4f9aff857d52b2035526cad2b1847b7ec546508..551f8c673d935efab66b709c6a8ef7c157a2cd4f 100644 --- a/common/dataStructures/MountType.hpp +++ b/common/dataStructures/MountType.hpp @@ -24,9 +24,10 @@ namespace cta { namespace common { namespace dataStructures { enum class MountType: uint32_t { - Archive = 1, - Retrieve = 2, - Label = 3, + ArchiveForUser = 1, + ArchiveForRepack = 2, + Retrieve = 3, + Label = 4, NoMount = 0 }; diff --git a/common/dataStructures/QueueAndMountSummary.cpp b/common/dataStructures/QueueAndMountSummary.cpp index e589a9d29c0f0efb9bd7f582155e0be047b474df..c636d5dda528232df75dd436a0f3d9872eb05321 100644 --- a/common/dataStructures/QueueAndMountSummary.cpp +++ b/common/dataStructures/QueueAndMountSummary.cpp @@ -30,15 +30,15 @@ QueueAndMountSummary &QueueAndMountSummary::getOrCreateEntry(std::list<QueueAndM const common::dataStructures::VidToTapeMap &vid_to_tapeinfo) { for (auto & summary: summaryList) { - if ((mountType==MountType::Archive && summary.tapePool==tapePool) || + if ((mountType==MountType::ArchiveForUser && summary.tapePool==tapePool) || (mountType==MountType::Retrieve && summary.vid==vid)) return summary; } - if (std::set<MountType>({MountType::Archive, MountType::Retrieve}).count(mountType)) { + if (std::set<MountType>({MountType::ArchiveForUser, MountType::Retrieve}).count(mountType)) { summaryList.push_back(QueueAndMountSummary()); summaryList.back().mountType=mountType; summaryList.back().tapePool=tapePool; - if (MountType::Archive==mountType) { + if (MountType::ArchiveForUser==mountType) { summaryList.back().vid="-"; summaryList.back().logicalLibrary="-"; } else { diff --git a/scheduler/ArchiveMount.cpp b/scheduler/ArchiveMount.cpp index be6f00311bd290474f1596fb55c0659d708767df..7e61432be7eff8cb6016d257d755cb1506fdc781 100644 --- a/scheduler/ArchiveMount.cpp +++ b/scheduler/ArchiveMount.cpp @@ -43,7 +43,7 @@ cta::ArchiveMount::ArchiveMount(catalogue::Catalogue & catalogue, // getMountType //------------------------------------------------------------------------------ cta::common::dataStructures::MountType cta::ArchiveMount::getMountType() const { - return cta::common::dataStructures::MountType::Archive; + return cta::common::dataStructures::MountType::ArchiveForUser; } //------------------------------------------------------------------------------ diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index 44f49e99dbe4208e31decbcdd12afaa96c12120c..20fb66ec2876d9124f7e340ad75b1281472e5f14 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -210,7 +210,7 @@ void OStoreDB::fetchMountInfo(SchedulerDatabase::TapeMountDecisionInfo& tmdi, Ro tmdi.potentialMounts.push_back(SchedulerDatabase::PotentialMount()); auto & m = tmdi.potentialMounts.back(); m.tapePool = aqp.tapePool; - m.type = cta::common::dataStructures::MountType::Archive; + m.type = cta::common::dataStructures::MountType::ArchiveForUser; m.bytesQueued = aqueue.getJobsSummary().bytes; m.filesQueued = aqueue.getJobsSummary().jobs; m.oldestJobStartTime = aqueue.getJobsSummary().oldestJobStartTime; @@ -292,7 +292,7 @@ void OStoreDB::fetchMountInfo(SchedulerDatabase::TapeMountDecisionInfo& tmdi, Ro (int)cta::common::dataStructures::DriveStatus::DrainingToDisk, (int)cta::common::dataStructures::DriveStatus::CleaningUp }; std::set<int> activeMountTypes = { - (int)cta::common::dataStructures::MountType::Archive, + (int)cta::common::dataStructures::MountType::ArchiveForUser, (int)cta::common::dataStructures::MountType::Retrieve, (int)cta::common::dataStructures::MountType::Label }; for (const auto &d : driveStates) { @@ -2828,7 +2828,7 @@ std::unique_ptr<SchedulerDatabase::ArchiveMount> driveInfo.logicalLibrary=logicalLibrary; driveInfo.host=hostName; ReportDriveStatusInputs inputs; - inputs.mountType = common::dataStructures::MountType::Archive; + inputs.mountType = common::dataStructures::MountType::ArchiveForUser; inputs.byteTransferred = 0; inputs.filesTransferred = 0; inputs.latestBandwidth = 0; @@ -3239,7 +3239,7 @@ void OStoreDB::ArchiveMount::setDriveStatus(cta::common::dataStructures::DriveSt driveInfo.logicalLibrary=mountInfo.logicalLibrary; driveInfo.host=mountInfo.host; ReportDriveStatusInputs inputs; - inputs.mountType = common::dataStructures::MountType::Archive; + inputs.mountType = common::dataStructures::MountType::ArchiveForUser; inputs.mountSessionId = mountInfo.mountId; inputs.reportTime = completionTime; inputs.status = status; diff --git a/scheduler/Scheduler.cpp b/scheduler/Scheduler.cpp index 641cb0a2e5498258d1bf37ce142a1bcf51576f4b..6d737be696a6ed5140b9c76e7296027180a49a81 100644 --- a/scheduler/Scheduler.cpp +++ b/scheduler/Scheduler.cpp @@ -792,7 +792,7 @@ void Scheduler::sortAndGetTapesForMountInfo(std::unique_ptr<SchedulerDatabase::T existingMounts = 0; } uint32_t effectiveExistingMounts = 0; - if (m->type == common::dataStructures::MountType::Archive) effectiveExistingMounts = existingMounts; + if (m->type == common::dataStructures::MountType::ArchiveForUser) effectiveExistingMounts = existingMounts; bool mountPassesACriteria = false; if (m->bytesQueued / (1 + effectiveExistingMounts) >= m_minBytesToWarrantAMount) @@ -855,7 +855,7 @@ void Scheduler::sortAndGetTapesForMountInfo(std::unique_ptr<SchedulerDatabase::T // list of tapes from the catalogue. if (std::count_if( mountInfo->potentialMounts.cbegin(), mountInfo->potentialMounts.cend(), - [](decltype(*mountInfo->potentialMounts.cbegin())& m){ return m.type == common::dataStructures::MountType::Archive; } )) { + [](decltype(*mountInfo->potentialMounts.cbegin())& m){ return m.type == common::dataStructures::MountType::ArchiveForUser; } )) { tapeList = m_catalogue.getTapesForWriting(logicalLibraryName); getTapeForWriteTime = timer.secs(utils::Timer::resetCounter); } @@ -899,7 +899,7 @@ bool Scheduler::getNextMountDryRun(const std::string& logicalLibraryName, const // We can now simply iterate on the candidates until we manage to find a valid mount for (auto m = mountInfo->potentialMounts.begin(); m!=mountInfo->potentialMounts.end(); m++) { // If the mount is an archive, we still have to find a tape. - if (m->type==common::dataStructures::MountType::Archive) { + if (m->type==common::dataStructures::MountType::ArchiveForUser) { // We need to find a tape for archiving. It should be both in the right // tape pool and in the drive's logical library // The first tape matching will go for a prototype. @@ -1033,7 +1033,7 @@ std::unique_ptr<TapeMount> Scheduler::getNextMount(const std::string &logicalLib // mount for one of them for (auto m = mountInfo->potentialMounts.begin(); m!=mountInfo->potentialMounts.end(); m++) { // If the mount is an archive, we still have to find a tape. - if (m->type==common::dataStructures::MountType::Archive) { + if (m->type==common::dataStructures::MountType::ArchiveForUser) { // We need to find a tape for archiving. It should be both in the right // tape pool and in the drive's logical library // The first tape matching will go for a prototype. @@ -1203,7 +1203,7 @@ std::list<common::dataStructures::QueueAndMountSummary> Scheduler::getQueuesAndM // Find or create the relevant entry. auto &summary = common::dataStructures::QueueAndMountSummary::getOrCreateEntry(ret, pm.type, pm.tapePool, pm.vid, vid_to_tapeinfo); switch (pm.type) { - case common::dataStructures::MountType::Archive: + case common::dataStructures::MountType::ArchiveForUser: summary.mountPolicy.archivePriority = pm.priority; summary.mountPolicy.archiveMinRequestAge = pm.minRequestAge; summary.mountPolicy.maxDrivesAllowed = pm.maxDrivesAllowed; @@ -1227,7 +1227,7 @@ std::list<common::dataStructures::QueueAndMountSummary> Scheduler::getQueuesAndM for (auto & em: mountDecisionInfo->existingOrNextMounts) { auto &summary = common::dataStructures::QueueAndMountSummary::getOrCreateEntry(ret, em.type, em.tapePool, em.vid, vid_to_tapeinfo); switch (em.type) { - case common::dataStructures::MountType::Archive: + case common::dataStructures::MountType::ArchiveForUser: case common::dataStructures::MountType::Retrieve: if (em.currentMount) summary.currentMounts++; @@ -1244,7 +1244,7 @@ std::list<common::dataStructures::QueueAndMountSummary> Scheduler::getQueuesAndM mountDecisionInfo.reset(); // Add the tape information where useful (archive queues). for (auto & mountOrQueue: ret) { - if (common::dataStructures::MountType::Archive==mountOrQueue.mountType) { + if (common::dataStructures::MountType::ArchiveForUser==mountOrQueue.mountType) { // Get all the tape for this pool cta::catalogue::TapeSearchCriteria tsc; tsc.tapePool = mountOrQueue.tapePool; diff --git a/scheduler/SchedulerDatabase.hpp b/scheduler/SchedulerDatabase.hpp index d0a2ccc5cc6091ff86c2cd707bbe167f5d570ee3..1cfa30faadd7a3e633b13ae9f30dd050aec12235 100644 --- a/scheduler/SchedulerDatabase.hpp +++ b/scheduler/SchedulerDatabase.hpp @@ -528,9 +528,9 @@ public: return true; if (priority > other.priority) return false; - if (type == cta::common::dataStructures::MountType::Archive && other.type != cta::common::dataStructures::MountType::Archive) + if (type == cta::common::dataStructures::MountType::ArchiveForUser && other.type != cta::common::dataStructures::MountType::ArchiveForUser) return false; - if (other.type == cta::common::dataStructures::MountType::Archive && type != cta::common::dataStructures::MountType::Archive) + if (other.type == cta::common::dataStructures::MountType::ArchiveForUser && type != cta::common::dataStructures::MountType::ArchiveForUser) return true; if (ratioOfMountQuotaUsed < other.ratioOfMountQuotaUsed) return true; diff --git a/scheduler/SchedulerTest.cpp b/scheduler/SchedulerTest.cpp index c0fc7073274e173135ab9a9c8ba5313bec252fa5..0689fa4ad6f2f6b59ed55247f5cdc589d90ca54b 100644 --- a/scheduler/SchedulerTest.cpp +++ b/scheduler/SchedulerTest.cpp @@ -462,7 +462,7 @@ TEST_P(SchedulerTest, archive_report_and_retrieve_new_file) { scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Up, lc); mount.reset(scheduler.getNextMount(s_libraryName, "drive0", lc).release()); ASSERT_NE(nullptr, mount.get()); - ASSERT_EQ(cta::common::dataStructures::MountType::Archive, mount.get()->getMountType()); + ASSERT_EQ(cta::common::dataStructures::MountType::ArchiveForUser, mount.get()->getMountType()); auto & osdb=getSchedulerDB(); auto mi=osdb.getMountInfo(lc); ASSERT_EQ(1, mi->existingOrNextMounts.size()); @@ -664,7 +664,7 @@ TEST_P(SchedulerTest, archive_and_retrieve_failure) { scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Up, lc); mount.reset(scheduler.getNextMount(s_libraryName, "drive0", lc).release()); ASSERT_NE(nullptr, mount.get()); - ASSERT_EQ(cta::common::dataStructures::MountType::Archive, mount.get()->getMountType()); + ASSERT_EQ(cta::common::dataStructures::MountType::ArchiveForUser, mount.get()->getMountType()); auto & osdb=getSchedulerDB(); auto mi=osdb.getMountInfo(lc); ASSERT_EQ(1, mi->existingOrNextMounts.size()); @@ -917,7 +917,7 @@ TEST_P(SchedulerTest, archive_and_retrieve_report_failure) { scheduler.reportDriveStatus(driveInfo, cta::common::dataStructures::MountType::NoMount, cta::common::dataStructures::DriveStatus::Up, lc); mount.reset(scheduler.getNextMount(s_libraryName, "drive0", lc).release()); ASSERT_NE(nullptr, mount.get()); - ASSERT_EQ(cta::common::dataStructures::MountType::Archive, mount.get()->getMountType()); + ASSERT_EQ(cta::common::dataStructures::MountType::ArchiveForUser, mount.get()->getMountType()); auto & osdb=getSchedulerDB(); auto mi=osdb.getMountInfo(lc); ASSERT_EQ(1, mi->existingOrNextMounts.size()); @@ -1158,7 +1158,7 @@ TEST_P(SchedulerTest, retry_archive_until_max_reached) { std::unique_ptr<cta::TapeMount> mount; mount.reset(scheduler.getNextMount(s_libraryName, "drive0", lc).release()); ASSERT_NE(nullptr, mount.get()); - ASSERT_EQ(cta::common::dataStructures::MountType::Archive, mount.get()->getMountType()); + ASSERT_EQ(cta::common::dataStructures::MountType::ArchiveForUser, mount.get()->getMountType()); std::unique_ptr<cta::ArchiveMount> archiveMount; archiveMount.reset(dynamic_cast<cta::ArchiveMount*>(mount.release())); ASSERT_NE(nullptr, archiveMount.get()); diff --git a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp index 167224b94c503d7694cd2747615ac1540808cb3c..66806fa0f41061ab8e87f57926f87088c540e351 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp @@ -195,8 +195,11 @@ schedule: switch(m_volInfo.mountType) { case cta::common::dataStructures::MountType::Retrieve: return executeRead(lc, dynamic_cast<cta::RetrieveMount *>(tapeMount.get())); - case cta::common::dataStructures::MountType::Archive: + case cta::common::dataStructures::MountType::ArchiveForUser: + case cta::common::dataStructures::MountType::ArchiveForRepack: return executeWrite(lc, dynamic_cast<cta::ArchiveMount *>(tapeMount.get())); + + case cta::common::dataStructures::MountType::Label: return executeLabel(lc, dynamic_cast<cta::LabelMount *>(tapeMount.get())); default: @@ -541,7 +544,7 @@ const char *castor::tape::tapeserver::daemon::DataTransferSession:: mountTypeToString(const cta::common::dataStructures::MountType mountType) const throw() { switch(mountType) { case cta::common::dataStructures::MountType::Retrieve: return "Retrieve"; - case cta::common::dataStructures::MountType::Archive : return "Archive"; + case cta::common::dataStructures::MountType::ArchiveForUser : return "Archive"; case cta::common::dataStructures::MountType::Label: return "Label"; default : return "UNKNOWN"; } diff --git a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp index 570b550d08ac50c325536088446ca2cb554484ae..673bd7866730167226962a5515421811ccc3d006 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp @@ -1692,7 +1692,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullMigration) { logToCheck += ""; ASSERT_NE(std::string::npos,logToCheck.find("MSG=\"Tape session started\" thread=\"TapeWrite\" tapeDrive=\"T10D6116\" tapeVid=\"TstVid\" " "mountId=\"1\" vo=\"vo\" mediaType=\"TestMediaType\" tapePool=\"TestTapePool\" logicalLibrary=\"TestLogicalLibrary\" " - "mountType=\"Archive\" vendor=\"TestVendor\" capacityInBytes=\"12345678\"")); + "mountType=\"ArchiveForUser\" vendor=\"TestVendor\" capacityInBytes=\"12345678\"")); ASSERT_NE(std::string::npos, logToCheck.find("firmwareVersion=\"123A\" serialNumber=\"123456\" " "mountTotalCorrectedWriteErrors=\"5\" mountTotalUncorrectedWriteErrors=\"1\" " "mountTotalWriteBytesProcessed=\"4096\" mountTotalNonMediumErrorCounts=\"2\"")); diff --git a/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.cpp b/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.cpp index 8d11fe14f3c246db6c68496aad4a4f3acf70e1e0..2c61233c1bc3abe82afd3a4ccef962ef68c402e5 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.cpp @@ -195,7 +195,8 @@ const char *castor::tape::tapeserver::daemon::TapeReadSingleThread:: mountTypeToString(const cta::common::dataStructures::MountType mountType) const throw() { switch(mountType) { case cta::common::dataStructures::MountType::Retrieve: return "Retrieve"; - case cta::common::dataStructures::MountType::Archive : return "Archive"; + case cta::common::dataStructures::MountType::ArchiveForUser : return "ArchiveForUser"; + case cta::common::dataStructures::MountType::ArchiveForRepack : return "ArchiveForRepack"; case cta::common::dataStructures::MountType::Label: return "Label"; default : return "UNKNOWN"; } diff --git a/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.cpp b/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.cpp index 59a35fcfe4634392ebfe010f74f0474649b45f0f..11b2b998c246219fae5b49edf427bef0596fa425 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.cpp @@ -255,7 +255,8 @@ const char *castor::tape::tapeserver::daemon::TapeWriteSingleThread:: mountTypeToString(const cta::common::dataStructures::MountType mountType) const throw() { switch(mountType) { case cta::common::dataStructures::MountType::Retrieve: return "Retrieve"; - case cta::common::dataStructures::MountType::Archive : return "Archive"; + case cta::common::dataStructures::MountType::ArchiveForUser: return "ArchiveForUser"; + case cta::common::dataStructures::MountType::ArchiveForRepack: return "ArchiveForRepack"; case cta::common::dataStructures::MountType::Label: return "Label"; default : return "UNKNOWN"; } diff --git a/tapeserver/castor/tape/tapeserver/file/BasicReadWriteTest.cpp b/tapeserver/castor/tape/tapeserver/file/BasicReadWriteTest.cpp index 9368973deb77e549ff2a20ab0918bdba34aa49da..683f1f9545445be1d4446da5c47b5923c522bcdd 100644 --- a/tapeserver/castor/tape/tapeserver/file/BasicReadWriteTest.cpp +++ b/tapeserver/castor/tape/tapeserver/file/BasicReadWriteTest.cpp @@ -180,7 +180,7 @@ int main (int argc, char *argv[]) castor::tape::tapeserver::daemon::VolumeInfo m_volInfo; m_volInfo.vid = label; m_volInfo.nbFiles = 0; - m_volInfo.mountType = cta::common::dataStructures::MountType::Archive; + m_volInfo.mountType = cta::common::dataStructures::MountType::ArchiveForUser; castor::tape::tapeFile::WriteSession *ws; ws = new castor::tape::tapeFile::WriteSession(*drive, m_volInfo, 0, true, true); diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.cpp b/xroot_plugins/XrdSsiCtaRequestMessage.cpp index 6361efe6de4fc809de4c920535407cd0cfd6ffc8..ddb4732fc1fd6ede88042044c2c1d9efd07d2bcc 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.cpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.cpp @@ -1642,7 +1642,7 @@ void RequestMessage::processShowQueues(const cta::admin::AdminCmd &admincmd, cta currentRow.push_back(std::to_string(q.filesQueued)); currentRow.push_back(bytesToMbString(q.bytesQueued)); currentRow.push_back(std::to_string(q.oldestJobAge)); - if (common::dataStructures::MountType::Archive == q.mountType) { + if (common::dataStructures::MountType::ArchiveForUser == q.mountType) { currentRow.push_back(std::to_string(q.mountPolicy.archivePriority)); currentRow.push_back(std::to_string(q.mountPolicy.archiveMinRequestAge)); currentRow.push_back(std::to_string(q.mountPolicy.maxDrivesAllowed));