mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-18 22:02:08 +00:00
test: storage: retry fusermount3 unmount on teardown
After stopping scylla server processes, the FUSE daemon
(fuse2fs) may still be processing file handle closures.
An immediate fusermount3 -u can fail with 'device busy',
causing spurious test failures on teardown.
Retry the unmount up to 10 times with 0.5s delay between
attempts, and capture stderr for diagnostics.
Fixes: SCYLLADB-2066
Closes scylladb/scylladb#29920
(cherry picked from commit 61e5ec9888)
Closes scylladb/scylladb#29930
This commit is contained in:
committed by
Avi Kivity
parent
c1c0c96643
commit
fb33abaee6
@@ -5,10 +5,12 @@
|
||||
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
|
||||
#
|
||||
import pytest
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import time
|
||||
import uuid
|
||||
|
||||
from typing import Callable
|
||||
@@ -19,6 +21,8 @@ from test.cluster.conftest import PHASE_REPORT_KEY
|
||||
from test.pylib.manager_client import ManagerClient
|
||||
from test.pylib.util import gather_safely
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def volumes_factory(pytestconfig, build_mode, request):
|
||||
@@ -64,7 +68,15 @@ def volumes_factory(pytestconfig, build_mode, request):
|
||||
shutil.copytree(volume.mount, base.parent.parent / f"scylla-{hash}-{id}", ignore=shutil.ignore_patterns('commitlog*', 'lost+found*'))
|
||||
shutil.copyfile(volume.log, base.parent.parent / f"scylla-{hash}-{id}.log")
|
||||
|
||||
subprocess.run(["fusermount3", "-u", volume.mount], check=True)
|
||||
retries = 10
|
||||
for attempt in range(retries):
|
||||
result = subprocess.run(["fusermount3", "-u", volume.mount], capture_output=True, text=True)
|
||||
if result.returncode == 0:
|
||||
break
|
||||
logger.warning("fusermount3 -u attempt %d/%d failed: %s", attempt + 1, retries, result.stderr.strip())
|
||||
if attempt + 1 == retries:
|
||||
raise subprocess.CalledProcessError(result.returncode, result.args, result.stdout, result.stderr)
|
||||
time.sleep(0.5)
|
||||
os.unlink(volume.img)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user