diff options
-rw-r--r-- | roles/storage/zfs/syncoid/templates/autosuspend.py.j2 | 11 |
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 |