From 99a07e5c67820e76330f735161b5d5543b50ad3c Mon Sep 17 00:00:00 2001 From: Michael Davis <michael.davis@cern.ch> Date: Tue, 28 May 2019 09:40:24 +0200 Subject: [PATCH] Removes cta-admin shrink, test and verify commands These commands are not implemented so I have removed them from the cta-admin interface. --- catalogue/Catalogue.hpp | 1 - cmdline/CtaAdminCmdParse.hpp | 31 --- common/CMakeLists.txt | 1 - common/dataStructures/VerifyInfo.cpp | 79 ------ common/dataStructures/VerifyInfo.hpp | 60 ----- scheduler/Scheduler.cpp | 60 ----- scheduler/Scheduler.hpp | 26 -- xroot_plugins/XrdSsiCtaRequestMessage.cpp | 300 ---------------------- xroot_plugins/XrdSsiCtaRequestMessage.hpp | 9 - xrootd-ssi-protobuf-interface | 2 +- 10 files changed, 1 insertion(+), 568 deletions(-) delete mode 100644 common/dataStructures/VerifyInfo.cpp delete mode 100644 common/dataStructures/VerifyInfo.hpp diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp index 85e3e0a6be..3a0a928252 100644 --- a/catalogue/Catalogue.hpp +++ b/catalogue/Catalogue.hpp @@ -53,7 +53,6 @@ #include "common/dataStructures/TapeFile.hpp" #include "common/dataStructures/UpdateFileInfoRequest.hpp" #include "common/dataStructures/UserIdentity.hpp" -#include "common/dataStructures/VerifyInfo.hpp" #include "common/dataStructures/VidToTapeMap.hpp" #include "common/dataStructures/WriteTestResult.hpp" #include "common/exception/UserError.hpp" diff --git a/cmdline/CtaAdminCmdParse.hpp b/cmdline/CtaAdminCmdParse.hpp index 8e2f8ce51e..11ef3897eb 100644 --- a/cmdline/CtaAdminCmdParse.hpp +++ b/cmdline/CtaAdminCmdParse.hpp @@ -205,18 +205,12 @@ const cmdLookup_t cmdLookup = { { "rmr", AdminCmd::CMD_REQUESTERMOUNTRULE }, { "showqueues", AdminCmd::CMD_SHOWQUEUES }, { "sq", AdminCmd::CMD_SHOWQUEUES }, - { "shrink", AdminCmd::CMD_SHRINK }, - { "sh", AdminCmd::CMD_SHRINK }, { "storageclass", AdminCmd::CMD_STORAGECLASS }, { "sc", AdminCmd::CMD_STORAGECLASS }, { "tape", AdminCmd::CMD_TAPE }, { "ta", AdminCmd::CMD_TAPE }, { "tapepool", AdminCmd::CMD_TAPEPOOL }, { "tp", AdminCmd::CMD_TAPEPOOL }, - { "test", AdminCmd::CMD_TEST }, - { "te", AdminCmd::CMD_TEST }, - { "verify", AdminCmd::CMD_VERIFY }, - { "ve", AdminCmd::CMD_VERIFY } }; @@ -236,9 +230,6 @@ const subcmdLookup_t subcmdLookup = { { "show", AdminCmd::SUBCMD_SHOW }, { "up", AdminCmd::SUBCMD_UP }, { "down", AdminCmd::SUBCMD_DOWN }, - { "read", AdminCmd::SUBCMD_READ }, - { "write", AdminCmd::SUBCMD_WRITE }, - { "write_auto", AdminCmd::SUBCMD_WRITE_AUTO } }; @@ -351,16 +342,9 @@ const std::map<AdminCmd::Cmd, CmdHelp> cmdHelp = { { AdminCmd::CMD_REPACK, { "repack", "re", { "add", "rm", "ls", "err" } }}, { AdminCmd::CMD_REQUESTERMOUNTRULE, { "requestermountrule", "rmr", { "add", "ch", "rm", "ls" } }}, { AdminCmd::CMD_SHOWQUEUES, { "showqueues", "sq", { } }}, - { AdminCmd::CMD_SHRINK, { "shrink", "sh", { } }}, { AdminCmd::CMD_STORAGECLASS, { "storageclass", "sc", { "add", "ch", "rm", "ls" } }}, { AdminCmd::CMD_TAPE, { "tape", "ta", { "add", "ch", "rm", "reclaim", "ls", "label" } }}, { AdminCmd::CMD_TAPEPOOL, { "tapepool", "tp", { "add", "ch", "rm", "ls" } }}, - { AdminCmd::CMD_TEST, { "test", "te", { "read", "write", "write_auto" }, - "\n This is a synchronous command that returns performance stats and errors.\n" - " It should be run on an empty self-dedicated drive. All locations are local\n" - " to the tapeserver.\n\n" - }}, - { AdminCmd::CMD_VERIFY, { "verify", "ve", { "add", "rm", "ls", "err" } }} }; @@ -513,8 +497,6 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = { {{ AdminCmd::CMD_REQUESTERMOUNTRULE, AdminCmd::SUBCMD_RM }, { opt_instance, opt_username_alias }}, {{ AdminCmd::CMD_REQUESTERMOUNTRULE, AdminCmd::SUBCMD_LS }, { opt_header.optional() }}, /*----------------------------------------------------------------------------------------------------*/ - {{ AdminCmd::CMD_SHRINK, AdminCmd::SUBCMD_NONE }, { opt_tapepool }}, - /*----------------------------------------------------------------------------------------------------*/ {{ AdminCmd::CMD_SHOWQUEUES, AdminCmd::SUBCMD_NONE }, { opt_header.optional() }}, /*----------------------------------------------------------------------------------------------------*/ {{ AdminCmd::CMD_STORAGECLASS, AdminCmd::SUBCMD_ADD }, @@ -546,19 +528,6 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = { { opt_tapepool_alias, opt_vo.optional(), opt_partialtapes.optional(), opt_encrypted.optional(), opt_comment.optional() }}, {{ AdminCmd::CMD_TAPEPOOL, AdminCmd::SUBCMD_RM }, { opt_tapepool_alias }}, {{ AdminCmd::CMD_TAPEPOOL, AdminCmd::SUBCMD_LS }, { opt_header.optional() }}, - /*----------------------------------------------------------------------------------------------------*/ - {{ AdminCmd::CMD_TEST, AdminCmd::SUBCMD_READ }, - { opt_drivename, opt_vid, opt_firstfseq, opt_lastfseq, opt_checkchecksum, opt_output }}, - {{ AdminCmd::CMD_TEST, AdminCmd::SUBCMD_WRITE }, - { opt_drivename, opt_vid, opt_filename }}, - {{ AdminCmd::CMD_TEST, AdminCmd::SUBCMD_WRITE_AUTO }, - { opt_drivename, opt_vid, opt_number_of_files_alias, opt_size, opt_input }}, - /*----------------------------------------------------------------------------------------------------*/ - {{ AdminCmd::CMD_VERIFY, AdminCmd::SUBCMD_ADD }, - { opt_vid, opt_number_of_files.optional() }}, - {{ AdminCmd::CMD_VERIFY, AdminCmd::SUBCMD_RM }, { opt_vid }}, - {{ AdminCmd::CMD_VERIFY, AdminCmd::SUBCMD_LS }, { opt_header.optional(), opt_vid.optional() }}, - {{ AdminCmd::CMD_VERIFY, AdminCmd::SUBCMD_ERR }, { opt_vid }}, }; diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index aa15bd53e9..6e36d11b42 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -66,7 +66,6 @@ set (COMMON_LIB_SRC_FILES dataStructures/UpdateFileInfoRequest.cpp dataStructures/UpdateFileStorageClassRequest.cpp dataStructures/UserIdentity.cpp - dataStructures/VerifyInfo.cpp dataStructures/WriteTestResult.cpp dataStructures/utils.cpp checksum/Checksum.cpp diff --git a/common/dataStructures/VerifyInfo.cpp b/common/dataStructures/VerifyInfo.cpp deleted file mode 100644 index 1811ea42b7..0000000000 --- a/common/dataStructures/VerifyInfo.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The CERN Tape Archive (CTA) project - * Copyright (C) 2015 CERN - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "common/dataStructures/VerifyInfo.hpp" -#include "common/dataStructures/utils.hpp" -#include "common/exception/Exception.hpp" - -namespace cta { -namespace common { -namespace dataStructures { - -//------------------------------------------------------------------------------ -// constructor -//------------------------------------------------------------------------------ -VerifyInfo::VerifyInfo(): - totalFiles(0), - totalSize(0), - filesToVerify(0), - filesFailed(0), - filesVerified(0) {} - -//------------------------------------------------------------------------------ -// operator== -//------------------------------------------------------------------------------ -bool VerifyInfo::operator==(const VerifyInfo &rhs) const { - return vid==rhs.vid - && tag==rhs.tag - && totalFiles==rhs.totalFiles - && totalSize==rhs.totalSize - && filesToVerify==rhs.filesToVerify - && filesFailed==rhs.filesFailed - && filesVerified==rhs.filesVerified - && verifyStatus==rhs.verifyStatus - && creationLog==rhs.creationLog - && errors==rhs.errors; -} - -//------------------------------------------------------------------------------ -// operator!= -//------------------------------------------------------------------------------ -bool VerifyInfo::operator!=(const VerifyInfo &rhs) const { - return !operator==(rhs); -} - -//------------------------------------------------------------------------------ -// operator<< -//------------------------------------------------------------------------------ -std::ostream &operator<<(std::ostream &os, const VerifyInfo &obj) { - os << "(vid=" << obj.vid - << " tag=" << obj.tag - << " totalFiles=" << obj.totalFiles - << " totalSize=" << obj.totalSize - << " filesToVerify=" << obj.filesToVerify - << " filesFailed=" << obj.filesFailed - << " filesVerified=" << obj.filesVerified - << " verifyStatus=" << obj.verifyStatus - << " creationLog=" << obj.creationLog - << " errors=" << obj.errors << ")"; - return os; -} - -} // namespace dataStructures -} // namespace common -} // namespace cta diff --git a/common/dataStructures/VerifyInfo.hpp b/common/dataStructures/VerifyInfo.hpp deleted file mode 100644 index 57ec4e8d02..0000000000 --- a/common/dataStructures/VerifyInfo.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * The CERN Tape Archive (CTA) project - * Copyright (C) 2015 CERN - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#pragma once - -#include <list> -#include <map> -#include <stdint.h> -#include <string> - -#include "common/dataStructures/EntryLog.hpp" - -namespace cta { -namespace common { -namespace dataStructures { - -/** - * This struct holds the information of a verify operation on a given tape - */ -struct VerifyInfo { - - VerifyInfo(); - - bool operator==(const VerifyInfo &rhs) const; - - bool operator!=(const VerifyInfo &rhs) const; - - std::string vid; - std::string tag; - uint64_t totalFiles; - uint64_t totalSize; - uint64_t filesToVerify; - uint64_t filesFailed; - uint64_t filesVerified; - std::string verifyStatus; - EntryLog creationLog; - std::map<uint64_t,std::string> errors; - -}; // struct VerifyInfo - -std::ostream &operator<<(std::ostream &os, const VerifyInfo &obj); - -} // namespace dataStructures -} // namespace common -} // namespace cta diff --git a/scheduler/Scheduler.cpp b/scheduler/Scheduler.cpp index ad12e5c892..29f7526c80 100644 --- a/scheduler/Scheduler.cpp +++ b/scheduler/Scheduler.cpp @@ -549,66 +549,6 @@ void Scheduler::RepackReportBatch::report(log::LogContext& lc) { } } - -//------------------------------------------------------------------------------ -// shrink -//------------------------------------------------------------------------------ -void Scheduler::shrink(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &tapepool) { - throw exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); -} - -//------------------------------------------------------------------------------ -// verify -//------------------------------------------------------------------------------ -void Scheduler::queueVerify(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const optional<uint64_t> numberOfFiles) { - throw exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); -} - -//------------------------------------------------------------------------------ -// cancelVerify -//------------------------------------------------------------------------------ -void Scheduler::cancelVerify(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid) { - throw exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); -} - -//------------------------------------------------------------------------------ -// getVerifys -//------------------------------------------------------------------------------ -std::list<common::dataStructures::VerifyInfo> Scheduler::getVerifys(const common::dataStructures::SecurityIdentity &cliIdentity) const { - return std::list<common::dataStructures::VerifyInfo>(); -} - -//------------------------------------------------------------------------------ -// getVerify -//------------------------------------------------------------------------------ -common::dataStructures::VerifyInfo Scheduler::getVerify(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid) const { - throw exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); -} - -//------------------------------------------------------------------------------ -// readTest -//------------------------------------------------------------------------------ -common::dataStructures::ReadTestResult Scheduler::readTest(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &driveName, const std::string &vid, - const uint64_t firstFSeq, const uint64_t lastFSeq, const bool checkChecksum, const std::string &output) const { - throw exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); -} - -//------------------------------------------------------------------------------ -// writeTest -//------------------------------------------------------------------------------ -common::dataStructures::WriteTestResult Scheduler::writeTest(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &driveName, const std::string &vid, - const std::string &inputFile) const { - throw exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); -} - -//------------------------------------------------------------------------------ -// write_autoTest -//------------------------------------------------------------------------------ -common::dataStructures::WriteTestResult Scheduler::write_autoTest(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &driveName, const std::string &vid, - const uint64_t numberOfFiles, const uint64_t fileSize, const common::dataStructures::TestSourceType testSourceType) const { - throw exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); -} - //------------------------------------------------------------------------------ // getDesiredDriveState //------------------------------------------------------------------------------ diff --git a/scheduler/Scheduler.hpp b/scheduler/Scheduler.hpp index 44e54de89e..5448685c72 100644 --- a/scheduler/Scheduler.hpp +++ b/scheduler/Scheduler.hpp @@ -37,7 +37,6 @@ #include "common/dataStructures/TestSourceType.hpp" #include "common/dataStructures/UpdateFileInfoRequest.hpp" #include "common/dataStructures/UpdateFileStorageClassRequest.hpp" -#include "common/dataStructures/VerifyInfo.hpp" #include "common/dataStructures/WriteTestResult.hpp" #include "common/dataStructures/QueueAndMountSummary.hpp" #include "common/Timer.hpp" @@ -206,31 +205,6 @@ public: std::list<cta::common::dataStructures::RepackInfo> getRepacks(); cta::common::dataStructures::RepackInfo getRepack(const std::string &vid); - void shrink(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &tapepool); - // removes extra tape copies from a specific pool(usually an "_2" pool) - - void queueVerify(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, - const optional<uint64_t> numberOfFiles); - //if numberOfFiles is nullopt, all files are verified - void cancelVerify(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); - std::list<cta::common::dataStructures::VerifyInfo> getVerifys( - const cta::common::dataStructures::SecurityIdentity &cliIdentity) const; - cta::common::dataStructures::VerifyInfo getVerify(const cta::common::dataStructures::SecurityIdentity &cliIdentity, - const std::string &vid) const; - - cta::common::dataStructures::ReadTestResult readTest( - const cta::common::dataStructures::SecurityIdentity &cliIdentity, - const std::string &driveName, const std::string &vid, const uint64_t firstFSeq, const uint64_t lastFSeq, - const bool checkChecksum, const std::string &output) const; - //when output=="null" discard the data read - cta::common::dataStructures::WriteTestResult writeTest( - const cta::common::dataStructures::SecurityIdentity &cliIdentity, - const std::string &driveName, const std::string &vid, const std::string &inputFile) const; - cta::common::dataStructures::WriteTestResult write_autoTest( - const cta::common::dataStructures::SecurityIdentity &cliIdentity, - const std::string &driveName, const std::string &vid, const uint64_t numberOfFiles, const uint64_t fileSize, - const cta::common::dataStructures::TestSourceType testSourceType) const; - std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> > getPendingArchiveJobs(log::LogContext &lc) const; std::list<cta::common::dataStructures::ArchiveJob> getPendingArchiveJobs(const std::string &tapePoolName, log::LogContext &lc) const; std::map<std::string, std::list<cta::common::dataStructures::RetrieveJob> > getPendingRetrieveJobs(log::LogContext &lc) const; diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.cpp b/xroot_plugins/XrdSsiCtaRequestMessage.cpp index 6748f41cd2..7a57bd5124 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.cpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.cpp @@ -210,9 +210,6 @@ void RequestMessage::process(const cta::xrd::Request &request, cta::xrd::Respons case cmd_pair(AdminCmd::CMD_REQUESTERMOUNTRULE, AdminCmd::SUBCMD_LS): processRequesterMountRule_Ls(request.admincmd(), response); break; - case cmd_pair(AdminCmd::CMD_SHRINK, AdminCmd::SUBCMD_NONE): - processShrink(request.admincmd(), response); - break; case cmd_pair(AdminCmd::CMD_SHOWQUEUES, AdminCmd::SUBCMD_NONE): processShowQueues(request.admincmd(), response); break; @@ -259,27 +256,6 @@ void RequestMessage::process(const cta::xrd::Request &request, cta::xrd::Respons case cmd_pair(AdminCmd::CMD_TAPEPOOL, AdminCmd::SUBCMD_LS): processTapePool_Ls(request.admincmd(), response, stream); break; - case cmd_pair(AdminCmd::CMD_TEST, AdminCmd::SUBCMD_READ): - processTest_Read(request.admincmd(), response); - break; - case cmd_pair(AdminCmd::CMD_TEST, AdminCmd::SUBCMD_WRITE): - processTest_Write(request.admincmd(), response); - break; - case cmd_pair(AdminCmd::CMD_TEST, AdminCmd::SUBCMD_WRITE_AUTO): - processTest_WriteAuto(request.admincmd(), response); - break; - case cmd_pair(AdminCmd::CMD_VERIFY, AdminCmd::SUBCMD_ADD): - processVerify_Add(request.admincmd(), response); - break; - case cmd_pair(AdminCmd::CMD_VERIFY, AdminCmd::SUBCMD_RM): - processVerify_Rm(request.admincmd(), response); - break; - case cmd_pair(AdminCmd::CMD_VERIFY, AdminCmd::SUBCMD_LS): - processVerify_Ls(request.admincmd(), response); - break; - case cmd_pair(AdminCmd::CMD_VERIFY, AdminCmd::SUBCMD_ERR): - processVerify_Err(request.admincmd(), response); - break; default: throw PbException("Admin command pair <" + @@ -1601,19 +1577,6 @@ void RequestMessage::processRequesterMountRule_Ls(const cta::admin::AdminCmd &ad -void RequestMessage::processShrink(const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response) -{ - using namespace cta::admin; - - auto &tapepool = getRequired(OptionString::TAPE_POOL); - - m_scheduler.shrink(m_cliIdentity, tapepool); - - response.set_type(cta::xrd::Response::RSP_SUCCESS); -} - - - void RequestMessage::processShowQueues(const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response) { using namespace cta::admin; @@ -2113,269 +2076,6 @@ void RequestMessage::processTapePool_Ls(const cta::admin::AdminCmd &admincmd, ct -void RequestMessage::processTest_Read(const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response) -{ - using namespace cta::admin; - - std::stringstream cmdlineOutput; - - auto &drive = getRequired(OptionString::DRIVE); - auto &vid = getRequired(OptionString::VID); - auto &output = getRequired(OptionString::OUTPUT); - auto &firstfseq = getRequired(OptionUInt64::FIRST_FSEQ); - auto &lastfseq = getRequired(OptionUInt64::LAST_FSEQ); - - bool checkchecksum = has_flag(OptionBoolean::CHECK_CHECKSUM); - - cta::common::dataStructures::ReadTestResult res = m_scheduler.readTest(m_cliIdentity, drive, vid, - firstfseq, lastfseq, checkchecksum, output); - - std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = { "fseq","checksum type","checksum value","error" }; - responseTable.push_back(header); - - for(auto it = res.checksums.cbegin(); it != res.checksums.cend(); it++) - { - std::vector<std::string> currentRow; - currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->first))); - currentRow.push_back(it->second.first); - currentRow.push_back(it->second.second); - if(res.errors.find(it->first) != res.errors.cend()) { - currentRow.push_back(res.errors.at(it->first)); - } else { - currentRow.push_back("-"); - } - responseTable.push_back(currentRow); - } - - m_option_bool[OptionBoolean::SHOW_HEADER] = true; - cmdlineOutput << formatResponse(responseTable) << std::endl - << "Drive: " << res.driveName - << " Vid: " << res.vid - << " #Files: " << res.totalFilesRead - << " #Bytes: " << res.totalBytesRead - << " Time: " << res.totalTimeInSeconds << " s" - << " Speed(avg): " << static_cast<long double>(res.totalBytesRead) / - static_cast<long double>(res.totalTimeInSeconds) << " B/s" - << std::endl; - - response.set_message_txt(cmdlineOutput.str()); - response.set_type(cta::xrd::Response::RSP_SUCCESS); -} - - - -void RequestMessage::processTest_Write(const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response) -{ - using namespace cta::admin; - - std::stringstream cmdlineOutput; - - auto &drive = getRequired(OptionString::DRIVE); - auto &vid = getRequired(OptionString::VID); - auto &file = getRequired(OptionString::FILENAME); - - cta::common::dataStructures::WriteTestResult res = m_scheduler.writeTest(m_cliIdentity, drive, vid, file); - - std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = { "fseq","checksum type","checksum value","error" }; - responseTable.push_back(header); - - for(auto it = res.checksums.cbegin(); it != res.checksums.cend(); it++) - { - std::vector<std::string> currentRow; - currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->first))); - currentRow.push_back(it->second.first); - currentRow.push_back(it->second.second); - if(res.errors.find(it->first) != res.errors.cend()) { - currentRow.push_back(res.errors.at(it->first)); - } else { - currentRow.push_back("-"); - } - responseTable.push_back(currentRow); - } - - m_option_bool[OptionBoolean::SHOW_HEADER] = true; - cmdlineOutput << formatResponse(responseTable) << std::endl - << "Drive: " << res.driveName - << " Vid: " << res.vid - << " #Files: " << res.totalFilesWritten - << " #Bytes: " << res.totalBytesWritten - << " Time: " << res.totalTimeInSeconds << " s" - << " Speed(avg): " << static_cast<long double>(res.totalBytesWritten) / - static_cast<long double>(res.totalTimeInSeconds) << " B/s" - << std::endl; - - response.set_message_txt(cmdlineOutput.str()); - - response.set_message_txt(cmdlineOutput.str()); - response.set_type(cta::xrd::Response::RSP_SUCCESS); -} - - - -void RequestMessage::processTest_WriteAuto(const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response) -{ - using namespace cta::admin; - - std::stringstream cmdlineOutput; - - auto &drive = getRequired(OptionString::DRIVE); - auto &vid = getRequired(OptionString::VID); - auto &number = getRequired(OptionUInt64::NUMBER_OF_FILES); - auto &size = getRequired(OptionUInt64::FILE_SIZE); - auto &input = getRequired(OptionString::INPUT); - - cta::common::dataStructures::TestSourceType type; - - if(input == "zero") { - type = cta::common::dataStructures::TestSourceType::devzero; - } else if(input == "urandom") { - type = cta::common::dataStructures::TestSourceType::devurandom; - } else { - throw cta::exception::UserError("--input value must be either \"zero\" or \"urandom\""); - } - - cta::common::dataStructures::WriteTestResult res = m_scheduler.write_autoTest(m_cliIdentity, drive, - vid, number, size, type); - - std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = { "fseq","checksum type","checksum value","error" }; - responseTable.push_back(header); - for(auto it = res.checksums.cbegin(); it != res.checksums.cend(); it++) - { - std::vector<std::string> currentRow; - currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->first))); - currentRow.push_back(it->second.first); - currentRow.push_back(it->second.second); - if(res.errors.find(it->first) != res.errors.cend()) { - currentRow.push_back(res.errors.at(it->first)); - } else { - currentRow.push_back("-"); - } - responseTable.push_back(currentRow); - } - - m_option_bool[OptionBoolean::SHOW_HEADER] = true; - cmdlineOutput << formatResponse(responseTable) << std::endl - << "Drive: " << res.driveName - << " Vid: " << res.vid - << " #Files: " << res.totalFilesWritten - << " #Bytes: " << res.totalBytesWritten - << " Time: " << res.totalTimeInSeconds << " s" - << " Speed(avg): " << static_cast<long double>(res.totalBytesWritten) / - static_cast<long double>(res.totalTimeInSeconds) << " B/s" - << std::endl; - - response.set_message_txt(cmdlineOutput.str()); - response.set_type(cta::xrd::Response::RSP_SUCCESS); -} - - - -void RequestMessage::processVerify_Add(const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response) -{ - using namespace cta::admin; - - auto &vid = getRequired(OptionString::VID); - auto number = getOptional(OptionUInt64::NUMBER_OF_FILES); - - m_scheduler.queueVerify(m_cliIdentity, vid, number); - - response.set_type(cta::xrd::Response::RSP_SUCCESS); -} - - - -void RequestMessage::processVerify_Rm(const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response) -{ - using namespace cta::admin; - - auto &vid = getRequired(OptionString::VID); - - m_scheduler.cancelVerify(m_cliIdentity, vid); - - response.set_type(cta::xrd::Response::RSP_SUCCESS); -} - - - -void RequestMessage::processVerify_Ls(const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response) -{ - using namespace cta::admin; - - std::stringstream cmdlineOutput; - - auto vid = getOptional(OptionString::VID); - - std::list<cta::common::dataStructures::VerifyInfo> list; - - if(vid) { - list.push_back(m_scheduler.getVerify(m_cliIdentity, vid.value())); - } else { - list = m_scheduler.getVerifys(m_cliIdentity); - } - - if(!list.empty()) - { - std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = { - "vid","files","size","to verify","failed","verified","status","name","host","time" - }; - if(has_flag(OptionBoolean::SHOW_HEADER)) responseTable.push_back(header); - for(auto it = list.cbegin(); it != list.cend(); it++) { - std::vector<std::string> currentRow; - currentRow.push_back(it->vid); - currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->totalFiles))); - currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->totalSize))); - currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->filesToVerify))); - currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->filesFailed))); - currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->filesVerified))); - currentRow.push_back(it->verifyStatus); - currentRow.push_back(it->creationLog.username); - currentRow.push_back(it->creationLog.host); - currentRow.push_back(timeToString(it->creationLog.time)); - responseTable.push_back(currentRow); - } - cmdlineOutput << formatResponse(responseTable); - } - - response.set_message_txt(cmdlineOutput.str()); - response.set_type(cta::xrd::Response::RSP_SUCCESS); -} - - - -void RequestMessage::processVerify_Err(const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response) -{ - using namespace cta::admin; - - std::stringstream cmdlineOutput; - - auto &vid = getRequired(OptionString::VID); - - cta::common::dataStructures::VerifyInfo info = m_scheduler.getVerify(m_cliIdentity, vid); - - if(!info.errors.empty()) - { - std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = { "fseq","error message" }; - if(has_flag(OptionBoolean::SHOW_HEADER)) responseTable.push_back(header); - for(auto it = info.errors.cbegin(); it != info.errors.cend(); it++) { - std::vector<std::string> currentRow; - currentRow.push_back(std::to_string(static_cast<unsigned long long>(it->first))); - currentRow.push_back(it->second); - responseTable.push_back(currentRow); - } - cmdlineOutput << formatResponse(responseTable); - } - - response.set_message_txt(cmdlineOutput.str()); - response.set_type(cta::xrd::Response::RSP_SUCCESS); -} - - - std::string RequestMessage::setDriveState(const std::string ®ex, DriveState drive_state) { using namespace cta::admin; diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.hpp b/xroot_plugins/XrdSsiCtaRequestMessage.hpp index 9e0790e272..43c134fa5b 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.hpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.hpp @@ -107,7 +107,6 @@ private: void processRequesterMountRule_Ch (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processRequesterMountRule_Rm (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processRequesterMountRule_Ls (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); - void processShrink (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processShowQueues (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processStorageClass_Add (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processStorageClass_Ch (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); @@ -117,18 +116,10 @@ private: void processTape_Ch (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processTape_Rm (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processTape_Reclaim (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); - //void processTape_Ls (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processTape_Label (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processTapePool_Add (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processTapePool_Ch (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); void processTapePool_Rm (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); - void processTest_Read (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); - void processTest_Write (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); - void processTest_WriteAuto (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); - void processVerify_Add (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); - void processVerify_Rm (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); - void processVerify_Ls (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); - void processVerify_Err (const cta::admin::AdminCmd &admincmd, cta::xrd::Response &response); /*! * Process AdminCmd events which can return a stream response diff --git a/xrootd-ssi-protobuf-interface b/xrootd-ssi-protobuf-interface index b31084a0e7..17f1f77acc 160000 --- a/xrootd-ssi-protobuf-interface +++ b/xrootd-ssi-protobuf-interface @@ -1 +1 @@ -Subproject commit b31084a0e7fa3bdfc57c5f227ba8977403c895df +Subproject commit 17f1f77acc76a15bd9f494cfd65bdab68ee8ac19 -- GitLab