Files
Sankofa/scripts/fix-ceph-rbd-storage.sh
defiQUG 33d50fb91e
Some checks failed
API CI / API Lint (push) Successful in 47s
API CI / API Type Check (push) Failing after 47s
API CI / API Test (push) Successful in 1m0s
API CI / API Build (push) Failing after 50s
API CI / Build Docker Image (push) Has been skipped
Build Crossplane Provider / build (push) Failing after 5m51s
CD Pipeline / Deploy to Staging (push) Failing after 29s
CI Pipeline / Lint and Type Check (push) Failing after 36s
CI Pipeline / Build (push) Has been skipped
CI Pipeline / Test Backend (push) Failing after 1m33s
CI Pipeline / Test Frontend (push) Failing after 30s
CI Pipeline / Security Scan (push) Failing after 1m16s
Crossplane Provider CI / Go Test (push) Failing after 3m23s
Crossplane Provider CI / Go Lint (push) Failing after 7m27s
Crossplane Provider CI / Go Build (push) Failing after 3m27s
Deploy to Staging / Deploy to Staging (push) Failing after 30s
Portal CI / Portal Lint (push) Failing after 21s
Portal CI / Portal Type Check (push) Failing after 21s
Portal CI / Portal Test (push) Failing after 21s
Portal CI / Portal Build (push) Failing after 22s
Test Suite / frontend-tests (push) Failing after 30s
Test Suite / api-tests (push) Failing after 49s
Test Suite / blockchain-tests (push) Failing after 30s
Type Check / type-check (map[directory:. name:root]) (push) Failing after 23s
Type Check / type-check (map[directory:api name:api]) (push) Failing after 21s
Type Check / type-check (map[directory:portal name:portal]) (push) Failing after 19s
Validate Configuration Files / validate (push) Failing after 1m52s
CD Pipeline / Deploy to Production (push) Has been skipped
chore: consolidate local WIP (repo cleanup 20260707)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 09:41:34 -07:00

164 lines
6.0 KiB
Bash
Executable File

#!/bin/bash
# Fix Ceph RBD storage configuration on r630-01
# This script fixes the "No such file or directory" error when accessing RBD storage
set -e
echo "═══════════════════════════════════════════════════════════════════════════════"
echo " FIX CEPH RBD STORAGE CONFIGURATION"
echo "═══════════════════════════════════════════════════════════════════════════════"
echo ""
# Check if running on r630-01
HOSTNAME=$(hostname)
if [ "$HOSTNAME" != "r630-01" ]; then
echo "⚠️ WARNING: This script should be run on r630-01"
echo " Current hostname: $HOSTNAME"
echo ""
echo "To run remotely via SSH:"
echo " ssh root@192.168.11.11 'bash -s' < $0"
echo ""
read -p "Continue anyway? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi
echo "Step 1: Checking Ceph cluster status..."
if ! command -v ceph &> /dev/null; then
echo "❌ ERROR: ceph command not found. Ceph packages may not be installed."
exit 1
fi
CEPH_HEALTH=$(ceph health detail)
echo "$CEPH_HEALTH"
if [[ "$CEPH_HEALTH" == *"HEALTH_ERR"* ]]; then
echo "❌ ERROR: Ceph cluster is in HEALTH_ERR state. Please fix Ceph issues first."
exit 1
fi
echo ""
echo "Step 2: Checking RBD pool 'rbd'..."
if ! ceph osd pool ls | grep -q "^rbd$"; then
echo " Creating RBD pool 'rbd'..."
ceph osd pool create rbd 32 32 || { echo "❌ Failed to create RBD pool 'rbd'"; exit 1; }
echo "✅ RBD pool 'rbd' created."
else
echo "✅ RBD pool 'rbd' exists."
fi
echo ""
echo "Step 3: Initializing RBD pool..."
if ! rbd pool init rbd 2>/dev/null; then
echo "⚠️ RBD pool 'rbd' already initialized or initialization failed."
else
echo "✅ RBD pool 'rbd' initialized."
fi
echo ""
echo "Step 4: Enabling RBD application on pool..."
if ! ceph osd pool application get rbd 2>/dev/null | grep -q "rbd"; then
echo " Enabling RBD application..."
ceph osd pool application enable rbd rbd || { echo "❌ Failed to enable RBD application"; exit 1; }
echo "✅ RBD application enabled."
else
echo "✅ RBD application already enabled."
fi
echo ""
echo "Step 5: Checking RBD pool status..."
if rbd ls -p rbd &>/dev/null; then
echo "✅ RBD pool is accessible."
echo " Images in pool:"
rbd ls -p rbd | head -5 || echo " (no images yet)"
else
echo "⚠️ RBD pool access test failed, but pool exists."
fi
echo ""
echo "Step 6: Checking Proxmox RBD storage configuration..."
if pvesm status 2>/dev/null | grep -q "ceph-rbd"; then
echo "✅ ceph-rbd storage exists in Proxmox."
echo ""
echo "Storage details:"
pvesm status | grep "ceph-rbd"
echo ""
# Check if storage needs to be removed and re-added
echo "Step 7: Verifying storage configuration..."
if pvesm status | grep "ceph-rbd" | grep -q "inactive"; then
echo "⚠️ Storage is inactive. Attempting to fix..."
# Get storage config
STORAGE_CFG="/etc/pve/storage.cfg"
if [ -f "$STORAGE_CFG" ]; then
echo " Current ceph-rbd storage config:"
grep -A 10 "^rbd: ceph-rbd" "$STORAGE_CFG" || echo " (not found in config)"
echo ""
echo " Removing and re-adding ceph-rbd storage..."
# Remove storage
pvesm remove ceph-rbd 2>/dev/null || echo " (storage may not exist or already removed)"
# Re-add storage
echo " Re-adding ceph-rbd storage..."
pvesm add rbd ceph-rbd \
--nodes r630-01 \
--pool rbd \
--content images \
--monhost 192.168.11.10:6789,192.168.11.11:6789 \
--username admin 2>&1 || {
echo "❌ Failed to re-add ceph-rbd storage."
echo " Try manually via Web UI: Datacenter → Storage → Add → RBD"
exit 1
}
echo "✅ ceph-rbd storage re-added."
fi
else
echo "✅ Storage appears to be active."
fi
else
echo "⚠️ ceph-rbd storage not found in Proxmox."
echo " Adding ceph-rbd storage..."
pvesm add rbd ceph-rbd \
--nodes r630-01 \
--pool rbd \
--content images \
--monhost 192.168.11.10:6789,192.168.11.11:6789 \
--username admin 2>&1 || {
echo "❌ Failed to add ceph-rbd storage."
exit 1
}
echo "✅ ceph-rbd storage added."
fi
echo ""
echo "Step 8: Testing RBD storage access..."
if pvesm list ceph-rbd &>/dev/null; then
echo "✅ RBD storage is accessible via Proxmox."
echo " Storage content:"
pvesm list ceph-rbd | head -5 || echo " (empty - no images yet)"
else
echo "⚠️ RBD storage listing failed, but storage exists."
echo " Error details:"
pvesm list ceph-rbd 2>&1 | head -3
fi
echo ""
echo "═══════════════════════════════════════════════════════════════════════════════"
echo " VERIFICATION"
echo "═══════════════════════════════════════════════════════════════════════════════"
echo "Checking storage status..."
pvesm status | grep "ceph-rbd" || echo "Storage 'ceph-rbd' not found in pvesm status"
echo ""
echo "✅ Fix complete! RBD storage should now be working."
echo ""
echo "If errors persist, check:"
echo " 1. Ceph cluster health: ceph health"
echo " 2. RBD pool exists: ceph osd pool ls | grep rbd"
echo " 3. RBD pool is initialized: rbd pool init rbd"
echo " 4. Ceph keyring is accessible: ls -la /etc/pve/priv/ceph/ceph-rbd.keyring"