Project

General

Profile

Actions

Submit #3287

closed

change HAMMER2 snapshot periodic script

Added by fgudin 12 months ago. Updated 12 months ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
Feature request
Target version:
Start date:
07/07/2021
Due date:
% Done:

100%

Estimated time:

Description

Hi,
I'd like to propose a small modification to the way 220.snapshot-hammer2 handles scarce free space condition:

diff --git a/etc/periodic/daily/220.snapshot-hammer2 b/etc/periodic/daily/220.snapshot-hammer2
index 09962dc3f3..36ea83ce8e 100644
--- a/etc/periodic/daily/220.snapshot-hammer2
+++ b/etc/periodic/daily/220.snapshot-hammer2
@@ -54,12 +54,12 @@ case "${snap_enable}" in
                fi
                _df=$(df ${dir} | grep -oE "[0-9]+%")
                _pcnt=${_df%%%}
-               if [ ${_pcnt} -gt ${snap_capacity} ]; then
-                       echo "omitted, not enough free space" 
-                       continue
+               if [ ${_pcnt} -le ${snap_capacity} ]; then
+                       hammer2 snapshot ${dir} ${dir}.${snap_tag}.$(date +%Y%m%d.%H:%M) \
+                               || rc=1
+               else
+                       echo "snapshot creation omitted, not enough free space" 
                fi
-               hammer2 snapshot ${dir} ${dir}.${snap_tag}.$(date +%Y%m%d.%H:%M) \
-                       || rc=1
                _keep=${snap_keep}
                if [ "${_keep}" = "auto" ]; then
                        # adjust number of snapshots dynamically, according to free space

The idea is that whenever the user falls into free space shortage situation, the "sliding window" of snapshots potentially continues rolling forward, instead of becoming stuck into the past.

BR,
--
Francis


Files

220.diff (1.1 KB) 220.diff fgudin, 07/07/2021 05:46 AM
Actions #1

Updated by fgudin 12 months ago

Better as an attachment, indeed.

Actions #2

Updated by swildner 12 months ago

  • Status changed from New to Closed

Thanks, I've pushed it and cherry picked to 6.0.

Actions #3

Updated by tuxillo 12 months ago

  • Description updated (diff)
Actions #4

Updated by tuxillo 12 months ago

  • Description updated (diff)
  • Target version set to 6.2
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF