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

cta/CTA#121 cta tape add requires optional --encryptionkey parameter

Removed the "--encryptionkey" option from "cta tape add"
parent de5f707b
......@@ -259,17 +259,12 @@ public:
/**
* Creates a tape which is assumed to have logical block protection (LBP)
* enabled.
*
* @param encryptionKey The optional identifier of the encrption key. This
* optional parameter should either have a non-empty string value or no value
* at all. Empty strings are prohibited.
*/
virtual void createTape(
const common::dataStructures::SecurityIdentity &admin,
const std::string &vid,
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const optional<std::string> &encryptionKey,
const uint64_t capacityInBytes,
const bool disabled,
const bool full,
......
This diff is collapsed.
......@@ -1526,17 +1526,11 @@ void RdbmsCatalogue::createTape(
const std::string &vid,
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const optional<std::string> &encryptionKey,
const uint64_t capacityInBytes,
const bool disabled,
const bool full,
const std::string &comment) {
try {
if(encryptionKey && encryptionKey.value().empty()) {
throw(exception::Exception(std::string("The identifier of the encrption key for tape ") + vid + " has been set "
"to the empty string. This optional value should either have a non-empty string value or no value at all"));
}
auto conn = m_connPool.getConn();
if(tapeExists(conn, vid)) {
throw exception::UserError(std::string("Cannot create tape ") + vid +
......@@ -1556,7 +1550,6 @@ void RdbmsCatalogue::createTape(
"VID,"
"LOGICAL_LIBRARY_NAME,"
"TAPE_POOL_NAME,"
"ENCRYPTION_KEY,"
"CAPACITY_IN_BYTES,"
"DATA_IN_BYTES,"
"LAST_FSEQ,"
......@@ -1576,7 +1569,6 @@ void RdbmsCatalogue::createTape(
":VID,"
":LOGICAL_LIBRARY_NAME,"
":TAPE_POOL_NAME,"
":ENCRYPTION_KEY,"
":CAPACITY_IN_BYTES,"
":DATA_IN_BYTES,"
":LAST_FSEQ,"
......@@ -1597,7 +1589,6 @@ void RdbmsCatalogue::createTape(
stmt->bindString(":VID", vid);
stmt->bindString(":LOGICAL_LIBRARY_NAME", logicalLibraryName);
stmt->bindString(":TAPE_POOL_NAME", tapePoolName);
stmt->bindOptionalString(":ENCRYPTION_KEY", encryptionKey);
stmt->bindUint64(":CAPACITY_IN_BYTES", capacityInBytes);
stmt->bindUint64(":DATA_IN_BYTES", 0);
stmt->bindUint64(":LAST_FSEQ", 0);
......
......@@ -240,17 +240,12 @@ public:
/**
* Creates a tape.
*
* @param encryptionKey The optional identifier of the encrption key. This
* optional parameter should either have a non-empty string value or no value
* at all. Empty strings are prohibited.
*/
void createTape(
const common::dataStructures::SecurityIdentity &admin,
const std::string &vid,
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const optional<std::string> &encryptionKey,
const uint64_t capacityInBytes,
const bool disabled,
const bool full,
......
......@@ -6,7 +6,7 @@ cta logicallibrary add --name VLSTK --comment "ctasystest"
cta tapepool add --name ctasystest --partialtapesnumber 5 --encrypted false --comment "ctasystest"
cta tape add --logicallibrary VLSTK --tapepool ctasystest --capacity 1000000000 --comment "ctasystest" --vid ${VID} --disabled false --full false --encryptionkey test
cta tape add --logicallibrary VLSTK --tapepool ctasystest --capacity 1000000000 --comment "ctasystest" --vid ${VID} --disabled false --full false
cta storageclass add --instance root --name ctaStorageClass --copynb 1 --comment "ctasystest"
......
......@@ -79,7 +79,6 @@ echo "Preparing CTA for tests"
--vid ${VID} \
--disabled false \
--full false \
--encryptionkey test \
--comment "ctasystest"
done
kubectl --namespace ${NAMESPACE} exec ctacli -- cta storageclass add \
......
......@@ -79,7 +79,6 @@ for ((i=0; i<${#TAPES[@]}; i++)); do
--vid ${VID} \
--disabled false \
--full false \
--encryptionkey test \
--comment "ctasystest"
done
......
......@@ -79,7 +79,6 @@ for ((i=0; i<${#TAPES[@]}; i++)); do
--vid ${VID} \
--disabled false \
--full false \
--encryptionkey test \
--comment "ctasystest"
done
......
......@@ -393,7 +393,7 @@ TEST_P(SchedulerTest, archive_and_retrieve_new_file) {
const std::string tapeComment = "Tape comment";
bool notDisabled = false;
bool notFull = false;
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, nullopt, capacityInBytes,
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, capacityInBytes,
notDisabled, notFull, tapeComment);
const bool lbpIsOn = true;
......@@ -540,7 +540,7 @@ TEST_P(SchedulerTest, retry_archive_until_max_reached) {
const std::string tapeComment = "Tape comment";
bool notDisabled = false;
bool notFull = false;
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, nullopt, capacityInBytes, notDisabled,
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, capacityInBytes, notDisabled,
notFull, tapeComment);
const bool lbpIsOn = true;
......
......@@ -348,7 +348,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayRecall) {
const std::string tapeComment = "Tape comment";
bool notDisabled = false;
bool notFull = false;
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, cta::nullopt, capacityInBytes,
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, capacityInBytes,
notDisabled, notFull, tapeComment);
// 6) Prepare files for reading by writing them to the mock system
......@@ -520,7 +520,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongRecall) {
const std::string tapeComment = "Tape comment";
bool notDisabled = false;
bool notFull = false;
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, cta::nullopt, capacityInBytes,
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, capacityInBytes,
notDisabled, notFull, tapeComment);
// 6) Prepare files for reading by writing them to the mock system
......@@ -704,7 +704,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionNoSuchDrive) {
const std::string tapeComment = "Tape comment";
bool notDisabled = false;
bool notFull = false;
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, cta::nullopt, capacityInBytes,
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, capacityInBytes,
notDisabled, notFull, tapeComment);
// 6) Prepare files for reading by writing them to the mock system
......@@ -847,7 +847,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionFailtoMount) {
const std::string tapeComment = "Tape comment";
bool notDisabled = false;
bool notFull = false;
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, cta::nullopt, capacityInBytes,
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, capacityInBytes,
notDisabled, notFull, tapeComment);
// 6) Prepare files for reading by writing them to the mock system
......@@ -1000,7 +1000,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayMigration) {
const std::string tapeComment = "Tape comment";
bool notDisabled = false;
bool notFull = false;
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, cta::nullopt, capacityInBytes,
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, capacityInBytes,
notDisabled, notFull, tapeComment);
// Create the mount criteria
......@@ -1137,7 +1137,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionMissingFilesMigration) {
const std::string tapeComment = "Tape comment";
bool notDisabled = false;
bool notFull = false;
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, cta::nullopt, capacityInBytes,
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, capacityInBytes,
notDisabled, notFull, tapeComment);
// Create the mount criteria
......@@ -1271,7 +1271,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullMigration) {
const std::string tapeComment = "Tape comment";
bool notDisabled = false;
bool notFull = false;
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, cta::nullopt, capacityInBytes,
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, capacityInBytes,
notDisabled, notFull, tapeComment);
// Create the mount criteria
......@@ -1417,7 +1417,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionTapeFullOnFlushMigration) {
const std::string tapeComment = "Tape comment";
bool notDisabled = false;
bool notFull = false;
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, cta::nullopt, capacityInBytes,
catalogue.createTape(s_adminOnAdminHost, s_vid, s_libraryName, s_tapePoolName, capacityInBytes,
notDisabled, notFull, tapeComment);
// Create the mount criteria
......
......@@ -943,7 +943,7 @@ void XrdCtaFile::xCom_tape() {
std::stringstream cmdlineOutput;
std::stringstream help;
help << m_requestTokens.at(0) << " ta/tape add/ch/rm/reclaim/ls/label:" << std::endl
<< "\tadd --vid/-v <vid> --logicallibrary/-l <logical_library_name> --tapepool/-t <tapepool_name> --capacity/-c <capacity_in_bytes> [--encryptionkey/-k <encryption_key>]" << std::endl
<< "\tadd --vid/-v <vid> --logicallibrary/-l <logical_library_name> --tapepool/-t <tapepool_name> --capacity/-c <capacity_in_bytes>" << std::endl
<< "\t --disabled/-d <\"true\" or \"false\"> --full/-f <\"true\" or \"false\"> [--comment/-m <\"comment\">] " << std::endl
<< "\tch --vid/-v <vid> [--logicallibrary/-l <logical_library_name>] [--tapepool/-t <tapepool_name>] [--capacity/-c <capacity_in_bytes>] [--encryptionkey/-k <encryption_key>]" << std::endl
<< "\t [--disabled/-d <\"true\" or \"false\">] [--full/-f <\"true\" or \"false\">] [--comment/-m <\"comment\">]" << std::endl
......@@ -953,7 +953,7 @@ void XrdCtaFile::xCom_tape() {
<< "\t [--lbp/-p <\"true\" or \"false\">] [--disabled/-d <\"true\" or \"false\">] [--full/-f <\"true\" or \"false\">]" << std::endl
<< "\tlabel --vid/-v <vid> [--force/-f <\"true\" or \"false\">] [--lbp/-l <\"true\" or \"false\">] [--tag/-t <tag_name>]" << std::endl
<< "Where" << std::endl
<< "\tencryption_key Is either \"none\" or the name of the individual key to be used" << std::endl;
<< "\tencryption_key Is the name of the encryption key used to encrypt the tape" << std::endl;
if(m_requestTokens.size() < 3) {
throw cta::exception::UserError(help.str());
}
......@@ -963,12 +963,11 @@ void XrdCtaFile::xCom_tape() {
optional<std::string> logicallibrary = getOptionStringValue("-l", "--logicallibrary", true, false);
optional<std::string> tapepool = getOptionStringValue("-t", "--tapepool", true, false);
optional<uint64_t> capacity = getOptionUint64Value("-c", "--capacity", true, false);
optional<std::string> encryptionkey = getOptionStringValue("-k", "--encryptionkey", false, false);
optional<std::string> comment = getOptionStringValue("-m", "--comment", true, true, "-");
optional<bool> disabled = getOptionBoolValue("-d", "--disabled", true, false);
optional<bool> full = getOptionBoolValue("-f", "--full", true, false);
checkOptions(help.str());
m_catalogue->createTape(m_cliIdentity, vid.value(), logicallibrary.value(), tapepool.value(), encryptionkey, capacity.value(), disabled.value(), full.value(), comment.value());
m_catalogue->createTape(m_cliIdentity, vid.value(), logicallibrary.value(), tapepool.value(), capacity.value(), disabled.value(), full.value(), comment.value());
}
else if("ch" == m_requestTokens.at(2)) { //ch
optional<std::string> logicallibrary = getOptionStringValue("-l", "--logicallibrary", false, false);
......
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