Commit fbd73320 authored by Steven Murray's avatar Steven Murray
Browse files

Removed scheduler dedications - Concepts too early for CTA

parent ee382da8
......@@ -31,8 +31,6 @@
#include "common/dataStructures/ArchiveJob.hpp"
#include "common/dataStructures/ArchiveRoute.hpp"
#include "common/dataStructures/CancelRetrieveRequest.hpp"
#include "common/dataStructures/Dedication.hpp"
#include "common/dataStructures/DedicationType.hpp"
#include "common/dataStructures/DiskFileInfo.hpp"
#include "common/dataStructures/DriveState.hpp"
#include "common/dataStructures/EntryLog.hpp"
......@@ -454,17 +452,6 @@ public:
virtual void modifyMountPolicyMaxDrivesAllowed(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t maxDrivesAllowed) = 0;
virtual void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) = 0;
virtual void createDedication(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const common::dataStructures::DedicationType dedicationType,
const optional<std::string> &tag, const optional<std::string> &vid, const uint64_t fromTimestamp, const uint64_t untilTimestamp,const std::string &comment) = 0;
virtual void deleteDedication(const std::string &drivename) = 0;
virtual std::list<common::dataStructures::Dedication> getDedications() const = 0;
virtual void modifyDedicationType(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const common::dataStructures::DedicationType dedicationType) = 0;
virtual void modifyDedicationTag(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const optional<std::string> &tag) = 0;
virtual void modifyDedicationVid(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const optional<std::string> &vid) = 0;
virtual void modifyDedicationFrom(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const uint64_t fromTimestamp) = 0;
virtual void modifyDedicationUntil(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const uint64_t untilTimestamp) = 0;
virtual void modifyDedicationComment(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const std::string &comment) = 0;
/**
* Returns an iterator over the list of archive files that meet the specified
* search criteria.
......
......@@ -3261,70 +3261,6 @@ void RdbmsCatalogue::modifyMountPolicyComment(const common::dataStructures::Secu
}
}
//------------------------------------------------------------------------------
// createDedication
//------------------------------------------------------------------------------
void RdbmsCatalogue::createDedication(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const common::dataStructures::DedicationType dedicationType,
const optional<std::string> &tag, const optional<std::string> &vid, const uint64_t fromTimestamp, const uint64_t untilTimestamp,const std::string &comment) {
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// deleteDedication
//------------------------------------------------------------------------------
void RdbmsCatalogue::deleteDedication(const std::string &drivename) {
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// getDedications
//------------------------------------------------------------------------------
std::list<common::dataStructures::Dedication> RdbmsCatalogue::getDedications() const {
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// modifyDedicationType
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyDedicationType(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const common::dataStructures::DedicationType dedicationType) {
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// modifyDedicationTag
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyDedicationTag(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const optional<std::string> &tag) {
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// modifyDedicationVid
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyDedicationVid(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const optional<std::string> &vid) {
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// modifyDedicationFrom
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyDedicationFrom(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const uint64_t fromTimestamp) {
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// modifyDedicationUntil
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyDedicationUntil(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const uint64_t untilTimestamp) {
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// modifyDedicationComment
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyDedicationComment(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const std::string &comment) {
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// insertArchiveFile
//------------------------------------------------------------------------------
......
......@@ -441,17 +441,6 @@ public:
void modifyMountPolicyMaxDrivesAllowed(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t maxDrivesAllowed) override;
void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
void createDedication(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const common::dataStructures::DedicationType dedicationType,
const optional<std::string> &tag, const optional<std::string> &vid, const uint64_t fromTimestamp, const uint64_t untilTimestamp,const std::string &comment) override;
void deleteDedication(const std::string &drivename) override;
std::list<common::dataStructures::Dedication> getDedications() const override;
void modifyDedicationType(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const common::dataStructures::DedicationType dedicationType) override;
void modifyDedicationTag(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const optional<std::string> &tag) override;
void modifyDedicationVid(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const optional<std::string> &vid) override;
void modifyDedicationFrom(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const uint64_t fromTimestamp) override;
void modifyDedicationUntil(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const uint64_t untilTimestamp) override;
void modifyDedicationComment(const common::dataStructures::SecurityIdentity &admin, const std::string &drivename, const std::string &comment) override;
/**
* Returns an iterator over the list of archive files that meet the specified
* search criteria.
......
......@@ -31,8 +31,6 @@ set (COMMON_LIB_SRC_FILES
dataStructures/ArchiveRequest.cpp
dataStructures/ArchiveRoute.cpp
dataStructures/CancelRetrieveRequest.cpp
dataStructures/Dedication.cpp
dataStructures/DedicationType.cpp
dataStructures/DeleteArchiveRequest.cpp
dataStructures/DiskFileInfo.cpp
dataStructures/DriveState.cpp
......
/*
* 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/Dedication.hpp"
#include "common/dataStructures/utils.hpp"
#include "common/exception/Exception.hpp"
namespace cta {
namespace common {
namespace dataStructures {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
Dedication::Dedication():
fromTimestamp(0),
untilTimestamp(0) {}
//------------------------------------------------------------------------------
// operator==
//------------------------------------------------------------------------------
bool Dedication::operator==(const Dedication &rhs) const {
return driveName==rhs.driveName
&& dedicationType==rhs.dedicationType
&& tag==rhs.tag
&& vid==rhs.vid
&& fromTimestamp==rhs.fromTimestamp
&& untilTimestamp==rhs.untilTimestamp
&& creationLog==rhs.creationLog
&& lastModificationLog==rhs.lastModificationLog
&& comment==rhs.comment;
}
//------------------------------------------------------------------------------
// operator!=
//------------------------------------------------------------------------------
bool Dedication::operator!=(const Dedication &rhs) const {
return !operator==(rhs);
}
//------------------------------------------------------------------------------
// operator<<
//------------------------------------------------------------------------------
std::ostream &operator<<(std::ostream &os, const Dedication &obj) {
os << "(driveName=" << obj.driveName
<< " dedicationType=" << obj.dedicationType
<< " tag=" << obj.tag
<< " vid=" << obj.vid
<< " fromTimestamp=" << obj.fromTimestamp
<< " untilTimestamp=" << obj.untilTimestamp
<< " creationLog=" << obj.creationLog
<< " lastModificationLog=" << obj.lastModificationLog
<< " comment=" << obj.comment << ")";
return os;
}
} // namespace dataStructures
} // namespace common
} // namespace cta
/*
* 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/DedicationType.hpp"
#include "common/dataStructures/EntryLog.hpp"
namespace cta {
namespace common {
namespace dataStructures {
/**
* The tape drive dedication parameters go here
*/
struct Dedication {
Dedication();
bool operator==(const Dedication &rhs) const;
bool operator!=(const Dedication &rhs) const;
std::string driveName;
DedicationType dedicationType;
std::string tag;
std::string vid;
uint64_t fromTimestamp;
uint64_t untilTimestamp;
EntryLog creationLog;
EntryLog lastModificationLog;
std::string comment;
}; // struct Dedication
std::ostream &operator<<(std::ostream &os, const Dedication &obj);
} // namespace dataStructures
} // namespace common
} // namespace cta
/*
* 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/DedicationType.hpp"
std::string cta::common::dataStructures::toString(cta::common::dataStructures::DedicationType type) {
switch(type) {
case cta::common::dataStructures::DedicationType::readonly:
return "readonly";
case cta::common::dataStructures::DedicationType::writeonly:
return "writeonly";
case cta::common::dataStructures::DedicationType::readwrite:
return "readwrite";
default:
return "UNKNOWN";
}
}
\ No newline at end of file
/*
* 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 <string>
namespace cta {
namespace common {
namespace dataStructures {
enum DedicationType {
readonly,
writeonly,
readwrite
};
std::string toString(DedicationType type);
} // namespace dataStructures
} // namespace common
} // namespace cta
......@@ -153,7 +153,6 @@ void XrdCtaFile::dispatchCommand() {
else if("rmr" == command || "requestermountrule" == command) {authorizeAdmin(); xCom_requestermountrule();}
else if("gmr" == command || "groupmountrule" == command) {authorizeAdmin(); xCom_groupmountrule();}
else if("mp" == command || "mountpolicy" == command) {authorizeAdmin(); xCom_mountpolicy();}
else if("de" == command || "dedication" == command) {authorizeAdmin(); xCom_dedication();}
else if("re" == command || "repack" == command) {authorizeAdmin(); xCom_repack();}
else if("sh" == command || "shrink" == command) {authorizeAdmin(); xCom_shrink();}
else if("ve" == command || "verify" == command) {authorizeAdmin(); xCom_verify();}
......@@ -1361,121 +1360,6 @@ void XrdCtaFile::xCom_mountpolicy() {
logRequestAndSetCmdlineResult(cta::common::dataStructures::FrontendReturnCode::ok, cmdlineOutput.str());
}
//------------------------------------------------------------------------------
// xCom_dedication
//------------------------------------------------------------------------------
void XrdCtaFile::xCom_dedication() {
std::stringstream cmdlineOutput;
std::stringstream help;
help << m_requestTokens.at(0) << " de/dedication add/ch/rm/ls:" << std::endl
<< "\tadd --name/-n <drive_name> [--readonly/-r or --writeonly/-w] [--vid/-v <tape_vid>] [--tag/-t <tag_name>] --from/-f <DD/MM/YYYY> --until/-u <DD/MM/YYYY> --comment/-m <\"comment\">" << std::endl
<< "\tch --name/-n <drive_name> [--readonly/-r or --writeonly/-w] [--vid/-v <tape_vid>] [--tag/-t <tag_name>] [--from/-f <DD/MM/YYYY>] [--until/-u <DD/MM/YYYY>] [--comment/-m <\"comment\">]" << std::endl
<< "\trm --name/-n <drive_name>" << std::endl
<< "\tls [--header/-h]" << std::endl;
if(m_requestTokens.size() < 3) {
throw cta::exception::UserError(help.str());
}
if("add" == m_requestTokens.at(2) || "ch" == m_requestTokens.at(2) || "rm" == m_requestTokens.at(2)) {
optional<std::string> drive = getOptionStringValue("-n", "--name", true, false);
if("add" == m_requestTokens.at(2) || "ch" == m_requestTokens.at(2)) {
bool readonly = hasOption("-r", "--readonly");
bool writeonly = hasOption("-w", "--writeonly");
if("add" == m_requestTokens.at(2)) { //add
optional<std::string> vid = getOptionStringValue("-v", "--vid", false, false);
optional<std::string> tag = getOptionStringValue("-t", "--tag", false, false);
optional<time_t> from = getOptionTimeValue("-f", "--from", true, false);
optional<time_t> until = getOptionTimeValue("-u", "--until", true, false);
optional<std::string> comment = getOptionStringValue("-m", "--comment", true, false);
checkOptions(help.str());
if((!vid&&!tag&&!readonly&&!writeonly)||(readonly&&writeonly)) {
throw cta::exception::UserError(help.str());
}
cta::common::dataStructures::DedicationType type=cta::common::dataStructures::DedicationType::readwrite;
if(readonly) {
type=cta::common::dataStructures::DedicationType::readonly;
}
else if(writeonly) {
type=cta::common::dataStructures::DedicationType::writeonly;
}
m_catalogue->createDedication(m_cliIdentity, drive.value(), type, tag, vid, from.value(), until.value(), comment.value());
}
else if("ch" == m_requestTokens.at(2)) { //ch
optional<std::string> vid = getOptionStringValue("-v", "--vid", false, false);
optional<std::string> tag = getOptionStringValue("-t", "--tag", false, false);
optional<time_t> from = getOptionTimeValue("-f", "--from", false, false);
optional<time_t> until = getOptionTimeValue("-u", "--until", false, false);
optional<std::string> comment = getOptionStringValue("-m", "--comment", false, false);
checkOptions(help.str());
if((!readonly&&!writeonly)||(readonly&&writeonly)) {
throw cta::exception::UserError(help.str());
}
if(comment) {
m_catalogue->modifyDedicationComment(m_cliIdentity, drive.value(), comment.value());
}
if(from) {
m_catalogue->modifyDedicationFrom(m_cliIdentity, drive.value(), from.value());
}
if(until) {
m_catalogue->modifyDedicationUntil(m_cliIdentity, drive.value(), until.value());
}
if(vid) {
m_catalogue->modifyDedicationVid(m_cliIdentity, drive.value(), vid);
}
if(tag) {
m_catalogue->modifyDedicationTag(m_cliIdentity, drive.value(), tag);
}
if(readonly) {
m_catalogue->modifyDedicationType(m_cliIdentity, drive.value(), cta::common::dataStructures::DedicationType::readonly);
}
if(writeonly) {
m_catalogue->modifyDedicationType(m_cliIdentity, drive.value(), cta::common::dataStructures::DedicationType::writeonly);
}
}
}
else { //rm
checkOptions(help.str());
m_catalogue->deleteDedication(drive.value());
}
}
else if("ls" == m_requestTokens.at(2)) { //ls
std::list<cta::common::dataStructures::Dedication> list= m_catalogue->getDedications();
if(list.size()>0) {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {"drive","type","vid","tag","from","until","c.user","c.host","c.time","m.user","m.host","m.time","comment"};
if(hasOption("-h", "--header")) responseTable.push_back(header);
for(auto it = list.cbegin(); it != list.cend(); it++) {
std::vector<std::string> currentRow;
std::string type_s;
switch(it->dedicationType) {
case cta::common::dataStructures::DedicationType::readonly:
type_s = "readonly";
break;
case cta::common::dataStructures::DedicationType::writeonly:
type_s = "writeonly";
break;
default:
type_s = "readwrite";
break;
}
currentRow.push_back(it->driveName);
currentRow.push_back(type_s);
currentRow.push_back(it->vid);
currentRow.push_back(it->tag);
currentRow.push_back(timeToString(it->fromTimestamp));
currentRow.push_back(timeToString(it->untilTimestamp));
addLogInfoToResponseRow(currentRow, it->creationLog, it->lastModificationLog);
currentRow.push_back(it->comment);
responseTable.push_back(currentRow);
}
cmdlineOutput << formatResponse(responseTable, hasOption("-h", "--header"));
}
}
else {
throw cta::exception::UserError(help.str());
}
logRequestAndSetCmdlineResult(cta::common::dataStructures::FrontendReturnCode::ok, cmdlineOutput.str());
}
//------------------------------------------------------------------------------
// xCom_repack
//------------------------------------------------------------------------------
......@@ -2313,7 +2197,6 @@ std::string XrdCtaFile::getGenericHelp(const std::string &programName) const {
help << programName << " archivefile/af ls" << std::endl;
help << programName << " archiveroute/ar add/ch/rm/ls" << std::endl;
help << programName << " bootstrap/bs" << std::endl;
help << programName << " dedication/de add/ch/rm/ls" << std::endl;
help << programName << " drive/dr up/down" << std::endl;
help << programName << " groupmountrule/gmr add/rm/ls/err" << std::endl;
help << programName << " listdrivestates/lds" << std::endl;
......
......@@ -197,7 +197,6 @@ protected:
void xCom_requestermountrule();
void xCom_groupmountrule();
void xCom_mountpolicy();
void xCom_dedication();
void xCom_repack();
void xCom_shrink();
void xCom_verify();
......
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