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
Co-authored-by: Cursor <cursoragent@cursor.com>
113 lines
4.3 KiB
Bash
Executable File
113 lines
4.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Copy cloud image from ISO storage to local-lvm storage
|
|
|
|
set -euo pipefail
|
|
|
|
echo "═══════════════════════════════════════════════════════════════════════════════"
|
|
echo " COPY IMAGE TO local-lvm STORAGE"
|
|
echo "═══════════════════════════════════════════════════════════════════════════════"
|
|
echo ""
|
|
|
|
SOURCE_IMAGE="/var/lib/vz/template/iso/ubuntu-22.04-cloud.img"
|
|
TARGET_STORAGE="local-lvm"
|
|
IMAGE_NAME="ubuntu-22.04-cloud"
|
|
|
|
# Check if source exists
|
|
echo "Step 1: Checking if source image exists..."
|
|
if [ ! -f "$SOURCE_IMAGE" ]; then
|
|
echo "❌ Source image not found: $SOURCE_IMAGE"
|
|
exit 1
|
|
fi
|
|
|
|
IMAGE_SIZE=$(du -h "$SOURCE_IMAGE" | cut -f1)
|
|
echo "✅ Source image found: $SOURCE_IMAGE ($IMAGE_SIZE)"
|
|
echo ""
|
|
|
|
# Check if target storage exists
|
|
echo "Step 2: Checking if target storage exists..."
|
|
if ! pvesm status | grep -q "^${TARGET_STORAGE}"; then
|
|
echo "❌ Target storage '$TARGET_STORAGE' not found"
|
|
exit 1
|
|
fi
|
|
echo "✅ Target storage '$TARGET_STORAGE' exists"
|
|
echo ""
|
|
|
|
# Check if image already exists in local-lvm
|
|
echo "Step 3: Checking if image already exists in local-lvm..."
|
|
if pvesm list "$TARGET_STORAGE" 2>/dev/null | grep -q "${IMAGE_NAME}"; then
|
|
echo "⚠️ Image already exists in local-lvm"
|
|
echo " Skipping copy (image is ready to use)"
|
|
exit 0
|
|
fi
|
|
echo "✅ Image not found in local-lvm (will copy)"
|
|
echo ""
|
|
|
|
# Copy image using pvesm copy
|
|
echo "Step 4: Copying image to local-lvm storage..."
|
|
echo " This may take a few minutes for a 660MB image..."
|
|
echo ""
|
|
|
|
# Use pvesm copy to copy from local:iso/ to local-lvm
|
|
SOURCE_VOLID="local:iso/ubuntu-22.04-cloud.img"
|
|
TARGET_VOLID="${TARGET_STORAGE}:${IMAGE_NAME}.img"
|
|
|
|
echo " Copying from $SOURCE_VOLID to $TARGET_VOLID..."
|
|
if pvesm copy "$SOURCE_VOLID" "$TARGET_VOLID" 2>&1; then
|
|
echo "✅ Copy successful"
|
|
else
|
|
echo "⚠️ pvesm copy failed, trying alternative method..."
|
|
|
|
# Alternative: Use qm disk import with a temporary VM
|
|
TEMP_VMID=9999
|
|
|
|
# Clean up any existing temp VM
|
|
qm destroy "$TEMP_VMID" 2>/dev/null || true
|
|
|
|
# Create a temporary VM for import
|
|
echo " Creating temporary VM for import..."
|
|
qm create "$TEMP_VMID" \
|
|
--name "temp-import" \
|
|
--memory 512 \
|
|
--net0 virtio,bridge=vmbr0 \
|
|
--agent enabled=1 2>/dev/null || true
|
|
|
|
# Import the disk
|
|
echo " Importing disk..."
|
|
if qm disk import "$TEMP_VMID" "$SOURCE_IMAGE" "$TARGET_STORAGE" --format qcow2 2>&1; then
|
|
echo "✅ Import successful"
|
|
# Clean up temp VM
|
|
qm destroy "$TEMP_VMID" 2>/dev/null || true
|
|
else
|
|
echo "❌ Import failed"
|
|
# Clean up temp VM
|
|
qm destroy "$TEMP_VMID" 2>/dev/null || true
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Verify import
|
|
echo ""
|
|
echo "Step 5: Verifying import..."
|
|
sleep 2 # Give Proxmox a moment to refresh
|
|
if pvesm list "$TARGET_STORAGE" 2>/dev/null | grep -q "${IMAGE_NAME}"; then
|
|
echo "✅ Image found in local-lvm storage"
|
|
else
|
|
echo "⚠️ Image copied but not visible in pvesm list yet"
|
|
echo " This is normal - Proxmox may need a moment to refresh"
|
|
echo " The image should be available shortly"
|
|
fi
|
|
|
|
echo ""
|
|
echo "═══════════════════════════════════════════════════════════════════════════════"
|
|
echo " VERIFICATION"
|
|
echo "═══════════════════════════════════════════════════════════════════════════════"
|
|
echo ""
|
|
echo "Checking local-lvm storage contents..."
|
|
pvesm list "$TARGET_STORAGE" 2>/dev/null | grep -E "ubuntu-22.04|IMAGE_NAME" | head -5 || echo "Image should be available soon"
|
|
echo ""
|
|
echo "✅ Setup complete! Image should now be available in local-lvm storage."
|
|
echo ""
|
|
echo "📝 Next Steps:"
|
|
echo " The provider will automatically discover the image when creating VMs"
|
|
|