From 8c348f32e6d654d84f55dfeb51a6fc0a15fe1a6b Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 15 Mar 2022 10:19:23 +0100 Subject: zfs/syncoid-autosuspend: also check for resilvering --- roles/storage/zfs/syncoid/templates/autosuspend.py.j2 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'roles/storage/zfs') 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 -- cgit v1.2.3