summaryrefslogtreecommitdiff
path: root/roles/storage/zfs/syncoid/templates
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2022-03-15 10:19:23 +0100
committerChristian Pointner <equinox@spreadspace.org>2022-03-15 10:19:23 +0100
commit8c348f32e6d654d84f55dfeb51a6fc0a15fe1a6b (patch)
treea42503ea2c4d26a36b8c5ecc2620087cf8dfafd4 /roles/storage/zfs/syncoid/templates
parentalerta: make client timezone configurable (diff)
zfs/syncoid-autosuspend: also check for resilvering
Diffstat (limited to 'roles/storage/zfs/syncoid/templates')
-rw-r--r--roles/storage/zfs/syncoid/templates/autosuspend.py.j211
1 files changed, 7 insertions, 4 deletions
diff --git a/roles/storage/zfs/syncoid/templates/autosuspend.py.j2 b/roles/storage/zfs/syncoid/templates/autosuspend.py.j2
index 22b27df4..a6217ca0 100644
--- a/roles/storage/zfs/syncoid/templates/autosuspend.py.j2
+++ b/roles/storage/zfs/syncoid/templates/autosuspend.py.j2
@@ -14,6 +14,7 @@ class AutoSuspender(object):
self.__bus = dbus.SystemBus()
self.__timer_re = re.compile('^syncoid-pull-.*\.timer$')
self.__zpool_scrub_in_progress_re = re.compile('^\s*scan:.*scrub in progress.*$')
+ self.__zpool_resilver_in_progress_re = re.compile('^\s*scan:.*resilver in progress.*$')
# self.__pp = pprint.PrettyPrinter(indent=2)
def _get_interface(self, dest, object, interface):
@@ -64,11 +65,13 @@ class AutoSuspender(object):
pools = subprocess.run(["zpool", "list", "-H", "-o", "name"], check=True, stdout=subprocess.PIPE).stdout.splitlines()
return [pool.decode('utf-8') for pool in pools]
- def _is_zpool_scrub_in_progress(self, pool):
+ def _is_zpool_scrub_or_resilver_in_progress(self, pool):
lines = subprocess.run(["zpool", "status", pool], check=True, stdout=subprocess.PIPE).stdout.splitlines()
for line in lines:
if self.__zpool_scrub_in_progress_re.match(line.decode('utf-8')):
return True
+ if self.__zpool_resilver_in_progress_re.match(line.decode('utf-8')):
+ return True
return False
def check(self):
@@ -98,11 +101,11 @@ class AutoSuspender(object):
zpools = self._get_zpools()
for pool in zpools:
- if self._is_zpool_scrub_in_progress(pool):
- print(" [NO] zpool scrubbing is in progress on pool '%s'" % (pool))
+ if self._is_zpool_scrub_or_resilver_in_progress(pool):
+ print(" [NO] zpool scrub/resilver is in progress on pool '%s'" % (pool))
result = False
else:
- print(" [ok] zpool '%s' is not scrubbing" % (pool))
+ print(" [ok] zpool '%s' is not scrubbing/resilvering" % (pool))
return result