Commit 6ed45586 authored by Eric Cano's avatar Eric Cano
Browse files

Fixed MockNameServer not seting ID for directories and looking for directory size.

Fixed mount criteria computation.
parent cffeccb2
......@@ -475,6 +475,9 @@ void cta::MockNameServer::createDir(const SecurityIdentity &requester,
setDirStorageClass(requester, path, inheritedStorageClass);
setOwner(requester, path, requester.getUser());
std::stringstream fileIDString;
fileIDString << ++m_fileIdCounter;
Utils::setXattr(fsPath.c_str(), "user.CTAFileID", fileIDString.str());
}
//------------------------------------------------------------------------------
......@@ -630,7 +633,10 @@ cta::ArchiveDirEntry cta::MockNameServer::getArchiveDirEntry(
const UserIdentity owner = getOwner(requester, path);
const Checksum checksum;
const std::string fsPath = m_fsDir + path;
const uint64_t size = atol(Utils::getXattr(fsPath, "user.CTASize").c_str());
// Size is 0 for directories (and set for files)
uint64_t size = 0;
if (ArchiveDirEntry::ENTRYTYPE_FILE == entryType)
size = atol(Utils::getXattr(fsPath, "user.CTASize").c_str());
const uint64_t fileId = atol(Utils::getXattr(fsPath, "user.CTAFileID").c_str());
ArchiveFileStatus status(owner, fileId, statResult.st_mode, size, checksum, storageClassName);
......
......@@ -800,6 +800,7 @@ std::unique_ptr<cta::TapeMount> cta::Scheduler::getNextMount(
// First, get the mount-related info from the DB
std::unique_ptr<SchedulerDatabase::TapeMountDecisionInfo> mountInfo;
mountInfo = m_db.getMountInfo();
auto potentialMounts = mountInfo->potentialMounts;
// We should now filter the potential mounts to keep only the ones we are
// compatible with (match the logical library for retrieves).
......@@ -838,9 +839,9 @@ std::unique_ptr<cta::TapeMount> cta::Scheduler::getNextMount(
existingMounts = 0;
}
bool mountPassesACriteria = false;
if (m->bytesQueued / (1 + existingMounts) > m->mountCriteria.maxBytesQueued)
if (m->bytesQueued / (1 + existingMounts) >= m->mountCriteria.maxBytesQueued)
mountPassesACriteria = true;
if (m->filesQueued / (1 + existingMounts) > m->mountCriteria.maxFilesQueued)
if (m->filesQueued / (1 + existingMounts) >= m->mountCriteria.maxFilesQueued)
mountPassesACriteria = true;
if (!existingMounts && ((time(NULL) - m->oldestJobStartTime) > (int64_t)m->mountCriteria.maxAge))
mountPassesACriteria = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment