diff --git a/catalogue/3.2/mysql_catalogue_schema.sql b/catalogue/3.2/mysql_catalogue_schema.sql index 2ed28352fbd5b344552ef50c387e6c2a787ec80c..f171d0dfb03922fe5f855bd22653abfe3a66978e 100644 --- a/catalogue/3.2/mysql_catalogue_schema.sql +++ b/catalogue/3.2/mysql_catalogue_schema.sql @@ -72,8 +72,8 @@ CREATE TABLE DISK_SYSTEM( CREATE TABLE VIRTUAL_ORGANIZATION( VIRTUAL_ORGANIZATION_ID BIGINT UNSIGNED CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL, VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL, - MAX_DRIVES_ALLOWED_FOR_READ BIGINT UNSIGNED, - MAX_DRIVES_ALLOWED_FOR_WRITE BIGINT UNSIGNED, + READ_MAX_DRIVES BIGINT UNSIGNED, + WRITE_MAX_DRIVES BIGINT UNSIGNED, USER_COMMENT VARCHAR(1000) CONSTRAINT VIRTUAL_ORGANIZATION_UC_NN NOT NULL, CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLUN_NN NOT NULL, CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLHN_NN NOT NULL, diff --git a/catalogue/3.2/oracle_catalogue_schema.sql b/catalogue/3.2/oracle_catalogue_schema.sql index 6cc11d92fe554bce8712a6b775687888d37b5951..a059bb9de69dc2c1e774ece8d9b1fa31a7c214d4 100644 --- a/catalogue/3.2/oracle_catalogue_schema.sql +++ b/catalogue/3.2/oracle_catalogue_schema.sql @@ -104,8 +104,8 @@ CREATE TABLE DISK_SYSTEM( CREATE TABLE VIRTUAL_ORGANIZATION( VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL, VIRTUAL_ORGANIZATION_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL, - MAX_DRIVES_ALLOWED_FOR_READ NUMERIC(20, 0), - MAX_DRIVES_ALLOWED_FOR_WRITE NUMERIC(20, 0), + READ_MAX_DRIVES NUMERIC(20, 0), + WRITE_MAX_DRIVES NUMERIC(20, 0), USER_COMMENT VARCHAR2(1000) CONSTRAINT VIRTUAL_ORGANIZATION_UC_NN NOT NULL, CREATION_LOG_USER_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLUN_NN NOT NULL, CREATION_LOG_HOST_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLHN_NN NOT NULL, diff --git a/catalogue/3.2/postgres_catalogue_schema.sql b/catalogue/3.2/postgres_catalogue_schema.sql index 5b70c819fd1b391997565ff01e07323b3dfad28d..b32e4cb139b2b694ed4a68ae53c12c98d051fcc1 100644 --- a/catalogue/3.2/postgres_catalogue_schema.sql +++ b/catalogue/3.2/postgres_catalogue_schema.sql @@ -86,8 +86,8 @@ CREATE TABLE DISK_SYSTEM( CREATE TABLE VIRTUAL_ORGANIZATION( VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL, VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL, - MAX_DRIVES_ALLOWED_FOR_READ NUMERIC(20, 0), - MAX_DRIVES_ALLOWED_FOR_WRITE NUMERIC(20, 0), + READ_MAX_DRIVES NUMERIC(20, 0), + WRITE_MAX_DRIVES NUMERIC(20, 0), USER_COMMENT VARCHAR(1000) CONSTRAINT VIRTUAL_ORGANIZATION_UC_NN NOT NULL, CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLUN_NN NOT NULL, CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLHN_NN NOT NULL, diff --git a/catalogue/3.2/sqlite_catalogue_schema.sql b/catalogue/3.2/sqlite_catalogue_schema.sql index 2bb3b3692ea6b501fe4f8943d3277a4fe03de619..f665836652c2669f64a1232219ef69441d442850 100644 --- a/catalogue/3.2/sqlite_catalogue_schema.sql +++ b/catalogue/3.2/sqlite_catalogue_schema.sql @@ -58,8 +58,8 @@ CREATE TABLE DISK_SYSTEM( CREATE TABLE VIRTUAL_ORGANIZATION( VIRTUAL_ORGANIZATION_ID INTEGER CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL, VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL, - MAX_DRIVES_ALLOWED_FOR_READ INTEGER, - MAX_DRIVES_ALLOWED_FOR_WRITE INTEGER, + READ_MAX_DRIVES INTEGER, + WRITE_MAX_DRIVES INTEGER, USER_COMMENT VARCHAR(1000) CONSTRAINT VIRTUAL_ORGANIZATION_UC_NN NOT NULL, CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLUN_NN NOT NULL, CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLHN_NN NOT NULL, diff --git a/catalogue/AllCatalogueSchema.hpp b/catalogue/AllCatalogueSchema.hpp index 23abac6fd2d64260ebad61b8f93446e15accc85d..05ebb5ffd582141fa637dda7a8b95c26d8f3de14 100644 --- a/catalogue/AllCatalogueSchema.hpp +++ b/catalogue/AllCatalogueSchema.hpp @@ -7062,8 +7062,8 @@ namespace catalogue{ "CREATE TABLE VIRTUAL_ORGANIZATION(" " VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL," " VIRTUAL_ORGANIZATION_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL," - " MAX_DRIVES_ALLOWED_FOR_READ NUMERIC(20, 0)," - " MAX_DRIVES_ALLOWED_FOR_WRITE NUMERIC(20, 0)," + " READ_MAX_DRIVES NUMERIC(20, 0)," + " WRITE_MAX_DRIVES NUMERIC(20, 0)," " USER_COMMENT VARCHAR2(1000) CONSTRAINT VIRTUAL_ORGANIZATION_UC_NN NOT NULL," " CREATION_LOG_USER_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLUN_NN NOT NULL," " CREATION_LOG_HOST_NAME VARCHAR2(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLHN_NN NOT NULL," @@ -7486,8 +7486,8 @@ namespace catalogue{ "CREATE TABLE VIRTUAL_ORGANIZATION(" " VIRTUAL_ORGANIZATION_ID BIGINT UNSIGNED CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL," " VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL," - " MAX_DRIVES_ALLOWED_FOR_READ BIGINT UNSIGNED," - " MAX_DRIVES_ALLOWED_FOR_WRITE BIGINT UNSIGNED," + " READ_MAX_DRIVES BIGINT UNSIGNED," + " WRITE_MAX_DRIVES BIGINT UNSIGNED," " USER_COMMENT VARCHAR(1000) CONSTRAINT VIRTUAL_ORGANIZATION_UC_NN NOT NULL," " CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLUN_NN NOT NULL," " CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLHN_NN NOT NULL," @@ -7895,8 +7895,8 @@ namespace catalogue{ "CREATE TABLE VIRTUAL_ORGANIZATION(" " VIRTUAL_ORGANIZATION_ID INTEGER CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL," " VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL," - " MAX_DRIVES_ALLOWED_FOR_READ INTEGER," - " MAX_DRIVES_ALLOWED_FOR_WRITE INTEGER," + " READ_MAX_DRIVES INTEGER," + " WRITE_MAX_DRIVES INTEGER," " USER_COMMENT VARCHAR(1000) CONSTRAINT VIRTUAL_ORGANIZATION_UC_NN NOT NULL," " CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLUN_NN NOT NULL," " CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLHN_NN NOT NULL," @@ -8330,8 +8330,8 @@ namespace catalogue{ "CREATE TABLE VIRTUAL_ORGANIZATION(" " VIRTUAL_ORGANIZATION_ID NUMERIC(20, 0) CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL," " VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL," - " MAX_DRIVES_ALLOWED_FOR_READ NUMERIC(20, 0)," - " MAX_DRIVES_ALLOWED_FOR_WRITE NUMERIC(20, 0)," + " READ_MAX_DRIVES NUMERIC(20, 0)," + " WRITE_MAX_DRIVES NUMERIC(20, 0)," " USER_COMMENT VARCHAR(1000) CONSTRAINT VIRTUAL_ORGANIZATION_UC_NN NOT NULL," " CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLUN_NN NOT NULL," " CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLHN_NN NOT NULL," diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp index e2c4456995de1b3a6ce14d1f537bc8ff66505cdf..3ae35b6c6381203864419e134e9b4752c46db66a 100644 --- a/catalogue/Catalogue.hpp +++ b/catalogue/Catalogue.hpp @@ -301,17 +301,17 @@ public: * Modifies the max number of allocated drives for read for the specified Virtual Organization * * @param voName the VO name - * @param maxDrivesAllowedForRead the new max number of allocated drives for read for the specified Virtual Organization + * @param readMaxDrives the new max number of allocated drives for read for the specified Virtual Organization */ - virtual void modifyVirtualOrganizationMaxDrivesAllowedForRead(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForRead) = 0; + virtual void modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t readMaxDrives) = 0; /** * Modifies the max number of allocated drives for write for the specified Virtual Organization * * @param voName the VO name - * @param maxDrivesAllowedForRead the new max number of allocated drives for write for the specified Virtual Organization + * @param writeMaxDrives the new max number of allocated drives for write for the specified Virtual Organization */ - virtual void modifyVirtualOrganizationMaxDrivesAllowedForWrite(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForWrite) = 0; + virtual void modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t writeMaxDrives) = 0; /** * Modifies the comment of the specified Virtual Organization diff --git a/catalogue/CatalogueRetryWrapper.hpp b/catalogue/CatalogueRetryWrapper.hpp index 00ddf49230ba565c5a6b1b2444d128c2addb648b..2c07da698ae1531b2a1023173633bc755f86a1c0 100644 --- a/catalogue/CatalogueRetryWrapper.hpp +++ b/catalogue/CatalogueRetryWrapper.hpp @@ -132,12 +132,12 @@ public: return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationName(admin,currentVoName,newVoName);}, m_maxTriesToConnect); } - void modifyVirtualOrganizationMaxDrivesAllowedForRead(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForRead) override { - return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationMaxDrivesAllowedForRead(admin,voName,maxDrivesAllowedForRead);}, m_maxTriesToConnect); + void modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForRead) override { + return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationReadMaxDrives(admin,voName,maxDrivesAllowedForRead);}, m_maxTriesToConnect); } - void modifyVirtualOrganizationMaxDrivesAllowedForWrite(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForWrite) override { - return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationMaxDrivesAllowedForWrite(admin,voName,maxDrivesAllowedForWrite);}, m_maxTriesToConnect); + void modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForWrite) override { + return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationWriteMaxDrives(admin,voName,maxDrivesAllowedForWrite);}, m_maxTriesToConnect); } diff --git a/catalogue/CatalogueTest.cpp b/catalogue/CatalogueTest.cpp index 40d144ddfc16ad73bb59602697a3cae34b9c664c..573e2543aa943ad5b4b4a8b50393cdd46d34eccc 100644 --- a/catalogue/CatalogueTest.cpp +++ b/catalogue/CatalogueTest.cpp @@ -75,8 +75,8 @@ namespace { common::dataStructures::VirtualOrganization vo; vo.name = "vo"; vo.comment = "Creation of virtual organization vo"; - vo.maxDrivesAllowedForRead = 1; - vo.maxDrivesAllowedForWrite = 1; + vo.readMaxDrives = 1; + vo.writeMaxDrives = 1; return vo; } @@ -14648,8 +14648,8 @@ TEST_P(cta_catalogue_CatalogueTest, getVirtualOrganizations) { auto &voRetrieved = vos.front(); ASSERT_EQ(vo.name,voRetrieved.name); - ASSERT_EQ(vo.maxDrivesAllowedForRead,voRetrieved.maxDrivesAllowedForRead); - ASSERT_EQ(vo.maxDrivesAllowedForWrite,voRetrieved.maxDrivesAllowedForWrite); + ASSERT_EQ(vo.readMaxDrives,voRetrieved.readMaxDrives); + ASSERT_EQ(vo.writeMaxDrives,voRetrieved.writeMaxDrives); ASSERT_EQ(vo.comment,voRetrieved.comment); ASSERT_EQ(m_admin.host,voRetrieved.creationLog.host); ASSERT_EQ(m_admin.username,voRetrieved.creationLog.username); @@ -14728,14 +14728,14 @@ TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationMaxDrivesAllowedFor ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); uint64_t newMaxDrivesAllowedForRead = 42; - ASSERT_NO_THROW(m_catalogue->modifyVirtualOrganizationMaxDrivesAllowedForRead(m_admin,vo.name,newMaxDrivesAllowedForRead)); + ASSERT_NO_THROW(m_catalogue->modifyVirtualOrganizationReadMaxDrives(m_admin,vo.name,newMaxDrivesAllowedForRead)); auto vos = m_catalogue->getVirtualOrganizations(); auto &frontVo = vos.front(); - ASSERT_EQ(newMaxDrivesAllowedForRead,frontVo.maxDrivesAllowedForRead); + ASSERT_EQ(newMaxDrivesAllowedForRead,frontVo.readMaxDrives); - ASSERT_THROW(m_catalogue->modifyVirtualOrganizationMaxDrivesAllowedForRead(m_admin,"DOES not exists",newMaxDrivesAllowedForRead),cta::exception::UserError); + ASSERT_THROW(m_catalogue->modifyVirtualOrganizationReadMaxDrives(m_admin,"DOES not exists",newMaxDrivesAllowedForRead),cta::exception::UserError); } TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationMaxDrivesAllowedForWrite) { @@ -14746,14 +14746,14 @@ TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationMaxDrivesAllowedFor ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo)); uint64_t newMaxDrivesAllowedForWrite = 42; - ASSERT_NO_THROW(m_catalogue->modifyVirtualOrganizationMaxDrivesAllowedForWrite(m_admin,vo.name,newMaxDrivesAllowedForWrite)); + ASSERT_NO_THROW(m_catalogue->modifyVirtualOrganizationWriteMaxDrives(m_admin,vo.name,newMaxDrivesAllowedForWrite)); auto vos = m_catalogue->getVirtualOrganizations(); auto &frontVo = vos.front(); - ASSERT_EQ(newMaxDrivesAllowedForWrite,frontVo.maxDrivesAllowedForWrite); + ASSERT_EQ(newMaxDrivesAllowedForWrite,frontVo.writeMaxDrives); - ASSERT_THROW(m_catalogue->modifyVirtualOrganizationMaxDrivesAllowedForWrite(m_admin,"DOES not exists",newMaxDrivesAllowedForWrite),cta::exception::UserError); + ASSERT_THROW(m_catalogue->modifyVirtualOrganizationWriteMaxDrives(m_admin,"DOES not exists",newMaxDrivesAllowedForWrite),cta::exception::UserError); } TEST_P(cta_catalogue_CatalogueTest, updateDiskFileId) { diff --git a/catalogue/DummyCatalogue.hpp b/catalogue/DummyCatalogue.hpp index fe200298b568bcb289ed35681d72d35ecc315d62..1f12463f2b87f442fb6ecdbb780dde517e05bf68 100644 --- a/catalogue/DummyCatalogue.hpp +++ b/catalogue/DummyCatalogue.hpp @@ -107,8 +107,8 @@ public: void deleteVirtualOrganization(const std::string &voName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } std::list<common::dataStructures::VirtualOrganization> getVirtualOrganizations() const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void modifyVirtualOrganizationName(const common::dataStructures::SecurityIdentity &admin, const std::string ¤tVoName, const std::string &newVoName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } - void modifyVirtualOrganizationMaxDrivesAllowedForRead(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForRead) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } - void modifyVirtualOrganizationMaxDrivesAllowedForWrite(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForWrite) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } + void modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForRead) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } + void modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForWrite) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void modifyVirtualOrganizationComment(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void modifyArchiveRouteComment(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void modifyArchiveRouteTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& tapePoolName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp index 6dbf5fc30b161cb6ebc4e805583f2532c6b24585..f4100434b60d121fe11aeb6177b33a774e40db5b 100644 --- a/catalogue/RdbmsCatalogue.cpp +++ b/catalogue/RdbmsCatalogue.cpp @@ -326,8 +326,8 @@ void RdbmsCatalogue::createVirtualOrganization(const common::dataStructures::Sec "VIRTUAL_ORGANIZATION_ID," "VIRTUAL_ORGANIZATION_NAME," - "MAX_DRIVES_ALLOWED_FOR_READ," - "MAX_DRIVES_ALLOWED_FOR_WRITE," + "READ_MAX_DRIVES," + "WRITE_MAX_DRIVES," "USER_COMMENT," @@ -341,8 +341,8 @@ void RdbmsCatalogue::createVirtualOrganization(const common::dataStructures::Sec "VALUES(" ":VIRTUAL_ORGANIZATION_ID," ":VIRTUAL_ORGANIZATION_NAME," - ":MAX_DRIVES_ALLOWED_FOR_READ," - ":MAX_DRIVES_ALLOWED_FOR_WRITE," + ":READ_MAX_DRIVES," + ":WRITE_MAX_DRIVES," ":USER_COMMENT," @@ -358,8 +358,8 @@ void RdbmsCatalogue::createVirtualOrganization(const common::dataStructures::Sec stmt.bindUint64(":VIRTUAL_ORGANIZATION_ID", virtualOrganizationId); stmt.bindString(":VIRTUAL_ORGANIZATION_NAME", vo.name); - stmt.bindUint64(":MAX_DRIVES_ALLOWED_FOR_READ",vo.maxDrivesAllowedForRead); - stmt.bindUint64(":MAX_DRIVES_ALLOWED_FOR_WRITE",vo.maxDrivesAllowedForWrite); + stmt.bindUint64(":READ_MAX_DRIVES",vo.readMaxDrives); + stmt.bindUint64(":WRITE_MAX_DRIVES",vo.writeMaxDrives); stmt.bindString(":USER_COMMENT", vo.comment); @@ -430,8 +430,8 @@ std::list<common::dataStructures::VirtualOrganization> RdbmsCatalogue::getVirtua "SELECT " "VIRTUAL_ORGANIZATION_NAME AS VIRTUAL_ORGANIZATION_NAME," - "MAX_DRIVES_ALLOWED_FOR_READ AS MAX_DRIVES_ALLOWED_FOR_READ," - "MAX_DRIVES_ALLOWED_FOR_WRITE AS MAX_DRIVES_ALLOWED_FOR_WRITE," + "READ_MAX_DRIVES AS READ_MAX_DRIVES," + "WRITE_MAX_DRIVES AS WRITE_MAX_DRIVES," "USER_COMMENT AS USER_COMMENT," @@ -454,8 +454,8 @@ std::list<common::dataStructures::VirtualOrganization> RdbmsCatalogue::getVirtua virtualOrganization.name = rset.columnString("VIRTUAL_ORGANIZATION_NAME"); - virtualOrganization.maxDrivesAllowedForRead = rset.columnUint64("MAX_DRIVES_ALLOWED_FOR_READ"); - virtualOrganization.maxDrivesAllowedForWrite = rset.columnUint64("MAX_DRIVES_ALLOWED_FOR_WRITE"); + virtualOrganization.readMaxDrives = rset.columnUint64("READ_MAX_DRIVES"); + virtualOrganization.writeMaxDrives = rset.columnUint64("WRITE_MAX_DRIVES"); virtualOrganization.comment = rset.columnString("USER_COMMENT"); virtualOrganization.creationLog.username = rset.columnString("CREATION_LOG_USER_NAME"); virtualOrganization.creationLog.host = rset.columnString("CREATION_LOG_HOST_NAME"); @@ -516,12 +516,12 @@ void RdbmsCatalogue::modifyVirtualOrganizationName(const common::dataStructures: } } -void RdbmsCatalogue::modifyVirtualOrganizationMaxDrivesAllowedForRead(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForRead){ +void RdbmsCatalogue::modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForRead){ try { const time_t now = time(nullptr); const char *const sql = "UPDATE VIRTUAL_ORGANIZATION SET " - "MAX_DRIVES_ALLOWED_FOR_READ = :MAX_DRIVES_ALLOWED_FOR_READ," + "READ_MAX_DRIVES = :READ_MAX_DRIVES," "LAST_UPDATE_USER_NAME = :LAST_UPDATE_USER_NAME," "LAST_UPDATE_HOST_NAME = :LAST_UPDATE_HOST_NAME," "LAST_UPDATE_TIME = :LAST_UPDATE_TIME " @@ -530,7 +530,7 @@ void RdbmsCatalogue::modifyVirtualOrganizationMaxDrivesAllowedForRead(const comm auto conn = m_connPool.getConn(); auto stmt = conn.createStmt(sql); - stmt.bindUint64(":MAX_DRIVES_ALLOWED_FOR_READ", maxDrivesAllowedForRead); + stmt.bindUint64(":READ_MAX_DRIVES", maxDrivesAllowedForRead); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); stmt.bindUint64(":LAST_UPDATE_TIME", now); @@ -549,12 +549,12 @@ void RdbmsCatalogue::modifyVirtualOrganizationMaxDrivesAllowedForRead(const comm } } -void RdbmsCatalogue::modifyVirtualOrganizationMaxDrivesAllowedForWrite(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForWrite){ +void RdbmsCatalogue::modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForWrite){ try { const time_t now = time(nullptr); const char *const sql = "UPDATE VIRTUAL_ORGANIZATION SET " - "MAX_DRIVES_ALLOWED_FOR_WRITE = :MAX_DRIVES_ALLOWED_FOR_WRITE," + "WRITE_MAX_DRIVES = :WRITE_MAX_DRIVES," "LAST_UPDATE_USER_NAME = :LAST_UPDATE_USER_NAME," "LAST_UPDATE_HOST_NAME = :LAST_UPDATE_HOST_NAME," "LAST_UPDATE_TIME = :LAST_UPDATE_TIME " @@ -563,7 +563,7 @@ void RdbmsCatalogue::modifyVirtualOrganizationMaxDrivesAllowedForWrite(const com auto conn = m_connPool.getConn(); auto stmt = conn.createStmt(sql); - stmt.bindUint64(":MAX_DRIVES_ALLOWED_FOR_WRITE", maxDrivesAllowedForWrite); + stmt.bindUint64(":WRITE_MAX_DRIVES", maxDrivesAllowedForWrite); stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username); stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host); stmt.bindUint64(":LAST_UPDATE_TIME", now); diff --git a/catalogue/RdbmsCatalogue.hpp b/catalogue/RdbmsCatalogue.hpp index 8c1882156b93e98c2797ebe28f37b5ef059f0b4e..4249389cda91ca9dd38cf135f149480e9abed5e5 100644 --- a/catalogue/RdbmsCatalogue.hpp +++ b/catalogue/RdbmsCatalogue.hpp @@ -249,17 +249,17 @@ public: * Modifies the max number of allocated drives for read for the specified Virtual Organization * * @param voName the VO name - * @param maxDrivesAllowedForRead the new max number of allocated drives for read for the specified Virtual Organization + * @param readMaxDrives the new max number of allocated drives for read for the specified Virtual Organization */ - void modifyVirtualOrganizationMaxDrivesAllowedForRead(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForRead) override; + void modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t readMaxDrives) override; /** * Modifies the max number of allocated drives for write for the specified Virtual Organization * * @param voName the VO name - * @param maxDrivesAllowedForRead the new max number of allocated drives for write for the specified Virtual Organization + * @param writeMaxDrives the new max number of allocated drives for write for the specified Virtual Organization */ - void modifyVirtualOrganizationMaxDrivesAllowedForWrite(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxDrivesAllowedForWrite) override; + void modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t writeMaxDrives) override; /** * Modifies the comment of the specified Virtual Organization * diff --git a/catalogue/common_catalogue_schema.sql b/catalogue/common_catalogue_schema.sql index b0e5dac491b6ffca8466c34adf7e3f8c421fa113..9e09ce91730107e76188e9d842cd347f03e686da 100644 --- a/catalogue/common_catalogue_schema.sql +++ b/catalogue/common_catalogue_schema.sql @@ -37,8 +37,8 @@ CREATE TABLE DISK_SYSTEM( CREATE TABLE VIRTUAL_ORGANIZATION( VIRTUAL_ORGANIZATION_ID UINT64TYPE CONSTRAINT VIRTUAL_ORGANIZATION_VOI_NN NOT NULL, VIRTUAL_ORGANIZATION_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_VON_NN NOT NULL, - MAX_DRIVES_ALLOWED_FOR_READ UINT64TYPE, - MAX_DRIVES_ALLOWED_FOR_WRITE UINT64TYPE, + READ_MAX_DRIVES UINT64TYPE, + WRITE_MAX_DRIVES UINT64TYPE, USER_COMMENT VARCHAR(1000) CONSTRAINT VIRTUAL_ORGANIZATION_UC_NN NOT NULL, CREATION_LOG_USER_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLUN_NN NOT NULL, CREATION_LOG_HOST_NAME VARCHAR(100) CONSTRAINT VIRTUAL_ORGANIZATION_CLHN_NN NOT NULL, diff --git a/cmdline/CtaAdminCmdParse.hpp b/cmdline/CtaAdminCmdParse.hpp index 5107826bae19b337491bc0cc91dda9e5e49ffda2..1906f63bdd7d721cf71b56aae7a6359aebcdc03b 100644 --- a/cmdline/CtaAdminCmdParse.hpp +++ b/cmdline/CtaAdminCmdParse.hpp @@ -290,6 +290,8 @@ const std::map<std::string, OptionUInt64::Key> uint64Options = { { "--refreshinterval", OptionUInt64::REFRESH_INTERVAL }, { "--targetedfreespace", OptionUInt64::TARGETED_FREE_SPACE }, { "--sleeptime", OptionUInt64::SLEEP_TIME }, + { "--readmaxdrives", OptionUInt64::READ_MAX_DRIVES }, + { "--writemaxdrives", OptionUInt64::WRITE_MAX_DRIVES }, }; @@ -396,7 +398,15 @@ const std::map<AdminCmd::Cmd, CmdHelp> cmdHelp = { " If the targeted free space is reach, the queue will sleep during this amount of seconds." "\n\n" }}, - { AdminCmd::CMD_VIRTUALORGANIZATION, { "virtualorganization", "vo", { "add", "ch", "rm", "ls" } }}, + { AdminCmd::CMD_VIRTUALORGANIZATION, { "virtualorganization", "vo", { "add", "ch", "rm", "ls" }, + "\n This command allows to manage virtual organizations.\n" + " Add a virtual organization by using the \"add\" subcommand:\n" + " * Specify the name (--vo) of the virtual organization. It must be unique.\n" + " * Specify the maximum number of drives the virtual organization is allowed to use for writing with the --writemaxdrives parameter\n" + " * Specify the maximum number of drives the virtual organization is allowed to use for reading with the --readmaxdrives parameter\n" + " * Specify the comment (--comment) associated to the virtual organization" + "\n\n" + }}, { AdminCmd::CMD_VERSION, { "version", "v", { } }}, { AdminCmd::CMD_SCHEDULINGINFOS, { "schedulinginfo", "si", { "ls" } }}, { AdminCmd::CMD_RECYCLETAPEFILE, { "recycletf", "rtf", { "ls" }, @@ -474,6 +484,8 @@ const Option opt_sleep_time { Option::OPT_UINT, "--sleeptime", const Option opt_reason { Option::OPT_STR, "--reason", "-r", " <reason_status_change>" }; const Option opt_no_recall { Option::OPT_FLAG, "--no-recall", "-nr", "" }; const Option opt_object_id { Option::OPT_STR, "--objectid", "-o", " <objectId>" }; +const Option opt_read_max_drives { Option::OPT_UINT, "--readmaxdrives", "-rmd", " <read_max_drives>" }; +const Option opt_write_max_drives { Option::OPT_UINT, "--writemaxdrives", "-wmd", " <write_max_drives>" }; const Option opt_state { Option::OPT_STR, "--state", "-s", std::string(" <\"") + Tape::stateToString(Tape::ACTIVE) +"\"" + " or \"" + Tape::stateToString(Tape::DISABLED) + "\" or \"" + Tape::stateToString(Tape::BROKEN) + "\">" }; @@ -594,9 +606,9 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = { {{ AdminCmd::CMD_DISKSYSTEM, AdminCmd::SUBCMD_RM }, { opt_disksystem }}, {{ AdminCmd::CMD_DISKSYSTEM, AdminCmd::SUBCMD_LS }, { }}, {{ AdminCmd::CMD_VIRTUALORGANIZATION, AdminCmd::SUBCMD_ADD }, - { opt_vo, opt_comment }}, + { opt_vo, opt_read_max_drives, opt_write_max_drives, opt_comment }}, {{ AdminCmd::CMD_VIRTUALORGANIZATION, AdminCmd::SUBCMD_CH }, - { opt_vo, opt_comment }}, + { opt_vo, opt_comment.optional(), opt_read_max_drives.optional(), opt_write_max_drives.optional() }}, {{ AdminCmd::CMD_VIRTUALORGANIZATION, AdminCmd::SUBCMD_RM }, { opt_vo }}, {{ AdminCmd::CMD_VIRTUALORGANIZATION, AdminCmd::SUBCMD_LS }, diff --git a/cmdline/CtaAdminTextFormatter.cpp b/cmdline/CtaAdminTextFormatter.cpp index e0eec7d3a047136eccf03dfba0048c1c191fbf4f..98622ec00b1ebf44d28a2a9bae45fd4887f1b14c 100644 --- a/cmdline/CtaAdminTextFormatter.cpp +++ b/cmdline/CtaAdminTextFormatter.cpp @@ -991,6 +991,8 @@ void TextFormatter::printVirtualOrganizationLsHeader(){ push_back("HEADER"); push_back( "name", + "read max drives", + "write max drives", "c.user", "c.host", "c.time", @@ -1004,6 +1006,8 @@ void TextFormatter::printVirtualOrganizationLsHeader(){ void TextFormatter::print(const VirtualOrganizationLsItem& vols_item){ push_back( vols_item.name(), + vols_item.read_max_drives(), + vols_item.write_max_drives(), vols_item.creation_log().username(), vols_item.creation_log().host(), timeToStr(vols_item.creation_log().time()), diff --git a/common/dataStructures/VirtualOrganization.hpp b/common/dataStructures/VirtualOrganization.hpp index 0b4cefb57936ae083848ed7dbc1b05b13bed54fd..ea746a39d91b9542c98bb1bc29e621cc3383eb43 100644 --- a/common/dataStructures/VirtualOrganization.hpp +++ b/common/dataStructures/VirtualOrganization.hpp @@ -35,13 +35,13 @@ struct VirtualOrganization { */ std::string comment; /** - * Max number of drives allocated for writing per VO + * Maximum number of drives allocated for reading per VO */ - uint64_t maxDrivesAllowedForWrite; + uint64_t readMaxDrives; /** - * Maximum number of drives allocated for reading per VO + * Max number of drives allocated for writing per VO */ - uint64_t maxDrivesAllowedForRead; + uint64_t writeMaxDrives; /** * The creation log. */ diff --git a/continuousintegration/orchestration/tests/prepare_tests.sh b/continuousintegration/orchestration/tests/prepare_tests.sh index 2ad8baae4293371f466c92939d308dc42bfd4976..196d86310e3f6db84c8c1947b9cf0894ca15dbba 100755 --- a/continuousintegration/orchestration/tests/prepare_tests.sh +++ b/continuousintegration/orchestration/tests/prepare_tests.sh @@ -108,6 +108,8 @@ kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin --json version | jq kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin virtualorganization add \ --vo vo \ + --readmaxdrives 1 \ + --writemaxdrives 1 \ --comment "vo" kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin tapepool add \ --name ctasystest \ diff --git a/xroot_plugins/XrdCtaVirtualOrganizationLs.hpp b/xroot_plugins/XrdCtaVirtualOrganizationLs.hpp index 0a1cb57a4fa82ce175a54f5907b8c4c65b0c5cf0..602e9b527e93286b4b80f8151eebdeb85d74d883 100644 --- a/xroot_plugins/XrdCtaVirtualOrganizationLs.hpp +++ b/xroot_plugins/XrdCtaVirtualOrganizationLs.hpp @@ -76,6 +76,8 @@ int VirtualOrganizationLsStream::fillBuffer(XrdSsiPb::OStreamBuffer<Data> *strea auto vo_item = record.mutable_vols_item(); vo_item->set_name(vo.name); + vo_item->set_read_max_drives(vo.readMaxDrives); + vo_item->set_write_max_drives(vo.writeMaxDrives); vo_item->mutable_creation_log()->set_username(vo.creationLog.username); vo_item->mutable_creation_log()->set_host(vo.creationLog.host); vo_item->mutable_creation_log()->set_time(vo.creationLog.time); diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.cpp b/xroot_plugins/XrdSsiCtaRequestMessage.cpp index f59b3618e8f0022c382db10bb75c1de946ca2231..1b20d29320c0da87876011fb3d1df40abb0486c9 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.cpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.cpp @@ -2039,10 +2039,14 @@ void RequestMessage::processVirtualOrganization_Add(cta::xrd::Response &response using namespace cta::admin; const auto &name = getRequired(OptionString::VO); + const auto &readMaxDrives = getRequired(OptionUInt64::READ_MAX_DRIVES); + const auto &writeMaxDrives = getRequired(OptionUInt64::WRITE_MAX_DRIVES); const auto &comment = getRequired(OptionString::COMMENT); cta::common::dataStructures::VirtualOrganization vo; vo.name = name; + vo.readMaxDrives = readMaxDrives; + vo.writeMaxDrives = writeMaxDrives; vo.comment = comment; m_catalogue.createVirtualOrganization(m_cliIdentity,vo); @@ -2054,9 +2058,18 @@ void RequestMessage::processVirtualOrganization_Ch(cta::xrd::Response &response) using namespace cta::admin; const auto &name = getRequired(OptionString::VO); - const auto &comment = getRequired(OptionString::COMMENT); + const auto readMaxDrives = getOptional(OptionUInt64::READ_MAX_DRIVES); + const auto writeMaxDrives = getOptional(OptionUInt64::WRITE_MAX_DRIVES); + const auto comment = getOptional(OptionString::COMMENT); + + if(comment) + m_catalogue.modifyVirtualOrganizationComment(m_cliIdentity,name,comment.value()); + + if(readMaxDrives) + m_catalogue.modifyVirtualOrganizationReadMaxDrives(m_cliIdentity,name,readMaxDrives.value()); - m_catalogue.modifyVirtualOrganizationComment(m_cliIdentity,name,comment); + if(writeMaxDrives) + m_catalogue.modifyVirtualOrganizationWriteMaxDrives(m_cliIdentity,name,writeMaxDrives.value()); response.set_type(cta::xrd::Response::RSP_SUCCESS); } diff --git a/xrootd-ssi-protobuf-interface b/xrootd-ssi-protobuf-interface index 2e446b975ee7b02b6294933be3a3de05c926d558..511cc4ae58d813d94bc531302f4f3ae0af172115 160000 --- a/xrootd-ssi-protobuf-interface +++ b/xrootd-ssi-protobuf-interface @@ -1 +1 @@ -Subproject commit 2e446b975ee7b02b6294933be3a3de05c926d558 +Subproject commit 511cc4ae58d813d94bc531302f4f3ae0af172115