refactor: scrub only pools
This commit is contained in:
+6
-5
@@ -278,13 +278,14 @@ class ZFS:
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def scrub(pool: str, *, wait_for_finish=True) -> None:
|
||||
def scrub(pool: Pool, *, wait_for_finish: bool = True) -> None:
|
||||
if not isinstance(pool, Pool):
|
||||
raise TypeError("Can only scrub pools.")
|
||||
# TODO: check if scrub already in progress
|
||||
run_command([config.ZPOOL, "scrub", pool])
|
||||
run_command([config.ZPOOL, "scrub", pool.name])
|
||||
if wait_for_finish:
|
||||
# TODO make Ctrl-c interrupt this
|
||||
run_command([config.ZPOOL, "wait", "-t", "scrub", pool])
|
||||
|
||||
run_command([config.ZPOOL, "wait", "-t", "scrub", pool.name])
|
||||
# TODO raise error if pool is not healthy
|
||||
|
||||
|
||||
@@ -373,7 +374,7 @@ class ExternalPool(Pool):
|
||||
|
||||
def scrub(self) -> None:
|
||||
print(f"Scrubbing {self._name}")
|
||||
ZFS.scrub(self._name)
|
||||
ZFS.scrub(self)
|
||||
|
||||
@classmethod
|
||||
def find_from_dict(cls, backup_pools: dict[str, UUID]) -> ExternalPool:
|
||||
|
||||
Reference in New Issue
Block a user