-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate_rc.sh
More file actions
executable file
·109 lines (86 loc) · 2.62 KB
/
validate_rc.sh
File metadata and controls
executable file
·109 lines (86 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
set -e
# Ignite Release Candidate Validation Script
# Assumes 'ign' and 'ignited' are in target/release/ or available in PATH if configured.
# This script starts the daemon, runs a VM, checks it, and shuts down.
echo ">>> Setting up environment..."
export RUST_LOG=info
DAEMON_BIN="./target/release/ignited"
CLI_BIN="./target/release/ign"
PID_FILE="ignited.pid"
# Cleanup function
cleanup() {
echo ">>> Cleaning up..."
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
echo "Killing daemon PID $PID"
sudo kill $PID || true
rm "$PID_FILE"
fi
}
trap cleanup EXIT
# Add local bin to PATH for doctor
export PATH="$PATH:$PWD/bin"
echo ">>> Starting Daemon Check..."
# Check if port 3000 is open
if nc -z localhost 3000; then
echo ">>> Daemon appears to be running on port 3000. Skipping autostart."
else
echo ">>> Daemon NOT running. Starting with sudo..."
sudo $DAEMON_BIN > daemon.log 2>&1 &
echo $! > "$PID_FILE"
sleep 2 # Wait for startup
fi
echo ">>> Checking Doctor..."
$CLI_BIN doctor
echo ">>> Pulling Image (alpine:latest)..."
$CLI_BIN pull alpine:latest
echo ">>> Running VM..."
# Capture output to get ID? Or just list
$CLI_BIN run alpine:latest --vcpu 1 --memory 128
echo ">>> Listing VMs..."
$CLI_BIN ps
# We need the ID to stop it.
# Let's parse it from 'ps' output (assuming 1 running vm)
# Output format: ID IP Status
# Skip header
VM_ID=$($CLI_BIN ps | tail -n 1 | awk '{print $1}')
if [ -z "$VM_ID" ] || [ "$VM_ID" == "VM" ]; then
echo "!!! Failed to get VM ID. PS output:"
$CLI_BIN ps
exit 1
fi
echo ">>> Details for VM: $VM_ID"
echo ">>> Stopping VM..."
$CLI_BIN stop $VM_ID
sleep 1
echo ">>> Final PS (Should be empty or stopped)..."
$CLI_BIN ps
echo ">>> Validation Passed!"
echo ">>> Testing Volume Mounts (Phase 9 Verification)..."
mkdir -p test_vol
echo "Hello from Host" > test_vol/hello.txt
# Run VM with volume
echo "Running VM with -v $(pwd)/test_vol:/mnt"
$CLI_BIN run alpine:latest --volumes "$(pwd)/test_vol:/mnt" > run_vol.out
cat run_vol.out
VM_ID_VOL=$(grep "VM ID:" run_vol.out | awk '{print $3}')
if [ -z "$VM_ID_VOL" ]; then
echo "Volume run failed. Check run_vol.out"
exit 1
fi
echo "Waiting for VM $VM_ID_VOL to stabilize..."
sleep 3
# Check if virtiofsd is running
if pgrep -f "virtiofsd" > /dev/null; then
echo "SUCCESS: VirtioFS Daemon is running!"
else
echo "FAILURE: VirtioFS Daemon NOT found!"
$CLI_BIN stop $VM_ID_VOL
exit 1
fi
# Cleanup Volume VM
echo "Stopping Volume VM..."
$CLI_BIN stop $VM_ID_VOL
rm -rf test_vol run_vol.out
echo ">>> All Verification Checks Completed Successfully!"