Files
proxmox/scripts/archive/small-scripts/migrate-to-pve2-thin1-simple.sh

44 lines
1.4 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
# Simple approach: Migrate 2 containers, then move storage to thin1
# This works around the pct migrate storage limitation
set -euo pipefail
# Load IP configuration
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
PROXMOX_HOST="${PROXMOX_HOST:-192.168.11.10}"
PROXMOX_PASS="${PROXMOX_PASS:-L@kers2010}"
ssh_proxmox() {
sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@"$PROXMOX_HOST" "$@"
}
echo "========================================="
echo "Migrate 2 containers to pve2 thin1"
echo "========================================="
echo ""
echo "Note: pct migrate doesn't support --storage parameter"
echo "We'll need to:"
echo "1. Migrate containers to pve2 (they'll try to use local-lvm which fails)"
echo "2. OR: Change storage approach"
echo ""
echo "Actually, let me check if we can use the API with storage parameter..."
echo ""
# Try API approach with storage
echo "Testing API migration with storage parameter..."
VMID=1500
# Get current container info
echo "Container 1500 current config:"
ssh_proxmox "pvesh get /nodes/ml110/lxc/$VMID/config --output-format json" 2>&1 | python3 -c "import sys, json; d=json.load(sys.stdin); print(f\"rootfs: {d.get('rootfs', 'N/A')}\")" 2>&1
echo ""
echo "Let's try migrating container 1500 using a two-step process:"
echo ""