From 4de6acd7756947819d5a0e56197c8372ac62f1b4 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 24 Feb 2022 13:43:48 +0100 Subject: zfssnap: no recursive --- modules/zfssnap/zfssnap.py | 40 +++------------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) (limited to 'modules') diff --git a/modules/zfssnap/zfssnap.py b/modules/zfssnap/zfssnap.py index 6d9bc6de..7055f308 100644 --- a/modules/zfssnap/zfssnap.py +++ b/modules/zfssnap/zfssnap.py @@ -25,8 +25,6 @@ from functools import cache from math import floor -import asyncio - @cache def _now(): @@ -214,31 +212,6 @@ def rename(snapshots, destroy=False, set_is_auto=False): def autosnap(): items = _get_items() - recursive, single = set(), set() - - for item_name, is_included in items.items(): - if not is_included: - continue - - children = {sub_name for sub_name in items if sub_name.startswith(f'{item_name}/')} - is_recursive = all([items[sub_name] for sub_name in children]) - if is_recursive and children: - recursive.add(item_name) - else: - single.add(item_name) - - for item_name in recursive | single: - is_covered = any([item_name.startswith(f'{super_name}/') for super_name in recursive]) - if is_covered: - try: - recursive.remove(item_name) - except KeyError: - pass - try: - single.remove(item_name) - except KeyError: - pass - all_snap_names = set() async def do_snapshot(*snap_items, recursive=False): nonlocal items, all_snap_names @@ -257,17 +230,10 @@ def autosnap(): _log_cmd(*args) subprocess.run(args, check=True) - tasks = [] - if single: - tasks.append(do_snapshot(*single)) - if recursive: - tasks.append(do_snapshot(*recursive, recursive=True)) - if not tasks: + + do_snapshot(*items) + if not items: logger.warning('No snapshots to create') - else: - async def run_tasks(): - await asyncio.gather(*tasks) - asyncio.run(run_tasks()) for snap in all_snap_names: logger.info(f'Created ‘{snap}’') if all_snap_names: -- cgit v1.2.3