Commit 459c5b58 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[catalogue + objectstore] Removed the MountPolicy maxDrivesAllowed management and usages

parent 455b3104
......@@ -798,7 +798,6 @@ public:
virtual void modifyMountPolicyArchiveMinRequestAge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t minArchiveRequestAge) = 0;
virtual void modifyMountPolicyRetrievePriority(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t retrievePriority) = 0;
virtual void modifyMountPolicyRetrieveMinRequestAge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t minRetrieveRequestAge) = 0;
virtual void modifyMountPolicyMaxDrivesAllowed(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t maxDrivesAllowed) = 0;
virtual void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) = 0;
virtual void createActivitiesFairShareWeight(const common::dataStructures::SecurityIdentity &admin, const std::string & diskInstanceName, const std::string & acttivity,
......
......@@ -140,12 +140,12 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationName(admin,currentVoName,newVoName);}, 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 modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t readMaxDrives) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationReadMaxDrives(admin,voName,readMaxDrives);}, 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);
void modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t writeMaxDrives) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationWriteMaxDrives(admin,voName,writeMaxDrives);}, m_maxTriesToConnect);
}
......@@ -470,10 +470,6 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyRetrieveMinRequestAge(admin, name, minRetrieveRequestAge);}, m_maxTriesToConnect);
}
void modifyMountPolicyMaxDrivesAllowed(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t maxDrivesAllowed) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyMaxDrivesAllowed(admin, name, maxDrivesAllowed);}, m_maxTriesToConnect);
}
void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyComment(admin, name, comment);}, m_maxTriesToConnect);
}
......
......@@ -152,7 +152,6 @@ namespace {
mountPolicy.minArchiveRequestAge = 2;
mountPolicy.retrievePriority = 3;
mountPolicy.minRetrieveRequestAge = 4;
mountPolicy.maxDrivesAllowed = 5;
mountPolicy.comment = "Create mount policy";
return mountPolicy;
}
......@@ -6422,8 +6421,6 @@ TEST_P(cta_catalogue_CatalogueTest, createMountPolicy) {
ASSERT_EQ(mountPolicyToAdd.retrievePriority, mountPolicy.retrievePriority);
ASSERT_EQ(mountPolicyToAdd.minRetrieveRequestAge, mountPolicy.retrieveMinRequestAge);
 
ASSERT_EQ(mountPolicyToAdd.maxDrivesAllowed, mountPolicy.maxDrivesAllowed);
ASSERT_EQ(mountPolicyToAdd.comment, mountPolicy.comment);
 
const common::dataStructures::EntryLog creationLog = mountPolicy.creationLog;
......@@ -6617,43 +6614,6 @@ TEST_P(cta_catalogue_CatalogueTest, modifyMountPolicyRetrieveMinRequestAge_nonEx
ASSERT_THROW(m_catalogue->modifyMountPolicyRetrieveMinRequestAge(m_admin, name, minRetrieveRequestAge), exception::UserError);
}
 
TEST_P(cta_catalogue_CatalogueTest, modifyMountPolicyMaxDrivesAllowed) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getMountPolicies().empty());
auto mountPolicyToAdd = getMountPolicy1();
std::string mountPolicyName = mountPolicyToAdd.name;
m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd);
const uint64_t modifiedMaxDrivesAllowed = mountPolicyToAdd.maxDrivesAllowed + 10;
m_catalogue->modifyMountPolicyMaxDrivesAllowed(m_admin, mountPolicyName, modifiedMaxDrivesAllowed);
{
const std::list<common::dataStructures::MountPolicy> mountPolicies = m_catalogue->getMountPolicies();
ASSERT_EQ(1, mountPolicies.size());
const common::dataStructures::MountPolicy mountPolicy = mountPolicies.front();
ASSERT_EQ(modifiedMaxDrivesAllowed, mountPolicy.maxDrivesAllowed);
const common::dataStructures::EntryLog modificationLog = mountPolicy.lastModificationLog;
ASSERT_EQ(m_admin.username, modificationLog.username);
ASSERT_EQ(m_admin.host, modificationLog.host);
}
}
TEST_P(cta_catalogue_CatalogueTest, modifyMountPolicyMaxDrivesAllowed_nonExistentMountPolicy) {
using namespace cta;
ASSERT_TRUE(m_catalogue->getMountPolicies().empty());
const std::string name = "mount_policy";
const uint64_t maxDrivesAllowed = 2;
ASSERT_THROW(m_catalogue->modifyMountPolicyMaxDrivesAllowed(m_admin, name, maxDrivesAllowed), exception::UserError);
}
TEST_P(cta_catalogue_CatalogueTest, modifyMountPolicyComment) {
using namespace cta;
 
......@@ -8014,7 +7974,6 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId) {
auto mountPolicyToAdd = getMountPolicy1();
std::string mountPolicyName = mountPolicyToAdd.name;
uint64_t minArchiveRequestAge = mountPolicyToAdd.minArchiveRequestAge;
uint64_t maxDrivesAllowed = mountPolicyToAdd.maxDrivesAllowed;
uint64_t archivePriority = mountPolicyToAdd.archivePriority;
m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd);
 
......@@ -8046,7 +8005,6 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId) {
ASSERT_EQ(2, queueCriteria.archiveFile.tapeFiles.size());
ASSERT_EQ(archivePriority, queueCriteria.mountPolicy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, queueCriteria.mountPolicy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, queueCriteria.mountPolicy.maxDrivesAllowed);
 
// Check that the diskInstanceName mismatch detection works
ASSERT_THROW(m_catalogue->prepareToRetrieveFile(diskInstanceName2, archiveFileId, requesterIdentity, cta::nullopt, dummyLc),
......@@ -8241,7 +8199,6 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_disa
auto mountPolicyToAdd = getMountPolicy1();
std::string mountPolicyName = mountPolicyToAdd.name;
uint64_t minArchiveRequestAge = mountPolicyToAdd.minArchiveRequestAge;
uint64_t maxDrivesAllowed = mountPolicyToAdd.maxDrivesAllowed;
uint64_t archivePriority = mountPolicyToAdd.archivePriority;
m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd);
 
......@@ -8274,7 +8231,6 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_disa
 
ASSERT_EQ(archivePriority, queueCriteria.mountPolicy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, queueCriteria.mountPolicy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, queueCriteria.mountPolicy.maxDrivesAllowed);
 
ASSERT_EQ(2, queueCriteria.archiveFile.tapeFiles.size());
 
......@@ -8304,7 +8260,6 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_disa
 
ASSERT_EQ(archivePriority, queueCriteria.mountPolicy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, queueCriteria.mountPolicy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, queueCriteria.mountPolicy.maxDrivesAllowed);
 
ASSERT_EQ(1, queueCriteria.archiveFile.tapeFiles.size());
 
......@@ -8400,7 +8355,6 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_retu
auto mountPolicyToAdd = getMountPolicy1();
std::string mountPolicyName = mountPolicyToAdd.name;
uint64_t minArchiveRequestAge = mountPolicyToAdd.minArchiveRequestAge;
uint64_t maxDrivesAllowed = mountPolicyToAdd.maxDrivesAllowed;
uint64_t archivePriority = mountPolicyToAdd.archivePriority;
m_catalogue->createMountPolicy(m_admin,mountPolicyToAdd);
 
......@@ -8420,7 +8374,6 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFileUsingArchiveFileId_retu
 
ASSERT_EQ(archivePriority, queueCriteria.mountPolicy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, queueCriteria.mountPolicy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, queueCriteria.mountPolicy.maxDrivesAllowed);
 
ASSERT_EQ(1, queueCriteria.archiveFile.tapeFiles.size());
 
......@@ -14720,40 +14673,40 @@ TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationComment) {
ASSERT_THROW(m_catalogue->modifyVirtualOrganizationComment(m_admin,"DOES not exists","COMMENT_DOES_NOT_EXIST"),cta::exception::UserError);
}
 
TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationMaxDrivesAllowedForRead) {
TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationReadMaxDrives) {
using namespace cta;
common::dataStructures::VirtualOrganization vo = getVo();
ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo));
 
uint64_t newMaxDrivesAllowedForRead = 42;
ASSERT_NO_THROW(m_catalogue->modifyVirtualOrganizationReadMaxDrives(m_admin,vo.name,newMaxDrivesAllowedForRead));
uint64_t readMaxDrives = 42;
ASSERT_NO_THROW(m_catalogue->modifyVirtualOrganizationReadMaxDrives(m_admin,vo.name,readMaxDrives));
auto vos = m_catalogue->getVirtualOrganizations();
auto &frontVo = vos.front();
ASSERT_EQ(newMaxDrivesAllowedForRead,frontVo.readMaxDrives);
ASSERT_EQ(readMaxDrives,frontVo.readMaxDrives);
ASSERT_THROW(m_catalogue->modifyVirtualOrganizationReadMaxDrives(m_admin,"DOES not exists",newMaxDrivesAllowedForRead),cta::exception::UserError);
ASSERT_THROW(m_catalogue->modifyVirtualOrganizationReadMaxDrives(m_admin,"DOES not exists",readMaxDrives),cta::exception::UserError);
}
 
TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationMaxDrivesAllowedForWrite) {
TEST_P(cta_catalogue_CatalogueTest, modifyVirtualOrganizationWriteMaxDrives) {
using namespace cta;
common::dataStructures::VirtualOrganization vo = getVo();
ASSERT_NO_THROW(m_catalogue->createVirtualOrganization(m_admin,vo));
uint64_t newMaxDrivesAllowedForWrite = 42;
ASSERT_NO_THROW(m_catalogue->modifyVirtualOrganizationWriteMaxDrives(m_admin,vo.name,newMaxDrivesAllowedForWrite));
uint64_t writeMaxDrives = 42;
ASSERT_NO_THROW(m_catalogue->modifyVirtualOrganizationWriteMaxDrives(m_admin,vo.name,writeMaxDrives));
auto vos = m_catalogue->getVirtualOrganizations();
auto &frontVo = vos.front();
ASSERT_EQ(newMaxDrivesAllowedForWrite,frontVo.writeMaxDrives);
ASSERT_EQ(writeMaxDrives,frontVo.writeMaxDrives);
ASSERT_THROW(m_catalogue->modifyVirtualOrganizationWriteMaxDrives(m_admin,"DOES not exists",newMaxDrivesAllowedForWrite),cta::exception::UserError);
ASSERT_THROW(m_catalogue->modifyVirtualOrganizationWriteMaxDrives(m_admin,"DOES not exists",writeMaxDrives),cta::exception::UserError);
}
 
TEST_P(cta_catalogue_CatalogueTest, getVirtualOrganizationOfTapepool) {
......
......@@ -32,7 +32,6 @@ namespace catalogue {
uint64_t minArchiveRequestAge;
uint64_t retrievePriority;
uint64_t minRetrieveRequestAge;
uint64_t maxDrivesAllowed;
std::string comment;
};
......
......@@ -109,8 +109,8 @@ public:
common::dataStructures::VirtualOrganization getVirtualOrganizationOfTapepool(const std::string & tapepoolName) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
common::dataStructures::VirtualOrganization getCachedVirtualOrganizationOfTapepool(const std::string & tapepoolName) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyVirtualOrganizationName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentVoName, const std::string &newVoName) 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 modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t readMaxDrives) 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 writeMaxDrives) 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"); }
......@@ -120,7 +120,6 @@ public:
void modifyMountPolicyArchiveMinRequestAge(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t minArchiveRequestAge) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyMountPolicyArchivePriority(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t archivePriority) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyMountPolicyMaxDrivesAllowed(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t maxDrivesAllowed) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyMountPolicyRetrieveMinRequestAge(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t minRetrieveRequestAge) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyMountPolicyRetrievePriority(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t retrievePriority) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyRequesteMountRuleComment(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
......@@ -200,7 +199,6 @@ public:
mp1.archiveMinRequestAge = 0;
mp1.retrievePriority = 1;
mp1.retrieveMinRequestAge = 0;
mp1.maxDrivesAllowed = 10;
mountPolicies.push_back(mp1);
common::dataStructures::MountPolicy mp2;
......@@ -209,7 +207,6 @@ public:
mp2.archiveMinRequestAge = 0;
mp2.retrievePriority = 2;
mp2.retrieveMinRequestAge = 0;
mp2.maxDrivesAllowed = 10;
mountPolicies.push_back(mp1);
return mountPolicies;
}
......@@ -222,7 +219,6 @@ public:
mp1.archiveMinRequestAge = 0;
mp1.retrievePriority = 1;
mp1.retrieveMinRequestAge = 0;
mp1.maxDrivesAllowed = 10;
mountPolicies.push_back(mp1);
common::dataStructures::MountPolicy mp2;
......@@ -231,7 +227,6 @@ public:
mp2.archiveMinRequestAge = 0;
mp2.retrievePriority = 2;
mp2.retrieveMinRequestAge = 0;
mp2.maxDrivesAllowed = 10;
mountPolicies.push_back(mp1);
return mountPolicies;
}
......
......@@ -614,7 +614,7 @@ void RdbmsCatalogue::modifyVirtualOrganizationName(const common::dataStructures:
}
}
void RdbmsCatalogue::modifyVirtualOrganizationReadMaxDrives(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 readMaxDrives){
try {
const time_t now = time(nullptr);
const char *const sql =
......@@ -628,7 +628,7 @@ void RdbmsCatalogue::modifyVirtualOrganizationReadMaxDrives(const common::dataSt
auto conn = m_connPool.getConn();
auto stmt = conn.createStmt(sql);
stmt.bindUint64(":READ_MAX_DRIVES", maxDrivesAllowedForRead);
stmt.bindUint64(":READ_MAX_DRIVES", readMaxDrives);
stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username);
stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host);
stmt.bindUint64(":LAST_UPDATE_TIME", now);
......@@ -650,7 +650,7 @@ void RdbmsCatalogue::modifyVirtualOrganizationReadMaxDrives(const common::dataSt
}
}
void RdbmsCatalogue::modifyVirtualOrganizationWriteMaxDrives(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 writeMaxDrives){
try {
const time_t now = time(nullptr);
const char *const sql =
......@@ -664,7 +664,7 @@ void RdbmsCatalogue::modifyVirtualOrganizationWriteMaxDrives(const common::dataS
auto conn = m_connPool.getConn();
auto stmt = conn.createStmt(sql);
stmt.bindUint64(":WRITE_MAX_DRIVES", maxDrivesAllowedForWrite);
stmt.bindUint64(":WRITE_MAX_DRIVES", writeMaxDrives);
stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username);
stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host);
stmt.bindUint64(":LAST_UPDATE_TIME", now);
......@@ -5142,8 +5142,6 @@ void RdbmsCatalogue::createMountPolicy(const common::dataStructures::SecurityIde
"RETRIEVE_PRIORITY,"
"RETRIEVE_MIN_REQUEST_AGE,"
"MAX_DRIVES_ALLOWED,"
"USER_COMMENT,"
"CREATION_LOG_USER_NAME,"
......@@ -5162,8 +5160,6 @@ void RdbmsCatalogue::createMountPolicy(const common::dataStructures::SecurityIde
":RETRIEVE_PRIORITY,"
":RETRIEVE_MIN_REQUEST_AGE,"
":MAX_DRIVES_ALLOWED,"
":USER_COMMENT,"
":CREATION_LOG_USER_NAME,"
......@@ -5182,8 +5178,6 @@ void RdbmsCatalogue::createMountPolicy(const common::dataStructures::SecurityIde
stmt.bindUint64(":RETRIEVE_PRIORITY", mountPolicy.retrievePriority);
stmt.bindUint64(":RETRIEVE_MIN_REQUEST_AGE", mountPolicy.minRetrieveRequestAge);
stmt.bindUint64(":MAX_DRIVES_ALLOWED", mountPolicy.maxDrivesAllowed);
stmt.bindString(":USER_COMMENT", mountPolicy.comment);
......@@ -5490,8 +5484,6 @@ optional<common::dataStructures::MountPolicy> RdbmsCatalogue::getRequesterGroupM
"MOUNT_POLICY.RETRIEVE_PRIORITY AS RETRIEVE_PRIORITY,"
"MOUNT_POLICY.RETRIEVE_MIN_REQUEST_AGE AS RETRIEVE_MIN_REQUEST_AGE,"
"MOUNT_POLICY.MAX_DRIVES_ALLOWED AS MAX_DRIVES_ALLOWED,"
"MOUNT_POLICY.USER_COMMENT AS USER_COMMENT,"
"MOUNT_POLICY.CREATION_LOG_USER_NAME AS CREATION_LOG_USER_NAME,"
......@@ -5525,8 +5517,6 @@ optional<common::dataStructures::MountPolicy> RdbmsCatalogue::getRequesterGroupM
policy.retrievePriority = rset.columnUint64("RETRIEVE_PRIORITY");
policy.retrieveMinRequestAge = rset.columnUint64("RETRIEVE_MIN_REQUEST_AGE");
policy.maxDrivesAllowed = rset.columnUint64("MAX_DRIVES_ALLOWED");
policy.comment = rset.columnString("USER_COMMENT");
policy.creationLog.username = rset.columnString("CREATION_LOG_USER_NAME");
policy.creationLog.host = rset.columnString("CREATION_LOG_HOST_NAME");
......@@ -5719,8 +5709,6 @@ optional<common::dataStructures::MountPolicy> RdbmsCatalogue::getRequesterMountP
"MOUNT_POLICY.RETRIEVE_PRIORITY AS RETRIEVE_PRIORITY,"
"MOUNT_POLICY.RETRIEVE_MIN_REQUEST_AGE AS RETRIEVE_MIN_REQUEST_AGE,"
"MOUNT_POLICY.MAX_DRIVES_ALLOWED AS MAX_DRIVES_ALLOWED,"
"MOUNT_POLICY.USER_COMMENT AS USER_COMMENT,"
"MOUNT_POLICY.CREATION_LOG_USER_NAME AS CREATION_LOG_USER_NAME,"
......@@ -5754,8 +5742,6 @@ optional<common::dataStructures::MountPolicy> RdbmsCatalogue::getRequesterMountP
policy.retrievePriority = rset.columnUint64("RETRIEVE_PRIORITY");
policy.retrieveMinRequestAge = rset.columnUint64("RETRIEVE_MIN_REQUEST_AGE");
policy.maxDrivesAllowed = rset.columnUint64("MAX_DRIVES_ALLOWED");
policy.comment = rset.columnString("USER_COMMENT");
policy.creationLog.username = rset.columnString("CREATION_LOG_USER_NAME");
......@@ -5864,8 +5850,6 @@ try {
"RETRIEVE_PRIORITY AS RETRIEVE_PRIORITY,"
"RETRIEVE_MIN_REQUEST_AGE AS RETRIEVE_MIN_REQUEST_AGE,"
"MAX_DRIVES_ALLOWED AS MAX_DRIVES_ALLOWED,"
"USER_COMMENT AS USER_COMMENT,"
"CREATION_LOG_USER_NAME AS CREATION_LOG_USER_NAME,"
......@@ -5891,8 +5875,6 @@ try {
policy.retrievePriority = rset.columnUint64("RETRIEVE_PRIORITY");
policy.retrieveMinRequestAge = rset.columnUint64("RETRIEVE_MIN_REQUEST_AGE");
policy.maxDrivesAllowed = rset.columnUint64("MAX_DRIVES_ALLOWED");
policy.comment = rset.columnString("USER_COMMENT");
......@@ -6090,45 +6072,6 @@ void RdbmsCatalogue::modifyMountPolicyRetrieveMinRequestAge(const common::dataSt
m_allMountPoliciesCache.invalidate();
}
//------------------------------------------------------------------------------
// modifyMountPolicyMaxDrivesAllowed
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyMountPolicyMaxDrivesAllowed(const common::dataStructures::SecurityIdentity &admin,
const std::string &name, const uint64_t maxDrivesAllowed) {
try {
const time_t now = time(nullptr);
const char *const sql =
"UPDATE MOUNT_POLICY SET "
"MAX_DRIVES_ALLOWED = :MAX_DRIVES_ALLOWED,"
"LAST_UPDATE_USER_NAME = :LAST_UPDATE_USER_NAME,"
"LAST_UPDATE_HOST_NAME = :LAST_UPDATE_HOST_NAME,"
"LAST_UPDATE_TIME = :LAST_UPDATE_TIME "
"WHERE "
"MOUNT_POLICY_NAME = :MOUNT_POLICY_NAME";
auto conn = m_connPool.getConn();
auto stmt = conn.createStmt(sql);
stmt.bindUint64(":MAX_DRIVES_ALLOWED", maxDrivesAllowed);
stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username);
stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host);
stmt.bindUint64(":LAST_UPDATE_TIME", now);
stmt.bindString(":MOUNT_POLICY_NAME", name);
stmt.executeNonQuery();
if(0 == stmt.getNbAffectedRows()) {
throw exception::UserError(std::string("Cannot modify mount policy ") + name + " because they do not exist");
}
} catch(exception::UserError &) {
throw;
} catch(exception::Exception &ex) {
ex.getMessage().str(std::string(__FUNCTION__) + ": " + ex.getMessage().str());
throw;
}
m_groupMountPolicyCache.invalidate();
m_userMountPolicyCache.invalidate();
m_allMountPoliciesCache.invalidate();
}
//------------------------------------------------------------------------------
// modifyMountPolicyComment
//------------------------------------------------------------------------------
......@@ -7650,7 +7593,6 @@ RequesterAndGroupMountPolicies RdbmsCatalogue::getMountPolicies(
"MOUNT_POLICY.ARCHIVE_MIN_REQUEST_AGE AS ARCHIVE_MIN_REQUEST_AGE,"
"MOUNT_POLICY.RETRIEVE_PRIORITY AS RETRIEVE_PRIORITY,"
"MOUNT_POLICY.RETRIEVE_MIN_REQUEST_AGE AS RETRIEVE_MIN_REQUEST_AGE,"
"MOUNT_POLICY.MAX_DRIVES_ALLOWED AS MAX_DRIVES_ALLOWED,"
"MOUNT_POLICY.USER_COMMENT AS USER_COMMENT,"
"MOUNT_POLICY.CREATION_LOG_USER_NAME AS CREATION_LOG_USER_NAME,"
"MOUNT_POLICY.CREATION_LOG_HOST_NAME AS CREATION_LOG_HOST_NAME,"
......@@ -7677,7 +7619,6 @@ RequesterAndGroupMountPolicies RdbmsCatalogue::getMountPolicies(
"MOUNT_POLICY.ARCHIVE_MIN_REQUEST_AGE AS ARCHIVE_MIN_REQUEST_AGE,"
"MOUNT_POLICY.RETRIEVE_PRIORITY AS RETRIEVE_PRIORITY,"
"MOUNT_POLICY.RETRIEVE_MIN_REQUEST_AGE AS RETRIEVE_MIN_REQUEST_AGE,"
"MOUNT_POLICY.MAX_DRIVES_ALLOWED AS MAX_DRIVES_ALLOWED,"
"MOUNT_POLICY.USER_COMMENT AS USER_COMMENT,"
"MOUNT_POLICY.CREATION_LOG_USER_NAME AS CREATION_LOG_USER_NAME,"
"MOUNT_POLICY.CREATION_LOG_HOST_NAME AS CREATION_LOG_HOST_NAME,"
......@@ -7711,7 +7652,6 @@ RequesterAndGroupMountPolicies RdbmsCatalogue::getMountPolicies(
policy.archiveMinRequestAge = rset.columnUint64("ARCHIVE_MIN_REQUEST_AGE");
policy.retrievePriority = rset.columnUint64("RETRIEVE_PRIORITY");
policy.retrieveMinRequestAge = rset.columnUint64("RETRIEVE_MIN_REQUEST_AGE");
policy.maxDrivesAllowed = rset.columnUint64("MAX_DRIVES_ALLOWED");
policy.comment = rset.columnString("USER_COMMENT");
policy.creationLog.username = rset.columnString("CREATION_LOG_USER_NAME");
policy.creationLog.host = rset.columnString("CREATION_LOG_HOST_NAME");
......
......@@ -765,7 +765,6 @@ public:
void modifyMountPolicyArchiveMinRequestAge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t minArchiveRequestAge) override;
void modifyMountPolicyRetrievePriority(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t retrievePriority) override;
void modifyMountPolicyRetrieveMinRequestAge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t minRetrieveRequestAge) override;
void modifyMountPolicyMaxDrivesAllowed(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t maxDrivesAllowed) override;
void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
void createActivitiesFairShareWeight(const common::dataStructures::SecurityIdentity &admin, const std::string & diskInstanceName, const std::string & activity,
......
......@@ -277,7 +277,6 @@ const std::map<std::string, OptionUInt64::Key> uint64Options = {
{ "--capacity", OptionUInt64::CAPACITY },
{ "--copynb", OptionUInt64::COPY_NUMBER },
{ "--id", OptionUInt64::ARCHIVE_FILE_ID },
{ "--maxdrivesallowed", OptionUInt64::MAX_DRIVES_ALLOWED },
{ "--maxlpos", OptionUInt64::MAX_LPOS },
{ "--minarchiverequestage", OptionUInt64::MIN_ARCHIVE_REQUEST_AGE },
{ "--minlpos", OptionUInt64::MIN_LPOS },
......@@ -446,7 +445,6 @@ const Option opt_log { Option::OPT_FLAG, "--log",
const Option opt_logicallibrary { Option::OPT_STR, "--logicallibrary", "-l", " <logical_library_name>" };
const Option opt_logicallibrary_alias { Option::OPT_STR, "--name", "-n", " <logical_library_name>", "--logicallibrary" };
const Option opt_lookupns { Option::OPT_FLAG, "--lookupnamespace", "-l", "" };
const Option opt_maxdrivesallowed { Option::OPT_UINT, "--maxdrivesallowed", "-d", " <max_drives_allowed>" };
const Option opt_maxlpos { Option::OPT_UINT, "--maxlpos", "-maxl", " <maximum_longitudinal_position>" };
const Option opt_mediatype { Option::OPT_STR, "--mediatype", "--mt", " <media_type_name>" };
const Option opt_mediatype_alias { Option::OPT_STR, "--name", "-n", " <media_type_name>", "--mediatype" };
......@@ -539,10 +537,10 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = {
/*----------------------------------------------------------------------------------------------------*/
{{ AdminCmd::CMD_MOUNTPOLICY, AdminCmd::SUBCMD_ADD },
{ opt_mountpolicy_alias, opt_archivepriority, opt_minarchiverequestage, opt_retrievepriority,
opt_minretrieverequestage, opt_maxdrivesallowed, opt_comment }},
opt_minretrieverequestage, opt_comment }},
{{ AdminCmd::CMD_MOUNTPOLICY, AdminCmd::SUBCMD_CH },
{ opt_mountpolicy_alias, opt_archivepriority.optional(), opt_minarchiverequestage.optional(),
opt_retrievepriority.optional(), opt_minretrieverequestage.optional(), opt_maxdrivesallowed.optional(),
opt_retrievepriority.optional(), opt_minretrieverequestage.optional(),
opt_comment.optional() }},
{{ AdminCmd::CMD_MOUNTPOLICY, AdminCmd::SUBCMD_RM }, { opt_mountpolicy_alias }},
{{ AdminCmd::CMD_MOUNTPOLICY, AdminCmd::SUBCMD_LS }, { }},
......
......@@ -580,7 +580,6 @@ void TextFormatter::printMountPolicyLsHeader() {
"a.minAge",
"r.priority",
"r.minAge",
"max drives",
"c.user",
"c.host",
"c.time",
......@@ -598,7 +597,6 @@ void TextFormatter::print(const MountPolicyLsItem &mpls_item) {
mpls_item.archive_min_request_age(),
mpls_item.retrieve_priority(),
mpls_item.retrieve_min_request_age(),
mpls_item.max_drives_allowed(),
mpls_item.creation_log().username(),
mpls_item.creation_log().host(),
timeToStr(mpls_item.creation_log().time()),
......
......@@ -32,13 +32,12 @@ MountPolicy::MountPolicy():
archivePriority(0),
archiveMinRequestAge(0),
retrievePriority(0),
retrieveMinRequestAge(0),
maxDrivesAllowed(0){}
retrieveMinRequestAge(0){}
MountPolicy::MountPolicy(const std::string name, const uint64_t archivePriority,const uint64_t archiveMinRequestAge, const uint64_t retrievePriority,
const uint64_t retrieveMinRequestAge, const uint64_t maxDrivesAllowed):
const uint64_t retrieveMinRequestAge):
name(name), archivePriority(archivePriority), archiveMinRequestAge(archiveMinRequestAge), retrievePriority(retrievePriority),
retrieveMinRequestAge(retrieveMinRequestAge), maxDrivesAllowed(maxDrivesAllowed) {}
retrieveMinRequestAge(retrieveMinRequestAge) {}
//------------------------------------------------------------------------------
// operator==
//------------------------------------------------------------------------------
......@@ -48,7 +47,6 @@ bool MountPolicy::operator==(const MountPolicy &rhs) const {
&& archiveMinRequestAge==rhs.archiveMinRequestAge
&& retrievePriority==rhs.retrievePriority
&& retrieveMinRequestAge==rhs.retrieveMinRequestAge
&& maxDrivesAllowed==rhs.maxDrivesAllowed
&& creationLog==rhs.creationLog
&& lastModificationLog==rhs.lastModificationLog
&& comment==rhs.comment;
......@@ -68,7 +66,6 @@ MountPolicy MountPolicy::operator=(const MountPolicy& other){
this->comment = other.comment;
this->creationLog = other.creationLog;
this->lastModificationLog = other.lastModificationLog;
this->maxDrivesAllowed = other.maxDrivesAllowed;
this->name = other.name;
this->retrieveMinRequestAge = other.retrieveMinRequestAge;
this->retrievePriority = other.retrievePriority;
......@@ -84,14 +81,13 @@ std::ostream &operator<<(std::ostream &os, const MountPolicy &obj) {
<< " archive_minRequestAge=" << obj.archiveMinRequestAge
<< " retrieve_priority=" << obj.retrievePriority
<< " retrieve_minRequestAge=" << obj.retrieveMinRequestAge
<< " maxDrivesAllowed=" << obj.maxDrivesAllowed
<< " creationLog=" << obj.creationLog
<< " lastModificationLog=" << obj.lastModificationLog
<< " comment=" << obj.comment << ")";
return os;
}
MountPolicy MountPolicy::s_defaultMountPolicyForRepack("default_mount_policy_repack",1,1,1,1,1);
MountPolicy MountPolicy::s_defaultMountPolicyForRepack("default_mount_policy_repack",1,1,1,1);
} // namespace dataStructures
} // namespace common
......
......@@ -47,7 +47,6 @@ struct MountPolicy {
uint64_t archiveMinRequestAge;
uint64_t retrievePriority;
uint64_t retrieveMinRequestAge;
uint64_t maxDrivesAllowed;
EntryLog creationLog;
EntryLog lastModificationLog;
std::string comment;
......@@ -56,7 +55,7 @@ struct MountPolicy {
static struct MountPolicy s_defaultMountPolicyForRepack;
private:
MountPolicy(const std::string name,const uint64_t archivePriority,const uint64_t archiveMinRequestAge, const uint64_t retrievePriority, const uint64_t retrieveMinRequestAge, const uint64_t maxDrivesAllowed);
MountPolicy(const std::string name,const uint64_t archivePriority,const uint64_t archiveMinRequestAge, const uint64_t retrievePriority, const uint64_t retrieveMinRequestAge);
}; // struct MountPolicy
......
......@@ -183,7 +183,6 @@ kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin --json version | jq
--minarchiverequestage 1 \
--retrievepriority 1 \
--minretrieverequestage 1 \
--maxdrivesallowed 1 \
--comment "ctasystest"
kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin requestermountrule add \
--instance ${EOSINSTANCE} \
......
......@@ -12,7 +12,7 @@ cta storageclass add --instance root --name ctaStorageClass --copynb 1 --comment
cta archiveroute add --instance root --storageclass ctaStorageClass --copynb 1 --tapepool ctasystest --comment "ctasystest"
cta mountpolicy add --name ctasystest --archivepriority 1 --minarchiverequestage 1 --retrievepriority 1 --minretrieverequestage 1 --maxdrivesallowed 1 --comment "ctasystest"
cta mountpolicy add --name ctasystest --archivepriority 1 --minarchiverequestage 1 --retrievepriority 1 --minretrieverequestage 1 --comment "ctasystest"
cta requestermountrule add --instance root --name root --mountpolicy ctasystest --comment "ctasystest"
......
......@@ -96,7 +96,6 @@ echo "Preparing CTA for tests"
--minarchiverequestage 1 \
--retrievepriority 1 \
--minretrieverequestage 1 \
--maxdrivesallowed 1 \
--comment "ctasystest"
kubectl --namespace ${NAMESPACE} exec ctacli -- cta requestermountrule add \
--instance ${EOSINSTANCE} \
......
......@@ -99,7 +99,6 @@ kubectl --namespace ${NAMESPACE} exec ctacli -- cta mountpolicy add \
--minarchiverequestage 1 \
--retrievepriority 1 \
--minretrieverequestage 1 \
--maxdrivesallowed 1 \
--comment "ctasystest"
kubectl --namespace ${NAMESPACE} exec ctacli -- cta requestermountrule add \
--instance ${EOSINSTANCE} \
......
......@@ -97,7 +97,6 @@ kubectl --namespace ${NAMESPACE} exec ctacli -- cta mountpolicy add \
--minarchiverequestage 1 \
--retrievepriority 1 \
--minretrieverequestage 1 \
--maxdrivesallowed 1 \
--comment "ctasystest"
kubectl --namespace ${NAMESPACE} exec ctacli -- cta requestermountrule add \
--instance ${EOSINSTANCE} \
......
......@@ -90,7 +90,6 @@ void fillRetrieveRequests(
rqc.mountPolicy.archivePriority = 1;