Resolve remote storage path from host*.conf for true cross-platform SSH support
detect_hosts() now sets REMOTE_STORAGE_PATH from HOST*_STORAGE_PATH in the remote's conf instead of calling platform_storage_path() locally. SSH commands that check the remote's storage (check_remote_array, check_remote_disks, check_both_healthy) use $REMOTE_STORAGE_PATH so they work correctly when the remote is a different platform with a different storage root.
This commit is contained in:
@@ -876,14 +876,13 @@ revoke_emby_admin() {
|
|||||||
check_both_healthy() {
|
check_both_healthy() {
|
||||||
platform_storage_healthy || { error "Local array not healthy"; return 1; }
|
platform_storage_healthy || { error "Local array not healthy"; return 1; }
|
||||||
|
|
||||||
local mirror_ip _spath
|
local mirror_ip
|
||||||
mirror_ip=$(resolve_tailscale_ip "$MIRROR")
|
mirror_ip=$(resolve_tailscale_ip "$MIRROR")
|
||||||
[[ -z "$mirror_ip" ]] && { error "Cannot resolve $MIRROR Tailscale IP"; return 1; }
|
[[ -z "$mirror_ip" ]] && { error "Cannot resolve $MIRROR Tailscale IP"; return 1; }
|
||||||
_spath=$(platform_storage_path)
|
|
||||||
|
|
||||||
timeout "$SSH_TIMEOUT" ssh -i "$MIRROR_SSH_KEY" \
|
timeout "$SSH_TIMEOUT" ssh -i "$MIRROR_SSH_KEY" \
|
||||||
-o ConnectTimeout="$SSH_TIMEOUT" root@"$mirror_ip" \
|
-o ConnectTimeout="$SSH_TIMEOUT" root@"$mirror_ip" \
|
||||||
"mountpoint -q '$_spath' && timeout 10 docker ps" >/dev/null 2>&1 || {
|
"mountpoint -q '$REMOTE_STORAGE_PATH' && timeout 10 docker ps" >/dev/null 2>&1 || {
|
||||||
error "Mirror $MIRROR not healthy"
|
error "Mirror $MIRROR not healthy"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,11 +362,13 @@ validate_int() {
|
|||||||
# all HOST* values discovered from host*.conf files.
|
# all HOST* values discovered from host*.conf files.
|
||||||
#
|
#
|
||||||
# Sets:
|
# Sets:
|
||||||
# MY_ID — "HOST1" or "HOST2" (the role key, not the hostname)
|
# MY_ID — "HOST1" or "HOST2" (the role key, not the hostname)
|
||||||
# REMOTE_ID — the peer's role key
|
# REMOTE_ID — the peer's role key
|
||||||
# LOCAL_SERVER_NAME — local hostname string (e.g. "unRAID-Gmer4Lfe")
|
# LOCAL_SERVER_NAME — local hostname string (e.g. "unRAID-Gmer4Lfe")
|
||||||
# REMOTE_SERVER_NAME — remote hostname string
|
# REMOTE_SERVER_NAME — remote hostname string
|
||||||
# SSH_KEY — SSH key for server-to-server operations
|
# SSH_KEY — SSH key for server-to-server operations
|
||||||
|
# REMOTE_STORAGE_PATH — remote's storage root from HOST*_STORAGE_PATH in host*.conf;
|
||||||
|
# falls back to platform_storage_path() for unconfigured pairs
|
||||||
#
|
#
|
||||||
# Also sets aliases for all host-specific arrays so scripts use unprefixed names:
|
# Also sets aliases for all host-specific arrays so scripts use unprefixed names:
|
||||||
# DAILY_SYNC_SHARES ← HOST*_DAILY_SYNC_SHARES
|
# DAILY_SYNC_SHARES ← HOST*_DAILY_SYNC_SHARES
|
||||||
@@ -609,6 +611,13 @@ detect_hosts() {
|
|||||||
_alias_assoc "WATCHDOG_DEPENDENCIES"
|
_alias_assoc "WATCHDOG_DEPENDENCIES"
|
||||||
_alias_assoc "WATCHDOG_APPDATA_SIZES"
|
_alias_assoc "WATCHDOG_APPDATA_SIZES"
|
||||||
|
|
||||||
|
# ── Remote storage path ───────────────────────────────────────────────────
|
||||||
|
# Resolved from REMOTE_ID's host*.conf so SSH commands use the correct path
|
||||||
|
# even when the remote is a different platform. Falls back to the local
|
||||||
|
# platform_storage_path() for unconfigured same-platform pairs.
|
||||||
|
local _rsp_var="${REMOTE_ID}_STORAGE_PATH"
|
||||||
|
REMOTE_STORAGE_PATH="${!_rsp_var:-$(platform_storage_path)}"
|
||||||
|
|
||||||
# ── Output ────────────────────────────────────────────────────────────────
|
# ── Output ────────────────────────────────────────────────────────────────
|
||||||
log "$ICON_HOST Host: $LOCAL_SERVER_NAME → $REMOTE_SERVER_NAME"
|
log "$ICON_HOST Host: $LOCAL_SERVER_NAME → $REMOTE_SERVER_NAME"
|
||||||
}
|
}
|
||||||
@@ -773,7 +782,7 @@ check_local_array() {
|
|||||||
check_remote_array() {
|
check_remote_array() {
|
||||||
log "Checking remote array on $REMOTE_SERVER_NAME..."
|
log "Checking remote array on $REMOTE_SERVER_NAME..."
|
||||||
local _spath result
|
local _spath result
|
||||||
_spath=$(platform_storage_path)
|
_spath="$REMOTE_STORAGE_PATH"
|
||||||
result=$(ssh -i "$SSH_KEY" -o ConnectTimeout=10 root@"$REMOTE_SERVER" \
|
result=$(ssh -i "$SSH_KEY" -o ConnectTimeout=10 root@"$REMOTE_SERVER" \
|
||||||
"mountpoint -q '$_spath' && echo yes || echo no" 2>/dev/null)
|
"mountpoint -q '$_spath' && echo yes || echo no" 2>/dev/null)
|
||||||
if [[ "$result" != "yes" ]]; then
|
if [[ "$result" != "yes" ]]; then
|
||||||
@@ -1000,8 +1009,7 @@ check_remote_disks() {
|
|||||||
done | sort -u" 2>/dev/null)
|
done | sort -u" 2>/dev/null)
|
||||||
|
|
||||||
# Tier 3 — storage root fallback
|
# Tier 3 — storage root fallback
|
||||||
local _spath
|
local _spath="$REMOTE_STORAGE_PATH"
|
||||||
_spath=$(platform_storage_path)
|
|
||||||
if [[ -z "$backing_disks" ]] && [[ -z "$zfs_pool_paths" ]]; then
|
if [[ -z "$backing_disks" ]] && [[ -z "$zfs_pool_paths" ]]; then
|
||||||
local on_user
|
local on_user
|
||||||
on_user=$(ssh -i "$SSH_KEY" root@"$REMOTE_SERVER" \
|
on_user=$(ssh -i "$SSH_KEY" root@"$REMOTE_SERVER" \
|
||||||
|
|||||||
Reference in New Issue
Block a user