Enhance backend management and performance tuning
- Introduced remounting logic for data directories to ensure correct bindings before restarting services, improving reliability during performance tuning. - Added functions to sanitize and ensure absolute paths for backend scripts, preventing issues with relative paths in bind mounts. - Enhanced the `patch_backends_extra_args` function to clean up corrupted entries and ensure proper configuration of backend parameters. - Updated tests to validate the new sanitization and path handling functionalities, ensuring robustness in backend management.
This commit is contained in:
@@ -68,9 +68,17 @@ ensure_data_mount() {
|
||||
ensure_bind() {
|
||||
local src="$1" dst="$2"
|
||||
mkdir -p "$src" "$dst"
|
||||
if ! findmnt "$dst" >/dev/null 2>&1; then
|
||||
mount --bind "$src" "$dst"
|
||||
if findmnt "$dst" >/dev/null 2>&1; then
|
||||
# git reset --hard can leave a stale/wrong bind; remount if SOURCE mismatch.
|
||||
local src_mnt
|
||||
src_mnt="$(findmnt -n -o SOURCE --target "$dst" 2>/dev/null || true)"
|
||||
if [[ "$src_mnt" == "$src" ]]; then
|
||||
return 0
|
||||
fi
|
||||
log "bind remount ${dst} (было: ${src_mnt:-?})"
|
||||
umount "$dst" 2>/dev/null || umount -l "$dst" 2>/dev/null || true
|
||||
fi
|
||||
mount --bind "$src" "$dst" || log "WARN: mount --bind ${src} → ${dst} failed"
|
||||
if ! grep -Fq " ${dst} " /etc/fstab; then
|
||||
echo "${src} ${dst} none bind,nofail 0 0" >> /etc/fstab
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user