diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp index bd665213fca2c2512bf5af2754eb221c8027f2c5..8f2a737a58a3adedeeaf4c0f62bb3a04585a6bd8 100644 --- a/catalogue/Catalogue.hpp +++ b/catalogue/Catalogue.hpp @@ -92,11 +92,12 @@ public: virtual void modifyStorageClassNbCopies(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbCopies) = 0; virtual void modifyStorageClassComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment) = 0; - virtual void createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const std::string &comment) = 0; + virtual void createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string &comment) = 0; virtual void deleteTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name) = 0; virtual std::list<cta::common::dataStructures::TapePool> getTapePools(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const = 0; virtual void modifyTapePoolNbPartialTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes) = 0; virtual void modifyTapePoolComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment) = 0; + virtual void setTapePoolEncryption(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const bool encryptionValue) = 0; virtual void createArchiveRoute(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb, const std::string &tapePoolName, const std::string &comment) = 0; virtual void deleteArchiveRoute(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb) = 0; @@ -109,19 +110,24 @@ public: virtual std::list<cta::common::dataStructures::LogicalLibrary> getLogicalLibraries(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const = 0; virtual void modifyLogicalLibraryComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment) = 0; - virtual void createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, const uint64_t capacityInBytes, - const bool disabledValue, const bool fullValue, const std::string &comment) = 0; + virtual void createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, + const std::string &encryptionKey, const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment) = 0; virtual void deleteTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid) = 0; virtual std::list<cta::common::dataStructures::Tape> getTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, - const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue) = 0; + const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue, const std::string &lbpValue) = 0; virtual void reclaimTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid) = 0; virtual void modifyTapeLogicalLibraryName(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName) = 0; virtual void modifyTapeTapePoolName(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &tapePoolName) = 0; virtual void modifyTapeCapacityInBytes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const uint64_t capacityInBytes) = 0; + virtual void modifyTapeEncryptionKey(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &encryptionKey) = 0; + virtual void modifyTapeLabelLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) = 0; // internal function (noCLI) + virtual void modifyTapeLastWrittenLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) = 0; // internal function (noCLI) + virtual void modifyTapeLastReadLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) = 0; // internal function (noCLI) virtual void setTapeBusy(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool busyValue) = 0; // internal function not exposed to the Admin CLI virtual void setTapeFull(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool fullValue) = 0; virtual void setTapeDisabled(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool disabledValue) = 0; + virtual void setTapeLbp(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue) = 0; // internal function (noCLI) virtual void modifyTapeComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &comment) = 0; virtual void createUser(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &group, const std::string &mountGroup, const std::string &comment) = 0; diff --git a/catalogue/DummyCatalogue.cpp b/catalogue/DummyCatalogue.cpp index a2dbb583fd4c7bf14d90f9ac5ab5ef273fb0367e..50d24d481eb1493ecb431ab0dd78e588359b3a26 100644 --- a/catalogue/DummyCatalogue.cpp +++ b/catalogue/DummyCatalogue.cpp @@ -98,7 +98,7 @@ void cta::catalogue::DummyCatalogue::modifyStorageClassComment(const cta::common //------------------------------------------------------------------------------ // createTapePool //------------------------------------------------------------------------------ -void cta::catalogue::DummyCatalogue::createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const std::string &comment) {} +void cta::catalogue::DummyCatalogue::createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string &comment) {} //------------------------------------------------------------------------------ // deleteTapePool @@ -120,6 +120,11 @@ void cta::catalogue::DummyCatalogue::modifyTapePoolNbPartialTapes(const cta::com //------------------------------------------------------------------------------ void cta::catalogue::DummyCatalogue::modifyTapePoolComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment) {} +//------------------------------------------------------------------------------ +// setTapePoolEncryption +//------------------------------------------------------------------------------ +void cta::catalogue::DummyCatalogue::setTapePoolEncryption(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const bool encryptionValue) {} + //------------------------------------------------------------------------------ // createArchiveRoute //------------------------------------------------------------------------------ @@ -168,8 +173,8 @@ void cta::catalogue::DummyCatalogue::modifyLogicalLibraryComment(const cta::comm //------------------------------------------------------------------------------ // createTape //------------------------------------------------------------------------------ -void cta::catalogue::DummyCatalogue::createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, const uint64_t capacityInBytes, - const bool disabledValue, const bool fullValue, const std::string &comment) {} +void cta::catalogue::DummyCatalogue::createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, + const std::string &encryptionKey, const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment) {} //------------------------------------------------------------------------------ // deleteTape @@ -181,7 +186,7 @@ void cta::catalogue::DummyCatalogue::deleteTape(const cta::common::dataStructure //------------------------------------------------------------------------------ std::list<cta::common::dataStructures::Tape> cta::catalogue::DummyCatalogue::getTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, - const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue) { return std::list<cta::common::dataStructures::Tape>();} + const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue, const std::string &lbpValue) { return std::list<cta::common::dataStructures::Tape>();} //------------------------------------------------------------------------------ // reclaimTape @@ -203,6 +208,26 @@ void cta::catalogue::DummyCatalogue::modifyTapeTapePoolName(const cta::common::d //------------------------------------------------------------------------------ void cta::catalogue::DummyCatalogue::modifyTapeCapacityInBytes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const uint64_t capacityInBytes) {} +//------------------------------------------------------------------------------ +// modifyTapeEncryptionKey +//------------------------------------------------------------------------------ +void cta::catalogue::DummyCatalogue::modifyTapeEncryptionKey(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &encryptionKey) {} + +//------------------------------------------------------------------------------ +// modifyTapeLabelLog +//------------------------------------------------------------------------------ +void cta::catalogue::DummyCatalogue::modifyTapeLabelLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) {} + +//------------------------------------------------------------------------------ +// modifyTapeLastWrittenLog +//------------------------------------------------------------------------------ +void cta::catalogue::DummyCatalogue::modifyTapeLastWrittenLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) {} + +//------------------------------------------------------------------------------ +// modifyTapeLastReadLog +//------------------------------------------------------------------------------ +void cta::catalogue::DummyCatalogue::modifyTapeLastReadLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) {} + //------------------------------------------------------------------------------ // setTapeBusy //------------------------------------------------------------------------------ @@ -218,6 +243,11 @@ void cta::catalogue::DummyCatalogue::setTapeFull(const cta::common::dataStructur //------------------------------------------------------------------------------ void cta::catalogue::DummyCatalogue::setTapeDisabled(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool disabledValue) {} +//------------------------------------------------------------------------------ +// setTapeLbp +//------------------------------------------------------------------------------ +void cta::catalogue::DummyCatalogue::setTapeLbp(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue) {} + //------------------------------------------------------------------------------ // modifyTapeComment //------------------------------------------------------------------------------ diff --git a/catalogue/DummyCatalogue.hpp b/catalogue/DummyCatalogue.hpp index 27ebec88fd29f10b5555f9879ba6977048975b56..e983da45c0f15be0a64c88dbbdd6d15740bf65a3 100644 --- a/catalogue/DummyCatalogue.hpp +++ b/catalogue/DummyCatalogue.hpp @@ -52,11 +52,12 @@ public: virtual void modifyStorageClassNbCopies(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbCopies); virtual void modifyStorageClassComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment); - virtual void createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const std::string &comment); + virtual void createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string &comment); virtual void deleteTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name); virtual std::list<cta::common::dataStructures::TapePool> getTapePools(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const; virtual void modifyTapePoolNbPartialTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes); virtual void modifyTapePoolComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment); + virtual void setTapePoolEncryption(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const bool encryptionValue); virtual void createArchiveRoute(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb, const std::string &tapePoolName, const std::string &comment); virtual void deleteArchiveRoute(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb); @@ -69,19 +70,24 @@ public: virtual std::list<cta::common::dataStructures::LogicalLibrary> getLogicalLibraries(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const; virtual void modifyLogicalLibraryComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment); - virtual void createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, const uint64_t capacityInBytes, - const bool disabledValue, const bool fullValue, const std::string &comment); + virtual void createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, + const std::string &encryptionKey, const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment); virtual void deleteTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); virtual std::list<cta::common::dataStructures::Tape> getTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, - const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue); + const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue, const std::string &lbpValue); virtual void reclaimTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); virtual void modifyTapeLogicalLibraryName(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName); virtual void modifyTapeTapePoolName(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &tapePoolName); virtual void modifyTapeCapacityInBytes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const uint64_t capacityInBytes); + virtual void modifyTapeEncryptionKey(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &encryptionKey); + virtual void modifyTapeLabelLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp); // internal function (noCLI) + virtual void modifyTapeLastWrittenLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp); // internal function (noCLI) + virtual void modifyTapeLastReadLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp); // internal function (noCLI) virtual void setTapeBusy(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool busyValue); // internal function not exposed to the Admin CLI virtual void setTapeFull(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool fullValue); virtual void setTapeDisabled(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool disabledValue); + virtual void setTapeLbp(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue); // internal function (noCLI) virtual void modifyTapeComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &comment); virtual void createUser(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &group, const std::string &mountGroup, const std::string &comment); diff --git a/catalogue/SqliteCatalogue.cpp b/catalogue/SqliteCatalogue.cpp index b43649bcabfa0d6257d4d73d44813ef045a52f5b..5880e620c88ecff2cf67f7adb7255fed99b54a44 100644 --- a/catalogue/SqliteCatalogue.cpp +++ b/catalogue/SqliteCatalogue.cpp @@ -342,7 +342,7 @@ void cta::catalogue::SqliteCatalogue::modifyStorageClassComment(const common::da //------------------------------------------------------------------------------ // createTapePool //------------------------------------------------------------------------------ -void cta::catalogue::SqliteCatalogue::createTapePool(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const std::string &comment) {} +void cta::catalogue::SqliteCatalogue::createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string &comment) {} //------------------------------------------------------------------------------ // deleteTapePool @@ -364,6 +364,11 @@ void cta::catalogue::SqliteCatalogue::modifyTapePoolNbPartialTapes(const common: //------------------------------------------------------------------------------ void cta::catalogue::SqliteCatalogue::modifyTapePoolComment(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment) {} +//------------------------------------------------------------------------------ +// setTapePoolEncryption +//------------------------------------------------------------------------------ +void cta::catalogue::SqliteCatalogue::setTapePoolEncryption(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const bool encryptionValue) {} + //------------------------------------------------------------------------------ // createArchiveRoute //------------------------------------------------------------------------------ @@ -412,8 +417,8 @@ void cta::catalogue::SqliteCatalogue::modifyLogicalLibraryComment(const common:: //------------------------------------------------------------------------------ // createTape //------------------------------------------------------------------------------ -void cta::catalogue::SqliteCatalogue::createTape(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, const uint64_t capacityInBytes, - const bool disabledValue, const bool fullValue, const std::string &comment) {} +void cta::catalogue::SqliteCatalogue::createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, + const std::string &encryptionKey, const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment) {} //------------------------------------------------------------------------------ // deleteTape @@ -423,9 +428,9 @@ void cta::catalogue::SqliteCatalogue::deleteTape(const common::dataStructures::S //------------------------------------------------------------------------------ // getTapes //------------------------------------------------------------------------------ -std::list<cta::common::dataStructures::Tape> cta::catalogue::SqliteCatalogue::getTapes(const common::dataStructures::SecurityIdentity &cliIdentity, +std::list<cta::common::dataStructures::Tape> cta::catalogue::SqliteCatalogue::getTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, - const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue) { return std::list<cta::common::dataStructures::Tape>();} + const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue, const std::string &lbpValue) { return std::list<cta::common::dataStructures::Tape>();} //------------------------------------------------------------------------------ // reclaimTape @@ -447,6 +452,26 @@ void cta::catalogue::SqliteCatalogue::modifyTapeTapePoolName(const common::dataS //------------------------------------------------------------------------------ void cta::catalogue::SqliteCatalogue::modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const uint64_t capacityInBytes) {} +//------------------------------------------------------------------------------ +// modifyTapeEncryptionKey +//------------------------------------------------------------------------------ +void cta::catalogue::SqliteCatalogue::modifyTapeEncryptionKey(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &encryptionKey) {} + +//------------------------------------------------------------------------------ +// modifyTapeLabelLog +//------------------------------------------------------------------------------ +void cta::catalogue::SqliteCatalogue::modifyTapeLabelLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) {} + +//------------------------------------------------------------------------------ +// modifyTapeLastWrittenLog +//------------------------------------------------------------------------------ +void cta::catalogue::SqliteCatalogue::modifyTapeLastWrittenLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) {} + +//------------------------------------------------------------------------------ +// modifyTapeLastReadLog +//------------------------------------------------------------------------------ +void cta::catalogue::SqliteCatalogue::modifyTapeLastReadLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) {} + //------------------------------------------------------------------------------ // setTapeBusy //------------------------------------------------------------------------------ @@ -462,6 +487,11 @@ void cta::catalogue::SqliteCatalogue::setTapeFull(const common::dataStructures:: //------------------------------------------------------------------------------ void cta::catalogue::SqliteCatalogue::setTapeDisabled(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool disabledValue) {} +//------------------------------------------------------------------------------ +// setTapeLbp +//------------------------------------------------------------------------------ +void cta::catalogue::SqliteCatalogue::setTapeLbp(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue) {} + //------------------------------------------------------------------------------ // modifyTapeComment //------------------------------------------------------------------------------ diff --git a/catalogue/SqliteCatalogue.hpp b/catalogue/SqliteCatalogue.hpp index 947061fd5fb70733da6332df21bf883dd3c3a79f..f02638625da424927d26e8731f1641108c652b1c 100644 --- a/catalogue/SqliteCatalogue.hpp +++ b/catalogue/SqliteCatalogue.hpp @@ -58,11 +58,12 @@ public: virtual void modifyStorageClassNbCopies(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbCopies); virtual void modifyStorageClassComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment); - virtual void createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const std::string &comment); + virtual void createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string &comment); virtual void deleteTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name); virtual std::list<cta::common::dataStructures::TapePool> getTapePools(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const; virtual void modifyTapePoolNbPartialTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes); virtual void modifyTapePoolComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment); + virtual void setTapePoolEncryption(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const bool encryptionValue); virtual void createArchiveRoute(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb, const std::string &tapePoolName, const std::string &comment); virtual void deleteArchiveRoute(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb); @@ -75,19 +76,24 @@ public: virtual std::list<cta::common::dataStructures::LogicalLibrary> getLogicalLibraries(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const; virtual void modifyLogicalLibraryComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment); - virtual void createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, const uint64_t capacityInBytes, - const bool disabledValue, const bool fullValue, const std::string &comment); + virtual void createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, + const std::string &encryptionKey, const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment); virtual void deleteTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); virtual std::list<cta::common::dataStructures::Tape> getTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, - const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue); + const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue, const std::string &lbpValue); virtual void reclaimTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); virtual void modifyTapeLogicalLibraryName(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName); virtual void modifyTapeTapePoolName(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &tapePoolName); virtual void modifyTapeCapacityInBytes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const uint64_t capacityInBytes); + virtual void modifyTapeEncryptionKey(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &encryptionKey); + virtual void modifyTapeLabelLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp); // internal function (noCLI) + virtual void modifyTapeLastWrittenLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp); // internal function (noCLI) + virtual void modifyTapeLastReadLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp); // internal function (noCLI) virtual void setTapeBusy(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool busyValue); // internal function not exposed to the Admin CLI virtual void setTapeFull(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool fullValue); virtual void setTapeDisabled(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool disabledValue); + virtual void setTapeLbp(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue); // internal function (noCLI) virtual void modifyTapeComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &comment); virtual void createUser(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &group, const std::string &mountGroup, const std::string &comment); diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 265c447cfd3b2b2a665fd03fe2c21a02439adb92..580b56fd2a9ca0291683b0d362031a567d03de16 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -29,6 +29,7 @@ set (COMMON_LIB_SRC_FILES dataStructures/StorageClass.cpp dataStructures/Tape.cpp dataStructures/TapeFileLocation.cpp + dataStructures/TapeLog.cpp dataStructures/TapePool.cpp dataStructures/TestSourceType.cpp dataStructures/UpdateFileInfoRequest.cpp diff --git a/common/dataStructures/Tape.cpp b/common/dataStructures/Tape.cpp index 7a7b4c17a2e876b3858e75fe80363b427f64aa3c..09893a17fa9fc59f9b385e17d1a70c9de3fd8414 100644 --- a/common/dataStructures/Tape.cpp +++ b/common/dataStructures/Tape.cpp @@ -30,9 +30,14 @@ bool cta::common::dataStructures::Tape::operator==(const Tape &rhs) const { && creationLog==rhs.creationLog && dataOnTapeInBytes==rhs.dataOnTapeInBytes && disabled==rhs.disabled + && encryptionKey==rhs.encryptionKey && full==rhs.full + && labelLog==rhs.labelLog && lastFSeq==rhs.lastFSeq && lastModificationLog==rhs.lastModificationLog + && lastReadLog==rhs.lastReadLog + && lastWriteLog==rhs.lastWriteLog + && lbp==rhs.lbp && logicalLibraryName==rhs.logicalLibraryName && tapePoolName==rhs.tapePoolName && vid==rhs.vid; @@ -55,9 +60,14 @@ std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::Ta << " creationLog=" << obj.creationLog << " dataOnTapeInBytes=" << obj.dataOnTapeInBytes << " disabled=" << obj.disabled + << " encryptionKey=" << obj.encryptionKey << " full=" << obj.full + << " labelLog=" << obj.labelLog << " lastFSeq=" << obj.lastFSeq << " lastModificationLog=" << obj.lastModificationLog + << " lastReadLog=" << obj.lastReadLog + << " lastWriteLog=" << obj.lastWriteLog + << " lbp=" << obj.lbp << " logicalLibraryName=" << obj.logicalLibraryName << " tapePoolName=" << obj.tapePoolName << " vid=" << obj.vid << ")"; diff --git a/common/dataStructures/Tape.hpp b/common/dataStructures/Tape.hpp index 7a929b7248266b2eea926f19e0769cdda9cdcd3e..86970034ed6a72bcf1f48247c81f694359345236 100644 --- a/common/dataStructures/Tape.hpp +++ b/common/dataStructures/Tape.hpp @@ -24,6 +24,7 @@ #include <string> #include "common/dataStructures/EntryLog.hpp" +#include "common/dataStructures/TapeLog.hpp" namespace cta { namespace common { @@ -42,9 +43,14 @@ struct Tape { cta::common::dataStructures::EntryLog creationLog; uint64_t dataOnTapeInBytes; bool disabled; + std::string encryptionKey; bool full; + cta::common::dataStructures::TapeLog labelLog; uint64_t lastFSeq; cta::common::dataStructures::EntryLog lastModificationLog; + cta::common::dataStructures::TapeLog lastReadLog; + cta::common::dataStructures::TapeLog lastWriteLog; + bool lbp; std::string logicalLibraryName; std::string tapePoolName; std::string vid; diff --git a/common/dataStructures/TapeLog.cpp b/common/dataStructures/TapeLog.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ba7490b0f2d122142ded152635ee73fd9c462f6e --- /dev/null +++ b/common/dataStructures/TapeLog.cpp @@ -0,0 +1,46 @@ +/* + * 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/TapeLog.hpp" +#include "common/dataStructures/utils.hpp" +#include "common/exception/Exception.hpp" + +//------------------------------------------------------------------------------ +// operator== +//------------------------------------------------------------------------------ +bool cta::common::dataStructures::TapeLog::operator==(const TapeLog &rhs) const { + return drive==rhs.drive + && time==rhs.time; +} + +//------------------------------------------------------------------------------ +// operator!= +//------------------------------------------------------------------------------ +bool cta::common::dataStructures::TapeLog::operator!=(const TapeLog &rhs) const { + return !operator==(rhs); +} + +//------------------------------------------------------------------------------ +// operator<< +//------------------------------------------------------------------------------ +std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::TapeLog &obj) { + os << "(drive=" << obj.drive + << " time=" << obj.time << ")"; + return os; +} + diff --git a/common/dataStructures/TapeLog.hpp b/common/dataStructures/TapeLog.hpp new file mode 100644 index 0000000000000000000000000000000000000000..21124cf4894e1c51e0710397e63c68bcdb78c3ae --- /dev/null +++ b/common/dataStructures/TapeLog.hpp @@ -0,0 +1,47 @@ +/* + * 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> + + +namespace cta { +namespace common { +namespace dataStructures { + +struct TapeLog { + + + bool operator==(const TapeLog &rhs) const; + + bool operator!=(const TapeLog &rhs) const; + + std::string drive; + time_t time; + +}; // struct TapeLog + +} // namespace dataStructures +} // namespace common +} // namespace cta + +std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::TapeLog &obj); diff --git a/common/dataStructures/TapePool.cpp b/common/dataStructures/TapePool.cpp index ba559de0f3638c628b1de277a9728181eb3353f0..67a4d5be603993a23d5803577464b7044819be9e 100644 --- a/common/dataStructures/TapePool.cpp +++ b/common/dataStructures/TapePool.cpp @@ -26,6 +26,7 @@ bool cta::common::dataStructures::TapePool::operator==(const TapePool &rhs) const { return comment==rhs.comment && creationLog==rhs.creationLog + && encryption==rhs.encryption && lastModificationLog==rhs.lastModificationLog && name==rhs.name && nbPartialTapes==rhs.nbPartialTapes; @@ -44,6 +45,7 @@ bool cta::common::dataStructures::TapePool::operator!=(const TapePool &rhs) cons std::ostream &operator<<(std::ostream &os, const cta::common::dataStructures::TapePool &obj) { os << "(comment=" << obj.comment << " creationLog=" << obj.creationLog + << " encryption=" << obj.encryption << " lastModificationLog=" << obj.lastModificationLog << " name=" << obj.name << " nbPartialTapes=" << obj.nbPartialTapes << ")"; diff --git a/common/dataStructures/TapePool.hpp b/common/dataStructures/TapePool.hpp index dd56aacdce6a3929d6b15221ae9765095b015fa1..cd7a5e681def6023f6f54d0e23cb9489bccc9d47 100644 --- a/common/dataStructures/TapePool.hpp +++ b/common/dataStructures/TapePool.hpp @@ -38,6 +38,7 @@ struct TapePool { std::string comment; cta::common::dataStructures::EntryLog creationLog; + bool encryption; cta::common::dataStructures::EntryLog lastModificationLog; std::string name; uint64_t nbPartialTapes; diff --git a/scheduler/Scheduler.cpp b/scheduler/Scheduler.cpp index ef7ba0889326c1a5c00aa004baceaee7d48b483d..4ef0a3b651447e3b1c95ae1c621b60e665da77ec 100644 --- a/scheduler/Scheduler.cpp +++ b/scheduler/Scheduler.cpp @@ -195,8 +195,8 @@ void cta::Scheduler::modifyStorageClassComment(const cta::common::dataStructures //------------------------------------------------------------------------------ // createTapePool //------------------------------------------------------------------------------ -void cta::Scheduler::createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const std::string &comment) { - m_catalogue.createTapePool(cliIdentity, name, nbPartialTapes, comment); +void cta::Scheduler::createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string &comment) { + m_catalogue.createTapePool(cliIdentity, name, nbPartialTapes, encryptionValue, comment); } //------------------------------------------------------------------------------ @@ -227,6 +227,13 @@ void cta::Scheduler::modifyTapePoolComment(const cta::common::dataStructures::Se m_catalogue.modifyTapePoolComment(cliIdentity, name, comment); } +//------------------------------------------------------------------------------ +// setTapePoolEncryption +//------------------------------------------------------------------------------ +void cta::Scheduler::setTapePoolEncryption(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const bool encryptionValue) { + m_catalogue.setTapePoolEncryption(cliIdentity, name, encryptionValue); +} + //------------------------------------------------------------------------------ // createArchiveRoute //------------------------------------------------------------------------------ @@ -295,8 +302,8 @@ void cta::Scheduler::modifyLogicalLibraryComment(const cta::common::dataStructur // createTape //------------------------------------------------------------------------------ void cta::Scheduler::createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, - const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment) { - m_catalogue.createTape(cliIdentity, vid, logicalLibraryName, tapePoolName, capacityInBytes, disabledValue, fullValue, comment); + const std::string &encryptionKey, const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment) { + m_catalogue.createTape(cliIdentity, vid, logicalLibraryName, tapePoolName, encryptionKey, capacityInBytes, disabledValue, fullValue, comment); } //------------------------------------------------------------------------------ @@ -311,8 +318,8 @@ void cta::Scheduler::deleteTape(const cta::common::dataStructures::SecurityIdent //------------------------------------------------------------------------------ std::list<cta::common::dataStructures::Tape> cta::Scheduler::getTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, - const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue) { - return m_catalogue.getTapes(cliIdentity, vid, logicalLibraryName, tapePoolName, capacityInBytes, disabledValue, fullValue, busyValue); + const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue, const std::string &lbpValue) { + return m_catalogue.getTapes(cliIdentity, vid, logicalLibraryName, tapePoolName, capacityInBytes, disabledValue, fullValue, busyValue, lbpValue); } //------------------------------------------------------------------------------ @@ -349,6 +356,34 @@ void cta::Scheduler::modifyTapeCapacityInBytes(const cta::common::dataStructures m_catalogue.modifyTapeCapacityInBytes(cliIdentity, vid, capacityInBytes); } +//------------------------------------------------------------------------------ +// modifyTapeEncryptionKey +//------------------------------------------------------------------------------ +void cta::Scheduler::modifyTapeEncryptionKey(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &encryptionKey) { + m_catalogue.modifyTapeEncryptionKey(cliIdentity, vid, encryptionKey); +} + +//------------------------------------------------------------------------------ +// modifyTapeLabelLog +//------------------------------------------------------------------------------ +void cta::Scheduler::modifyTapeLabelLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) { + m_catalogue.modifyTapeLabelLog(cliIdentity, vid, drive, timestamp); +} + +//------------------------------------------------------------------------------ +// modifyTapeLastWrittenLog +//------------------------------------------------------------------------------ +void cta::Scheduler::modifyTapeLastWrittenLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) { + m_catalogue.modifyTapeLastWrittenLog(cliIdentity, vid, drive, timestamp); +} + +//------------------------------------------------------------------------------ +// modifyTapeLastReadLog +//------------------------------------------------------------------------------ +void cta::Scheduler::modifyTapeLastReadLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp) { + m_catalogue.modifyTapeLastReadLog(cliIdentity, vid, drive, timestamp); +} + //------------------------------------------------------------------------------ // setTapeBusy //------------------------------------------------------------------------------ @@ -370,6 +405,13 @@ void cta::Scheduler::setTapeDisabled(const cta::common::dataStructures::Security m_catalogue.setTapeDisabled(cliIdentity, vid, disabledValue); } +//------------------------------------------------------------------------------ +// setTapeLbp +//------------------------------------------------------------------------------ +void cta::Scheduler::setTapeLbp(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue) { + m_catalogue.setTapeLbp(cliIdentity, vid, lbpValue); +} + //------------------------------------------------------------------------------ // modifyTapeComment //------------------------------------------------------------------------------ diff --git a/scheduler/Scheduler.hpp b/scheduler/Scheduler.hpp index 0470ce4e8a6d669f956667604d88ee05503c434f..90093c7fde07785e2afaa55017b38737f5e9b525 100644 --- a/scheduler/Scheduler.hpp +++ b/scheduler/Scheduler.hpp @@ -115,11 +115,12 @@ public: virtual void modifyStorageClassNbCopies(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbCopies); virtual void modifyStorageClassComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment); - virtual void createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const std::string &comment); + virtual void createTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes, const bool encryptionValue, const std::string &comment); virtual void deleteTapePool(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name); virtual std::list<cta::common::dataStructures::TapePool> getTapePools(const cta::common::dataStructures::SecurityIdentity &cliIdentity) const; virtual void modifyTapePoolNbPartialTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const uint64_t nbPartialTapes); virtual void modifyTapePoolComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment); + virtual void setTapePoolEncryption(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const bool encryptionValue); virtual void createArchiveRoute(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &storageClassName, const uint64_t copyNb, const std::string &tapePoolName, const std::string &comment); @@ -134,19 +135,24 @@ public: virtual void modifyLogicalLibraryComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &comment); virtual void createTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, - const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment); + const std::string &encryptionKey, const uint64_t capacityInBytes, const bool disabledValue, const bool fullValue, const std::string &comment); virtual void deleteTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); virtual std::list<cta::common::dataStructures::Tape> getTapes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, - const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue); + const std::string &capacityInBytes, const std::string &disabledValue, const std::string &fullValue, const std::string &busyValue, const std::string &lbpValue); virtual void labelTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool force, const bool lbp, const std::string &tag); virtual void reclaimTape(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); virtual void modifyTapeLogicalLibraryName(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &logicalLibraryName); virtual void modifyTapeTapePoolName(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &tapePoolName); virtual void modifyTapeCapacityInBytes(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const uint64_t capacityInBytes); + virtual void modifyTapeEncryptionKey(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &encryptionKey); + virtual void modifyTapeLabelLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp); // internal function (noCLI) + virtual void modifyTapeLastWrittenLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp); // internal function (noCLI) + virtual void modifyTapeLastReadLog(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &drive, const uint64_t timestamp); // internal function (noCLI) virtual void setTapeBusy(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool busyValue); // internal function not exposed to the Admin CLI virtual void setTapeFull(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool fullValue); virtual void setTapeDisabled(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool disabledValue); + virtual void setTapeLbp(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const bool lbpValue); // internal function (noCLI) virtual void modifyTapeComment(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string &comment); virtual void createUser(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &name, const std::string &group, const std::string &mountGroup, diff --git a/xroot_plugins/XrdCtaFile.cpp b/xroot_plugins/XrdCtaFile.cpp index fa8f1c59fbf3db5e02dcd62dd522495fa16d9c22..2f6e3ff84d34745f7514a2fa9a353ddc6c43ae76 100644 --- a/xroot_plugins/XrdCtaFile.cpp +++ b/xroot_plugins/XrdCtaFile.cpp @@ -519,7 +519,7 @@ void XrdProFile::xCom_adminhost(const std::vector<std::string> &tokens, const ct std::list<cta::common::dataStructures::AdminHost> list= m_scheduler->getAdminHosts(cliIdentity); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"hostname","c.uid","c.gid","c.host","c.time","m.uid","m.gid","m.host","m.time","comment"}; + std::vector<std::string> header = {"hostname","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -542,8 +542,8 @@ void XrdProFile::xCom_adminhost(const std::vector<std::string> &tokens, const ct void XrdProFile::xCom_tapepool(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity) { std::stringstream help; help << tokens[0] << " tp/tapepool add/ch/rm/ls:" << std::endl - << "\tadd --name/-n <tapepool_name> --partialtapesnumber/-p <number_of_partial_tapes> --comment/-m <\"comment\">" << std::endl - << "\tch --name/-n <tapepool_name> [--partialtapesnumber/-p <number_of_partial_tapes>] [--comment/-m <\"comment\">]" << std::endl + << "\tadd --name/-n <tapepool_name> --partialtapesnumber/-p <number_of_partial_tapes> [--encryption/-e or --clear/-c] --comment/-m <\"comment\">" << std::endl + << "\tch --name/-n <tapepool_name> [--partialtapesnumber/-p <number_of_partial_tapes>] [--encryption/-e or --clear/-c] [--comment/-m <\"comment\">]" << std::endl << "\trm --name/-n <tapepool_name>" << std::endl << "\tls [--header/-h]" << std::endl; if("add" == tokens[2] || "ch" == tokens[2] || "rm" == tokens[2]) { @@ -562,7 +562,13 @@ void XrdProFile::xCom_tapepool(const std::vector<std::string> &tokens, const cta std::stringstream ptn_ss(ptn_s); uint64_t ptn = 0; ptn_ss >> ptn; - m_scheduler->createTapePool(cliIdentity, name, ptn, comment); + bool encryption=false; + if((hasOption(tokens, "-e", "--encryption") && hasOption(tokens, "-c", "--clear"))) { + m_data = help.str(); + return; + } + encryption=hasOption(tokens, "-e", "--encryption"); + m_scheduler->createTapePool(cliIdentity, name, ptn, encryption, comment); } else if("ch" == tokens[2]) { //ch std::string ptn_s = getOptionValue(tokens, "-p", "--partialtapesnumber", false); @@ -580,6 +586,12 @@ void XrdProFile::xCom_tapepool(const std::vector<std::string> &tokens, const cta ptn_ss >> ptn; m_scheduler->modifyTapePoolNbPartialTapes(cliIdentity, name, ptn); } + if(hasOption(tokens, "-e", "--encryption")) { + m_scheduler->setTapePoolEncryption(cliIdentity, name, true); + } + if(hasOption(tokens, "-c", "--clear")) { + m_scheduler->setTapePoolEncryption(cliIdentity, name, false); + } } else { //rm m_scheduler->deleteTapePool(cliIdentity, name); @@ -589,12 +601,13 @@ void XrdProFile::xCom_tapepool(const std::vector<std::string> &tokens, const cta std::list<cta::common::dataStructures::TapePool> list= m_scheduler->getTapePools(cliIdentity); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"name","# partial tapes","c.uid","c.gid","c.host","c.time","m.uid","m.gid","m.host","m.time","comment"}; + std::vector<std::string> header = {"name","# partial tapes","encrypt","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; currentRow.push_back(it->name); currentRow.push_back(std::to_string((unsigned long long)it->nbPartialTapes)); + if(it->encryption) currentRow.push_back("true"); else currentRow.push_back("false"); addLogInfoToResponseRow(currentRow, it->creationLog, it->lastModificationLog); currentRow.push_back(it->comment); responseTable.push_back(currentRow); @@ -658,7 +671,7 @@ void XrdProFile::xCom_archiveroute(const std::vector<std::string> &tokens, const std::list<cta::common::dataStructures::ArchiveRoute> list= m_scheduler->getArchiveRoutes(cliIdentity); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"storage class","copy number","tapepool","c.uid","c.gid","c.host","c.time","m.uid","m.gid","m.host","m.time","comment"}; + std::vector<std::string> header = {"storage class","copy number","tapepool","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -714,7 +727,7 @@ void XrdProFile::xCom_logicallibrary(const std::vector<std::string> &tokens, con std::list<cta::common::dataStructures::LogicalLibrary> list= m_scheduler->getLogicalLibraries(cliIdentity); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"name","c.uid","c.gid","c.host","c.time","m.uid","m.gid","m.host","m.time","comment"}; + std::vector<std::string> header = {"name","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -737,11 +750,14 @@ void XrdProFile::xCom_logicallibrary(const std::vector<std::string> &tokens, con void XrdProFile::xCom_tape(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &cliIdentity) { std::stringstream help; help << tokens[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> [--enabled/-e or --disabled/-d] [--free/-f or --full/-F] [--comment/-m <\"comment\">] " << std::endl - << "\tch --vid/-v <vid> [--logicallibrary/-l <logical_library_name>] [--tapepool/-t <tapepool_name>] [--capacity/-c <capacity_in_bytes>] [--enabled/-e or --disabled/-d] [--free/-f or --full/-F] [--comment/-m <\"comment\">]" << 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 + << "\t [--enabled/-e or --disabled/-d] [--free/-f or --full/-F] [--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 [--enabled/-e or --disabled/-d] [--free/-f or --full/-F] [--comment/-m <\"comment\">]" << std::endl << "\trm --vid/-v <vid>" << std::endl << "\treclaim --vid/-v <vid>" << std::endl - << "\tls [--header/-h] [--vid/-v <vid>] [--logicallibrary/-l <logical_library_name>] [--tapepool/-t <tapepool_name>] [--capacity/-c <capacity_in_bytes>] [--enabled/-e or --disabled/-d] [--free/-f or --full/-F] [--busy/-b or --notbusy/-n]" << std::endl + << "\tls [--header/-h] [--vid/-v <vid>] [--logicallibrary/-l <logical_library_name>] [--tapepool/-t <tapepool_name>] [--capacity/-c <capacity_in_bytes>]" << std::endl + << "\t [--lbp/-p or --nolbp/-P] [--enabled/-e or --disabled/-d] [--free/-f or --full/-F] [--busy/-b or --notbusy/-n]" << std::endl << "\tlabel --vid/-v <vid> [--force/-f] [--lbp/-l] [--tag/-t <tag_name>]" << std::endl; if("add" == tokens[2] || "ch" == tokens[2] || "rm" == tokens[2] || "reclaim" == tokens[2] || "label" == tokens[2]) { std::string vid = getOptionValue(tokens, "-v", "--vid", false); @@ -769,14 +785,16 @@ void XrdProFile::xCom_tape(const std::vector<std::string> &tokens, const cta::co } disabled=hasOption(tokens, "-d", "--disabled"); full=hasOption(tokens, "-F", "--full"); - m_scheduler->createTape(cliIdentity, vid, logicallibrary, tapepool, capacity, disabled, full, comment); + std::string encryptionkey = getOptionValue(tokens, "-k", "--encryptionkey", false); + m_scheduler->createTape(cliIdentity, vid, logicallibrary, tapepool, encryptionkey, capacity, disabled, full, comment); } else if("ch" == tokens[2]) { //ch std::string logicallibrary = getOptionValue(tokens, "-l", "--logicallibrary", false); std::string tapepool = getOptionValue(tokens, "-t", "--tapepool", false); std::string capacity_s = getOptionValue(tokens, "-c", "--capacity", false); std::string comment = getOptionValue(tokens, "-m", "--comment", false); - if(comment.empty() && logicallibrary.empty() && tapepool.empty() && capacity_s.empty() && !hasOption(tokens, "-e", "--enabled") + std::string encryptionkey = getOptionValue(tokens, "-k", "--encryptionkey", false); + if(comment.empty() && logicallibrary.empty() && tapepool.empty() && capacity_s.empty() && encryptionkey.empty() && !hasOption(tokens, "-e", "--enabled") && !hasOption(tokens, "-d", "--disabled") && !hasOption(tokens, "-f", "--free") && !hasOption(tokens, "-F", "--full")) { m_data = help.str(); return; @@ -800,6 +818,9 @@ void XrdProFile::xCom_tape(const std::vector<std::string> &tokens, const cta::co if(!comment.empty()) { m_scheduler->modifyTapeComment(cliIdentity, vid, comment); } + if(!encryptionkey.empty()) { + m_scheduler->modifyTapeEncryptionKey(cliIdentity, vid, encryptionkey); + } if(hasOption(tokens, "-e", "--enabled")) { m_scheduler->setTapeDisabled(cliIdentity, vid, false); } @@ -830,13 +851,15 @@ void XrdProFile::xCom_tape(const std::vector<std::string> &tokens, const cta::co std::string capacity = getOptionValue(tokens, "-c", "--capacity", false); if((hasOption(tokens, "-e", "--enabled") && hasOption(tokens, "-d", "--disabled")) || (hasOption(tokens, "-f", "--free") && hasOption(tokens, "-F", "--full")) - || (hasOption(tokens, "-b", "--busy") && hasOption(tokens, "-n", "--notbusy"))) { + || (hasOption(tokens, "-b", "--busy") && hasOption(tokens, "-n", "--notbusy")) + || (hasOption(tokens, "-p", "--lbp") && hasOption(tokens, "-P", "--nolbp"))) { m_data = help.str(); return; } std::string disabled=""; std::string full=""; std::string busy=""; + std::string lbp=""; if(hasOption(tokens, "-e", "--enabled")) { disabled = "false"; } @@ -855,22 +878,37 @@ void XrdProFile::xCom_tape(const std::vector<std::string> &tokens, const cta::co if(hasOption(tokens, "-n", "--notbusy")) { busy = "true"; } - std::list<cta::common::dataStructures::Tape> list= m_scheduler->getTapes(cliIdentity, vid, logicallibrary, tapepool, capacity, disabled, full, busy); + if(hasOption(tokens, "-p", "--lbp")) { + lbp = "false"; + } + if(hasOption(tokens, "-P", "--nolbp")) { + lbp = "true"; + } + std::list<cta::common::dataStructures::Tape> list= m_scheduler->getTapes(cliIdentity, vid, logicallibrary, tapepool, capacity, disabled, full, busy, lbp); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"vid","logical library","tapepool","capacity","occupancy","last fseq","busy","full","disabled","c.uid","c.gid","c.host","c.time","m.uid","m.gid","m.host","m.time","comment"}; + std::vector<std::string> header = {"vid","logical library","tapepool","encription key","capacity","occupancy","last fseq","busy","full","disabled","lpb","label drive","label time", + "last w drive","last w time","last r drive","last r time","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--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(it->logicalLibraryName); currentRow.push_back(it->tapePoolName); + currentRow.push_back(it->encryptionKey); currentRow.push_back(std::to_string((unsigned long long)it->capacityInBytes)); currentRow.push_back(std::to_string((unsigned long long)it->dataOnTapeInBytes)); currentRow.push_back(std::to_string((unsigned long long)it->lastFSeq)); if(it->busy) currentRow.push_back("true"); else currentRow.push_back("false"); if(it->full) currentRow.push_back("true"); else currentRow.push_back("false"); if(it->disabled) currentRow.push_back("true"); else currentRow.push_back("false"); + if(it->lbp) currentRow.push_back("true"); else currentRow.push_back("false"); + currentRow.push_back(it->labelLog.drive); + currentRow.push_back(std::to_string((unsigned long long)it->labelLog.time)); + currentRow.push_back(it->lastWriteLog.drive); + currentRow.push_back(std::to_string((unsigned long long)it->lastWriteLog.time)); + currentRow.push_back(it->lastReadLog.drive); + currentRow.push_back(std::to_string((unsigned long long)it->lastReadLog.time)); addLogInfoToResponseRow(currentRow, it->creationLog, it->lastModificationLog); currentRow.push_back(it->comment); responseTable.push_back(currentRow); @@ -936,7 +974,7 @@ void XrdProFile::xCom_storageclass(const std::vector<std::string> &tokens, const std::list<cta::common::dataStructures::StorageClass> list= m_scheduler->getStorageClasses(cliIdentity); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"storage class","number of copies","c.uid","c.gid","c.host","c.time","m.uid","m.gid","m.host","m.time","comment"}; + std::vector<std::string> header = {"storage class","number of copies","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -1002,7 +1040,7 @@ void XrdProFile::xCom_user(const std::vector<std::string> &tokens, const cta::co std::list<cta::common::dataStructures::User> list= m_scheduler->getUsers(cliIdentity); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"user","group","cta group","c.uid","c.gid","c.host","c.time","m.uid","m.gid","m.host","m.time","comment"}; + std::vector<std::string> header = {"user","group","cta group","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -1124,7 +1162,7 @@ void XrdProFile::xCom_mountgroup(const std::vector<std::string> &tokens, const c std::list<cta::common::dataStructures::MountGroup> list= m_scheduler->getMountGroups(cliIdentity); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"cta group","a.priority","a.minFiles","a.minBytes","a.minAge","r.priority","r.minFiles","r.minBytes","r.minAge","MaxDrives","c.uid","c.gid","c.host","c.time","m.uid","m.gid","m.host","m.time","comment"}; + std::vector<std::string> header = {"cta group","a.priority","a.minFiles","a.minBytes","a.minAge","r.priority","r.minFiles","r.minBytes","r.minAge","MaxDrives","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -1251,7 +1289,7 @@ void XrdProFile::xCom_dedication(const std::vector<std::string> &tokens, const c std::list<cta::common::dataStructures::Dedication> list= m_scheduler->getDedications(cliIdentity); if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"drive","type","vid","user group","tag","from","until","c.uid","c.gid","c.host","c.time","m.uid","m.gid","m.host","m.time","comment"}; + std::vector<std::string> header = {"drive","type","vid","user group","tag","from","until","c.name","c.group","c.host","c.time","m.name","m.group","m.host","m.time","comment"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow; @@ -1349,7 +1387,7 @@ void XrdProFile::xCom_repack(const std::vector<std::string> &tokens, const cta:: } if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"vid","files","size","type","tag","to retrieve","to archive","failed","archived","status","uid","gid","host","time"}; + std::vector<std::string> header = {"vid","files","size","type","tag","to retrieve","to archive","failed","archived","status","name","group","host","time"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::string type_s; @@ -1465,7 +1503,7 @@ void XrdProFile::xCom_verify(const std::vector<std::string> &tokens, const cta:: } if(list.size()>0) { std::vector<std::vector<std::string>> responseTable; - std::vector<std::string> header = {"vid","files","size","tag","to verify","failed","verified","status","uid","gid","host","time"}; + std::vector<std::string> header = {"vid","files","size","tag","to verify","failed","verified","status","name","group","host","time"}; if(hasOption(tokens, "-h", "--header")) responseTable.push_back(header); for(auto it = list.cbegin(); it != list.cend(); it++) { std::vector<std::string> currentRow;