Commit 85694b4f authored by Volodymyr Yurchenko's avatar Volodymyr Yurchenko
Browse files

Check if there is default mount rule

This commit adds a check for a requester mount policy with the hardcoded
name "default". Requester mount rule with this name must be present on
eoscta instance to pass this check
parent 817da140
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include <ctype.h> #include <ctype.h>
#include <memory> #include <memory>
#include <time.h> #include <time.h>
#include <sys/types.h>
#include <grp.h>
namespace cta { namespace cta {
namespace catalogue { namespace catalogue {
...@@ -7311,6 +7313,10 @@ uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskIns ...@@ -7311,6 +7313,10 @@ uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskIns
const auto groupMountPolicy = getCachedRequesterGroupMountPolicy(Group(diskInstanceName, user.group)); const auto groupMountPolicy = getCachedRequesterGroupMountPolicy(Group(diskInstanceName, user.group));
if(!groupMountPolicy) { if(!groupMountPolicy) {
const auto defaultMountPolicy = getCachedRequesterMountPolicy(User(diskInstanceName, "default"));
if(!defaultMountPolicy) {
exception::UserError ue; exception::UserError ue;
ue.getMessage() << "No mount rules for the requester or their group:" ue.getMessage() << "No mount rules for the requester or their group:"
" storageClass=" << storageClassName << " requester=" << diskInstanceName << ":" << user.name << ":" << " storageClass=" << storageClassName << " requester=" << diskInstanceName << ":" << user.name << ":" <<
...@@ -7318,6 +7324,7 @@ uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskIns ...@@ -7318,6 +7324,7 @@ uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskIns
throw ue; throw ue;
} }
} }
}
// Now that we have found both the archive routes and the mount policy it's // Now that we have found both the archive routes and the mount policy it's
// safe to consume an archive file identifier // safe to consume an archive file identifier
...@@ -7363,6 +7370,9 @@ common::dataStructures::ArchiveFileQueueCriteria RdbmsCatalogue::getArchiveFileQ ...@@ -7363,6 +7370,9 @@ common::dataStructures::ArchiveFileQueueCriteria RdbmsCatalogue::getArchiveFileQ
if(!mountPolicy) { if(!mountPolicy) {
mountPolicy = getCachedRequesterGroupMountPolicy(Group(diskInstanceName, user.group)); mountPolicy = getCachedRequesterGroupMountPolicy(Group(diskInstanceName, user.group));
if(!mountPolicy) {
mountPolicy = getCachedRequesterMountPolicy(User(diskInstanceName, "default"));
if(!mountPolicy) { if(!mountPolicy) {
exception::UserError ue; exception::UserError ue;
ue.getMessage() << "No mount rules for the requester or their group: storageClass=" << storageClassName << ue.getMessage() << "No mount rules for the requester or their group: storageClass=" << storageClassName <<
...@@ -7370,6 +7380,7 @@ common::dataStructures::ArchiveFileQueueCriteria RdbmsCatalogue::getArchiveFileQ ...@@ -7370,6 +7380,7 @@ common::dataStructures::ArchiveFileQueueCriteria RdbmsCatalogue::getArchiveFileQ
throw ue; throw ue;
} }
} }
}
return common::dataStructures::ArchiveFileQueueCriteria(copyToPoolMap, *mountPolicy); return common::dataStructures::ArchiveFileQueueCriteria(copyToPoolMap, *mountPolicy);
} catch(exception::UserError &) { } catch(exception::UserError &) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment