Commit 901b4667 authored by Steven Murray's avatar Steven Murray
Browse files

Added supply parameter to Catalogue::createTapePool()

parent ce546f01
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include "common/exception/UserError.hpp" #include "common/exception/UserError.hpp"
#include "common/log/LogContext.hpp" #include "common/log/LogContext.hpp"
#include "common/log/Logger.hpp" #include "common/log/Logger.hpp"
#include "common/optional.hpp"
#include <list> #include <list>
#include <map> #include <map>
...@@ -238,7 +239,7 @@ public: ...@@ -238,7 +239,7 @@ public:
virtual void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &name, const uint64_t nbCopies) = 0; virtual void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &name, const uint64_t nbCopies) = 0;
virtual void modifyStorageClassComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &name, const std::string &comment) = 0; virtual void modifyStorageClassComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &name, const std::string &comment) = 0;
virtual void createTapePool(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string &comment) = 0; virtual void createTapePool(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo, const uint64_t nbPartialTapes, const bool encryptionValue, const cta::optional<std::string> &supply, const std::string &comment) = 0;
virtual void deleteTapePool(const std::string &name) = 0; virtual void deleteTapePool(const std::string &name) = 0;
virtual std::list<TapePool> getTapePools() const = 0; virtual std::list<TapePool> getTapePools() const = 0;
virtual void modifyTapePoolVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) = 0; virtual void modifyTapePoolVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) = 0;
......
...@@ -137,8 +137,8 @@ public: ...@@ -137,8 +137,8 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyStorageClassComment(admin, instanceName, name, comment);}, m_maxTriesToConnect); return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyStorageClassComment(admin, instanceName, name, comment);}, m_maxTriesToConnect);
} }
void createTapePool(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string &comment) override { void createTapePool(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo, const uint64_t nbPartialTapes, const bool encryptionValue, const cta::optional<std::string> &supply, const std::string &comment) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->createTapePool(admin, name, vo, nbPartialTapes, encryptionValue, comment);}, m_maxTriesToConnect); return retryOnLostConnection(m_log, [&]{return m_catalogue->createTapePool(admin, name, vo, nbPartialTapes, encryptionValue, supply, comment);}, m_maxTriesToConnect);
} }
void deleteTapePool(const std::string &name) override { void deleteTapePool(const std::string &name) override {
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ public: ...@@ -42,7 +42,7 @@ public:
void createRequesterMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstance, const std::string& requesterName, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void createRequesterMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstance, const std::string& requesterName, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void createStorageClass(const common::dataStructures::SecurityIdentity& admin, const common::dataStructures::StorageClass& storageClass) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void createStorageClass(const common::dataStructures::SecurityIdentity& admin, const common::dataStructures::StorageClass& storageClass) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void createTape(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string &mediaType, const std::string &vendor, const std::string& logicalLibraryName, const std::string& tapePoolName, const uint64_t capacityInBytes, const bool disabled, const bool full, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void createTape(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string &mediaType, const std::string &vendor, const std::string& logicalLibraryName, const std::string& tapePoolName, const uint64_t capacityInBytes, const bool disabled, const bool full, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void createTapePool(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string & vo, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void createTapePool(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string & vo, const uint64_t nbPartialTapes, const bool encryptionValue, const cta::optional<std::string> &supply, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void deleteAdminUser(const std::string& username) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void deleteAdminUser(const std::string& username) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void deleteArchiveFile(const std::string& instanceName, const uint64_t archiveFileId, log::LogContext &lc) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void deleteArchiveFile(const std::string& instanceName, const uint64_t archiveFileId, log::LogContext &lc) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void deleteArchiveRoute(const std::string& diskInstanceName, const std::string& storageClassName, const uint32_t copyNb) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void deleteArchiveRoute(const std::string& diskInstanceName, const std::string& storageClassName, const uint32_t copyNb) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
......
...@@ -568,6 +568,7 @@ void RdbmsCatalogue::createTapePool( ...@@ -568,6 +568,7 @@ void RdbmsCatalogue::createTapePool(
const std::string &vo, const std::string &vo,
const uint64_t nbPartialTapes, const uint64_t nbPartialTapes,
const bool encryptionValue, const bool encryptionValue,
const cta::optional<std::string> &supply,
const std::string &comment) { const std::string &comment) {
try { try {
if(name.empty()) { if(name.empty()) {
...@@ -595,6 +596,7 @@ void RdbmsCatalogue::createTapePool( ...@@ -595,6 +596,7 @@ void RdbmsCatalogue::createTapePool(
"VO," "VO,"
"NB_PARTIAL_TAPES," "NB_PARTIAL_TAPES,"
"IS_ENCRYPTED," "IS_ENCRYPTED,"
"SUPPLY,"
"USER_COMMENT," "USER_COMMENT,"
...@@ -610,6 +612,7 @@ void RdbmsCatalogue::createTapePool( ...@@ -610,6 +612,7 @@ void RdbmsCatalogue::createTapePool(
":VO," ":VO,"
":NB_PARTIAL_TAPES," ":NB_PARTIAL_TAPES,"
":IS_ENCRYPTED," ":IS_ENCRYPTED,"
":SUPPLY,"
":USER_COMMENT," ":USER_COMMENT,"
...@@ -626,6 +629,7 @@ void RdbmsCatalogue::createTapePool( ...@@ -626,6 +629,7 @@ void RdbmsCatalogue::createTapePool(
stmt.bindString(":VO", vo); stmt.bindString(":VO", vo);
stmt.bindUint64(":NB_PARTIAL_TAPES", nbPartialTapes); stmt.bindUint64(":NB_PARTIAL_TAPES", nbPartialTapes);
stmt.bindBool(":IS_ENCRYPTED", encryptionValue); stmt.bindBool(":IS_ENCRYPTED", encryptionValue);
stmt.bindOptionalString(":SUPPLY", supply);
stmt.bindString(":USER_COMMENT", comment); stmt.bindString(":USER_COMMENT", comment);
...@@ -893,6 +897,7 @@ std::list<TapePool> RdbmsCatalogue::getTapePools() const { ...@@ -893,6 +897,7 @@ std::list<TapePool> RdbmsCatalogue::getTapePools() const {
"COALESCE(TAPE_POOL.VO, 'NONE') AS VO," // TBD Remove COALESCE "COALESCE(TAPE_POOL.VO, 'NONE') AS VO," // TBD Remove COALESCE
"TAPE_POOL.NB_PARTIAL_TAPES AS NB_PARTIAL_TAPES," "TAPE_POOL.NB_PARTIAL_TAPES AS NB_PARTIAL_TAPES,"
"TAPE_POOL.IS_ENCRYPTED AS IS_ENCRYPTED," "TAPE_POOL.IS_ENCRYPTED AS IS_ENCRYPTED,"
"TAPE_POOL.SUPPLY AS SUPPLY,"
"COALESCE(COUNT(TAPE.VID), 0) AS NB_TAPES," "COALESCE(COUNT(TAPE.VID), 0) AS NB_TAPES,"
"COALESCE(SUM(TAPE.CAPACITY_IN_BYTES), 0) AS CAPACITY_IN_BYTES," "COALESCE(SUM(TAPE.CAPACITY_IN_BYTES), 0) AS CAPACITY_IN_BYTES,"
...@@ -917,6 +922,7 @@ std::list<TapePool> RdbmsCatalogue::getTapePools() const { ...@@ -917,6 +922,7 @@ std::list<TapePool> RdbmsCatalogue::getTapePools() const {
"TAPE_POOL.VO," "TAPE_POOL.VO,"
"TAPE_POOL.NB_PARTIAL_TAPES," "TAPE_POOL.NB_PARTIAL_TAPES,"
"TAPE_POOL.IS_ENCRYPTED," "TAPE_POOL.IS_ENCRYPTED,"
"TAPE_POOL.SUPPLY,"
"TAPE_POOL.USER_COMMENT," "TAPE_POOL.USER_COMMENT,"
"TAPE_POOL.CREATION_LOG_USER_NAME," "TAPE_POOL.CREATION_LOG_USER_NAME,"
"TAPE_POOL.CREATION_LOG_HOST_NAME," "TAPE_POOL.CREATION_LOG_HOST_NAME,"
...@@ -937,6 +943,7 @@ std::list<TapePool> RdbmsCatalogue::getTapePools() const { ...@@ -937,6 +943,7 @@ std::list<TapePool> RdbmsCatalogue::getTapePools() const {
pool.vo = rset.columnString("VO"); pool.vo = rset.columnString("VO");
pool.nbPartialTapes = rset.columnUint64("NB_PARTIAL_TAPES"); pool.nbPartialTapes = rset.columnUint64("NB_PARTIAL_TAPES");
pool.encryption = rset.columnBool("IS_ENCRYPTED"); pool.encryption = rset.columnBool("IS_ENCRYPTED");
pool.supply = rset.columnOptionalString("SUPPLY");
pool.nbTapes = rset.columnUint64("NB_TAPES"); pool.nbTapes = rset.columnUint64("NB_TAPES");
pool.capacityBytes = rset.columnUint64("CAPACITY_IN_BYTES"); pool.capacityBytes = rset.columnUint64("CAPACITY_IN_BYTES");
pool.dataBytes = rset.columnUint64("DATA_IN_BYTES"); pool.dataBytes = rset.columnUint64("DATA_IN_BYTES");
......
...@@ -233,7 +233,7 @@ public: ...@@ -233,7 +233,7 @@ public:
void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &name, const uint64_t nbCopies) override; void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &name, const uint64_t nbCopies) override;
void modifyStorageClassComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &name, const std::string &comment) override; void modifyStorageClassComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &name, const std::string &comment) override;
void createTapePool(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string &comment) override; void createTapePool(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo, const uint64_t nbPartialTapes, const bool encryptionValue, const cta::optional<std::string> &supply, const std::string &comment) override;
void deleteTapePool(const std::string &name) override; void deleteTapePool(const std::string &name) override;
std::list<TapePool> getTapePools() const override; std::list<TapePool> getTapePools() const override;
void modifyTapePoolVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override; void modifyTapePoolVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override;
......
...@@ -214,7 +214,9 @@ public: ...@@ -214,7 +214,9 @@ public:
const std::string tapePoolComment = "Tape-pool comment"; const std::string tapePoolComment = "Tape-pool comment";
const std::string vo = "vo"; const std::string vo = "vo";
const bool tapePoolEncryption = false; const bool tapePoolEncryption = false;
catalogue.createTapePool(s_adminOnAdminHost, s_tapePoolName, vo, nbPartialTapes, tapePoolEncryption, tapePoolComment); const cta::optional<std::string> tapePoolSupply("value for the supply pool mechanism");
catalogue.createTapePool(s_adminOnAdminHost, s_tapePoolName, vo, nbPartialTapes, tapePoolEncryption, tapePoolSupply,
tapePoolComment);
const uint32_t copyNb = 1; const uint32_t copyNb = 1;
const std::string archiveRouteComment = "Archive-route comment"; const std::string archiveRouteComment = "Archive-route comment";
catalogue.createArchiveRoute(s_adminOnAdminHost, s_diskInstance, s_storageClassName, copyNb, s_tapePoolName, catalogue.createArchiveRoute(s_adminOnAdminHost, s_diskInstance, s_storageClassName, copyNb, s_tapePoolName,
......
...@@ -295,8 +295,9 @@ public: ...@@ -295,8 +295,9 @@ public:
const std::string tapePoolComment = "Tape-pool comment"; const std::string tapePoolComment = "Tape-pool comment";
const std::string vo = "vo"; const std::string vo = "vo";
const bool tapePoolEncryption = false; const bool tapePoolEncryption = false;
const cta::optional<std::string> tapePoolSupply("value for the supply pool mechanism");
ASSERT_NO_THROW(catalogue.createTapePool(s_adminOnAdminHost, s_tapePoolName, vo, nbPartialTapes, tapePoolEncryption, ASSERT_NO_THROW(catalogue.createTapePool(s_adminOnAdminHost, s_tapePoolName, vo, nbPartialTapes, tapePoolEncryption,
tapePoolComment)); tapePoolSupply, tapePoolComment));
const uint32_t copyNb = 1; const uint32_t copyNb = 1;
const std::string archiveRouteComment = "Archive-route comment"; const std::string archiveRouteComment = "Archive-route comment";
catalogue.createArchiveRoute(s_adminOnAdminHost, s_diskInstance, s_storageClassName, copyNb, s_tapePoolName, catalogue.createArchiveRoute(s_adminOnAdminHost, s_diskInstance, s_storageClassName, copyNb, s_tapePoolName,
......
...@@ -118,6 +118,7 @@ namespace unitTests { ...@@ -118,6 +118,7 @@ namespace unitTests {
const std::string logicalLibraryName = "logical_library_name"; const std::string logicalLibraryName = "logical_library_name";
const std::string tapePoolName = "tape_pool_name"; const std::string tapePoolName = "tape_pool_name";
const std::string vo = "vo"; const std::string vo = "vo";
const cta::optional<std::string> supply("value for the supply pool mechanism");
const uint64_t capacityInBytes = (uint64_t)10 * 1000 * 1000 * 1000 * 1000; const uint64_t capacityInBytes = (uint64_t)10 * 1000 * 1000 * 1000 * 1000;
const bool disabledValue = true; const bool disabledValue = true;
const bool fullValue = false; const bool fullValue = false;
...@@ -125,7 +126,7 @@ namespace unitTests { ...@@ -125,7 +126,7 @@ namespace unitTests {
cta::common::dataStructures::SecurityIdentity admin = cta::common::dataStructures::SecurityIdentity("admin","localhost"); cta::common::dataStructures::SecurityIdentity admin = cta::common::dataStructures::SecurityIdentity("admin","localhost");
m_catalogue->createLogicalLibrary(admin, logicalLibraryName, "Create logical library"); m_catalogue->createLogicalLibrary(admin, logicalLibraryName, "Create logical library");
m_catalogue->createTapePool(admin, tapePoolName, vo, 2, true, "Create tape pool"); m_catalogue->createTapePool(admin, tapePoolName, vo, 2, true, supply, "Create tape pool");
m_catalogue->createTape(admin, vid1, mediaType, vendor, logicalLibraryName, tapePoolName, capacityInBytes, m_catalogue->createTape(admin, vid1, mediaType, vendor, logicalLibraryName, tapePoolName, capacityInBytes,
disabledValue, fullValue, createTapeComment); disabledValue, fullValue, createTapeComment);
...@@ -264,6 +265,9 @@ namespace unitTests { ...@@ -264,6 +265,9 @@ namespace unitTests {
const std::string logicalLibraryName = "logical_library_name"; const std::string logicalLibraryName = "logical_library_name";
const std::string tapePoolName = "tape_pool_name"; const std::string tapePoolName = "tape_pool_name";
const std::string vo = "vo"; const std::string vo = "vo";
const uint64_t nbPartialTapes = 2;
const bool isEncrypted = true;
const cta::optional<std::string> supply("value for the supply pool mechanism");
const uint64_t capacityInBytes = (uint64_t)10 * 1000 * 1000 * 1000 * 1000; const uint64_t capacityInBytes = (uint64_t)10 * 1000 * 1000 * 1000 * 1000;
const bool disabledValue = true; const bool disabledValue = true;
const bool fullValue = false; const bool fullValue = false;
...@@ -271,7 +275,7 @@ namespace unitTests { ...@@ -271,7 +275,7 @@ namespace unitTests {
cta::common::dataStructures::SecurityIdentity admin = cta::common::dataStructures::SecurityIdentity("admin","localhost"); cta::common::dataStructures::SecurityIdentity admin = cta::common::dataStructures::SecurityIdentity("admin","localhost");
m_catalogue->createLogicalLibrary(admin, logicalLibraryName, "Create logical library"); m_catalogue->createLogicalLibrary(admin, logicalLibraryName, "Create logical library");
m_catalogue->createTapePool(admin, tapePoolName, vo, 2, true, "Create tape pool"); m_catalogue->createTapePool(admin, tapePoolName, vo, nbPartialTapes, isEncrypted, supply, "Create tape pool");
m_catalogue->createTape(admin, vid1, mediaType, vendor, logicalLibraryName, tapePoolName, capacityInBytes, m_catalogue->createTape(admin, vid1, mediaType, vendor, logicalLibraryName, tapePoolName, capacityInBytes,
disabledValue, fullValue, createTapeComment); disabledValue, fullValue, createTapeComment);
......
...@@ -2049,8 +2049,9 @@ void RequestMessage::processTapePool_Add(const cta::admin::AdminCmd &admincmd, c ...@@ -2049,8 +2049,9 @@ void RequestMessage::processTapePool_Add(const cta::admin::AdminCmd &admincmd, c
auto &ptn = getRequired(OptionUInt64::PARTIAL_TAPES_NUMBER); auto &ptn = getRequired(OptionUInt64::PARTIAL_TAPES_NUMBER);
auto &comment = getRequired(OptionString::COMMENT); auto &comment = getRequired(OptionString::COMMENT);
auto &encrypted = getRequired(OptionBoolean::ENCRYPTED); auto &encrypted = getRequired(OptionBoolean::ENCRYPTED);
const cta::optional<std::string> supply("TBD");
m_catalogue.createTapePool(m_cliIdentity, name, vo, ptn, encrypted, comment); m_catalogue.createTapePool(m_cliIdentity, name, vo, ptn, encrypted, supply, comment);
response.set_type(cta::xrd::Response::RSP_SUCCESS); response.set_type(cta::xrd::Response::RSP_SUCCESS);
} }
......
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