Files
proxmox/scripts/move-pve2-vms-to-r630-02.sh.bak
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

117 lines
3.9 KiB
Bash

#!/bin/bash
# Move VM configurations from old pve2 node to r630-02
# This will make VMs visible on r630-02 after the node rename
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/load-physical-inventory.sh" 2>/dev/null || true
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m'
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
log_error() { echo -e "${RED}[✗]${NC} $1"; }
log_section() { echo -e "\n${CYAN}=== $1 ===${NC}\n"; }
ML110_IP="${PROXMOX_HOST_ML110:-192.168.11.10}"
ML110_PASS="${PROXMOX_PASS_ML110:-L@kers2010}"
log_section "Move VM Configs from pve2 to r630-02"
log_warn "This will move VM configuration files from /etc/pve/nodes/pve2/ to /etc/pve/nodes/r630-02/"
log_warn "This will make VMs visible on r630-02 after the node rename"
echo ""
read -p "Continue? (yes/no): " confirm
if [[ "$confirm" != "yes" ]]; then
log_info "Operation cancelled."
exit 0
fi
log_section "Backing up configurations"
sshpass -p "$ML110_PASS" ssh -o StrictHostKeyChecking=no root@"$ML110_IP" bash <<'ENDSSH'
# Backup pve2 directory
if [ -d /etc/pve/nodes/pve2 ]; then
cp -r /etc/pve/nodes/pve2 /etc/pve/nodes/pve2.backup.$(date +%Y%m%d_%H%M%S)
echo "Backup created: /etc/pve/nodes/pve2.backup.*"
fi
# Backup r630-02 directory if it exists
if [ -d /etc/pve/nodes/r630-02 ]; then
cp -r /etc/pve/nodes/r630-02 /etc/pve/nodes/r630-02.backup.$(date +%Y%m%d_%H%M%S)
echo "Backup created: /etc/pve/nodes/r630-02.backup.*"
fi
ENDSSH
log_section "Moving VM configurations"
sshpass -p "$ML110_PASS" ssh -o StrictHostKeyChecking=no root@"$ML110_IP" bash <<'ENDSSH'
# Ensure r630-02 directories exist
mkdir -p /etc/pve/nodes/r630-02/lxc
mkdir -p /etc/pve/nodes/r630-02/qemu-server
# Move LXC container configs
if [ -d /etc/pve/nodes/pve2/lxc ] && [ "$(ls -A /etc/pve/nodes/pve2/lxc 2>/dev/null)" ]; then
echo "Moving LXC container configs..."
for conf in /etc/pve/nodes/pve2/lxc/*.conf; do
if [ -f "$conf" ]; then
filename=$(basename "$conf")
echo " Moving: $filename"
mv "$conf" /etc/pve/nodes/r630-02/lxc/"$filename"
fi
done
echo "LXC configs moved"
else
echo "No LXC configs to move"
fi
# Move QEMU VM configs
if [ -d /etc/pve/nodes/pve2/qemu-server ] && [ "$(ls -A /etc/pve/nodes/pve2/qemu-server 2>/dev/null)" ]; then
echo "Moving QEMU VM configs..."
for conf in /etc/pve/nodes/pve2/qemu-server/*.conf; do
if [ -f "$conf" ]; then
filename=$(basename "$conf")
echo " Moving: $filename"
mv "$conf" /etc/pve/nodes/r630-02/qemu-server/"$filename"
fi
done
echo "QEMU configs moved"
else
echo "No QEMU configs to move"
fi
echo ""
echo "=== Summary ==="
echo "LXC configs in r630-02: $(ls -1 /etc/pve/nodes/r630-02/lxc/*.conf 2>/dev/null | wc -l)"
echo "QEMU configs in r630-02: $(ls -1 /etc/pve/nodes/r630-02/qemu-server/*.conf 2>/dev/null | wc -l)"
ENDSSH
log_section "Verification"
log_info "Checking VMs on r630-02..."
sshpass -p "password" ssh -o StrictHostKeyChecking=no root@192.168.11.12 bash <<'ENDSSH' 2>/dev/null
echo "=== Containers ==="
pct list 2>/dev/null | head -20
echo ""
echo "=== VMs ==="
qm list 2>/dev/null | head -20
echo ""
echo "=== Config Files ==="
echo "LXC configs: $(ls -1 /etc/pve/nodes/r630-02/lxc/*.conf 2>/dev/null | wc -l)"
echo "QEMU configs: $(ls -1 /etc/pve/nodes/r630-02/qemu-server/*.conf 2>/dev/null | wc -l)"
ENDSSH
log_section "Move Complete"
log_success "VM configurations moved from pve2 to r630-02!"
log_info "VMs should now be visible on r630-02"