diff --git a/operations/tape/cta-pool-supply/cta-pool-supply b/operations/tape/cta-pool-supply/cta-pool-supply index a47245f4e02c6bf1e2fc6438af0b8e192385783d..1ac4daf2c5cb5f27b70dbf2b3f9a66639513ca81 100755 --- a/operations/tape/cta-pool-supply/cta-pool-supply +++ b/operations/tape/cta-pool-supply/cta-pool-supply @@ -16,19 +16,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Logic: -# * CTA tape pool should have at least X partial tapes available for writing -# * Eligible partial tapes are those that are not DISABLED, not FULL and not -# in a DISABLED logical tape library -# * If the number of eligible partial tapes for a given pool falls below the -# configured limit, the pool needs to be re-supplied with fresh tapes -# * Fresh supply tapes are taken from tape pools defined in the "supply" column -# * Supply tape pools can be separated by a separator (usually comma) +# LOGIC: +# +# * CTA tape pools should have at least X partial tapes available for writing. +# * Eligible partial tapes are those that are not DISABLED, not READONLY, +# not FULL and not in a DISABLED logical tape library. +# * If the number of eligible partial tapes of a given tape pool falls below the +# configured limit, the pool needs to be re-supplied with fresh tapes. +# * Fresh supply tapes are taken from tape pools defined in the "supply" column. +# * There can be multiple supply tape pools and they can be separated by +# a separator (usually comma). # * There is no distinction between what is a supply pool and what is not, if -# a pool has a value in the "supply" column, tapes are taken from there. +# a pool has a value in the "supply" column, tapes are taken from that pool. # Because of this, irregularities, cyclical loops and other misconfiguration -# are possible - please be careful -# * This script is intended to run every 15 minutes +# are possible - please be careful. +# * This script is intended to run every 15 minutes. # # Author: Vladimir Bahyl - 7/2019 @@ -88,7 +90,7 @@ def extract_eligible_tapes(disabledlibraries, tapepool): # MAIN # ########## -logging.info("Current time: " + format(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))) +logging.info("--- Starting at: " + format(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))) # Extract the list of all tape pools from CTA (in the JSON format) command = [ctaadmin, "--json", "tapepool", "ls"] @@ -159,3 +161,5 @@ for tapepool in tapepools: else: logging.warn("Unable to re-fill the tape pool: " + tapepool["name"] + " because either the number of eligible partial tapes: " + tapepool["numPartialTapes"] + " or the supply pool: " + tapepool["supply"] + " is not properly configured") + +logging.info("--- Finished processing all tape pools\n") diff --git a/operations/tape/cta-pool-supply/cta-pool-supply.cron b/operations/tape/cta-pool-supply/cta-pool-supply.cron index a7b2230829bd35d2b5369d818542bc0e3c87f94c..3bfddcc5f8630ef7068e8d5ff130cf4867b36c83 100644 --- a/operations/tape/cta-pool-supply/cta-pool-supply.cron +++ b/operations/tape/cta-pool-supply/cta-pool-supply.cron @@ -1,10 +1,10 @@ -# This crontab entry will run the CTA tape pool re-supply script every 10 minutes. +# This crontab entry will run the CTA tape pool re-supply script every 15 minutes. # -# The purpose of that script is to re-fill the tape pools with empty tapes according to defined configuration. +# The purpose of that script is to re-fill the tape pools with empty tapes +# according to defined configuration. More documentation inside of the script. # # Vladimir Bahyl - 7/2019 -# MAILTO=tape-operations@cern.ch -*/10 * * * * root /usr/local/bin/cta-pool-supply >> /var/log/cta-pool-supply.log 2>&1 +*/15 * * * * root /usr/local/bin/cta-pool-supply >> /var/log/cta-pool-supply.log 2>&1 diff --git a/operations/tape/cta-pool-supply/cta-pool-supply.spec b/operations/tape/cta-pool-supply/cta-pool-supply.spec index 8f58e5daee381188d78b7ca61caacf02f523e187..0299fe2368f78bfe74a07877eb8fabcbb75272ec 100644 --- a/operations/tape/cta-pool-supply/cta-pool-supply.spec +++ b/operations/tape/cta-pool-supply/cta-pool-supply.spec @@ -1,4 +1,4 @@ -Summary: CTA supply re-fill mechanism +Summary: CTA pool supply re-fill mechanism Name: cta-pool-supply Version: 1.0 Release: 1 @@ -10,16 +10,21 @@ Requires: python36 cta-cli Source: %{name}-%{version}.tgz %description -This RPM contains a script that will generate an tape mount -statistics report on the tape infrastructure since the specified -date. - -TSMOD should investigate whether there are some users misusingthe -service. - -It should be run at most twice per day. - -TSMOD = Tape Service Manager on Duty +CTA pool supply re-fill mechanism + +* CTA tape pools should have at least X partial tapes available for writing. +* Eligible partial tapes are those that are not DISABLED, not READONLY, + not FULL and not in a DISABLED logical tape library. +* If the number of eligible partial tapes of a given tape pool falls below the + configured limit, the pool needs to be re-supplied with fresh tapes. +* Fresh supply tapes are taken from tape pools defined in the "supply" column. +* There can be multiple supply tape pools and they can be separated by + a separator (usually comma). +* There is no distinction between what is a supply pool and what is not, if + a pool has a value in the "supply" column, tapes are taken from that pool. + Because of this, irregularities, cyclical loops and other misconfiguration + are possible - please be careful. +* This script is intended to run every 15 minutes. Author: Vladimir Bahyl - 7/2019 %prep @@ -45,4 +50,3 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) /usr/local/bin/cta-pool-supply /etc/cron.d/cta-pool-supply.cron -/var/log/cta-pool-supply.log