photoncloud-monorepo/baremetal/vm-cluster/launch-node02.sh
centra 5c6eb04a46 T036: Add VM cluster deployment configs for nixos-anywhere
- netboot-base.nix with SSH key auth
- Launch scripts for node01/02/03
- Node configuration.nix and disko.nix
- Nix modules for first-boot automation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-11 09:59:19 +09:00

58 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# Node02 VM Launch Script
# Connects to multicast socket network 230.0.0.1:1234
# Boots via PXE
set -euo pipefail
MCAST_ADDR="230.0.0.1:1234"
MAC_ADDR="52:54:00:00:01:02"
DISK="node02.qcow2"
VNC_DISPLAY=":2"
SERIAL_LOG="node02-serial.log"
# Check if disk exists
if [ ! -f "$DISK" ]; then
echo "Error: Disk image $DISK not found"
exit 1
fi
# Check if already running
if pgrep -f "qemu-system-x86_64.*$DISK" > /dev/null; then
echo "Node02 VM is already running (PID: $(pgrep -f "qemu-system-x86_64.*$DISK"))"
exit 1
fi
echo "Starting Node02 VM..."
echo " MAC: $MAC_ADDR"
echo " Multicast: $MCAST_ADDR"
echo " VNC: $VNC_DISPLAY (port 5902)"
echo " Serial log: $SERIAL_LOG"
echo " Boot: PXE (network boot enabled)"
# Launch QEMU with:
# - 8 vCPUs, 16GB RAM (per T036 spec)
# - Multicast socket networking
# - VNC display
# - Serial console logging
# - PXE boot enabled via iPXE ROM
exec qemu-system-x86_64 \
-name node02 \
-machine type=q35,accel=kvm \
-cpu host \
-smp 8 \
-m 16G \
-drive file="$DISK",if=virtio,format=qcow2 \
-netdev socket,mcast="$MCAST_ADDR",id=mcast0 \
-device virtio-net-pci,netdev=mcast0,mac="$MAC_ADDR",romfile= \
-boot order=n \
-vnc "$VNC_DISPLAY" \
-serial telnet:localhost:4442,server,nowait \
-daemonize \
-pidfile node02.pid
echo "Node02 VM started (PID: $(cat node02.pid))"
echo "Connect via VNC: vncviewer localhost:5902"
echo "Connect via Telnet: telnet localhost 4442"
echo "Serial log: tail -f $SERIAL_LOG"