From 32019d8b77068358f74ab991f22762d7c6bfc0ec Mon Sep 17 00:00:00 2001 From: Eric Cano <Eric.Cano@cern.ch> Date: Fri, 28 Jul 2017 14:56:59 +0200 Subject: [PATCH] Added support for forcible shutdown in OStoreDB::ArchiveMount::getNextJobBatch() It was wrongly added to OStoreDB::ArchiveMount::getNextJob() instead in a05ad490. --- scheduler/OStoreDB/OStoreDB.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index 89fe4ba0af..605c1e330c 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -1622,6 +1622,18 @@ std::list<std::unique_ptr<SchedulerDatabase::ArchiveJob> > OStoreDB::ArchiveMoun objectstore::RootEntry re(m_objectStore); objectstore::ScopedSharedLock rel(re); re.fetch(); + // First, check we should not forcibly go down. In such an occasion, we just find noting to do. + // Get drive register + { + objectstore::DriveRegister dr(re.getDriveRegisterAddress(), m_objectStore); + ScopedSharedLock drl(dr); + dr.fetch(); + auto drs = dr.getDriveState(mountInfo.drive); + if (!drs.desiredDriveState.up && drs.desiredDriveState.forceDown) { + logContext.log(log::INFO, "In OStoreDB::ArchiveMount::getNextJobBatch(): returning no job as we are forcibly going down."); + return std::list<std::unique_ptr<SchedulerDatabase::ArchiveJob> >(); + } + } auto aql = re.dumpArchiveQueues(); rel.release(); std::string aqAddress; -- GitLab