Add VM metadata and naming

This commit is contained in:
Thales Maciel 2026-01-29 00:09:25 -03:00
parent 5b1de19cf5
commit e4039ca7e9
No known key found for this signature in database
GPG key ID: 33112E6833C34679
3 changed files with 435 additions and 2 deletions

7
run.sh
View file

@ -20,8 +20,9 @@ BR_DEV="br-fc"
BR_IP="172.16.0.1"
CIDR="24"
VM_ID="$(date +%s)-$$"
VM_TAG="${VM_ID##*-}"
VM_ID="$(head -c 32 /dev/urandom | xxd -p -c 256)"
VM_TAG="${VM_ID:0:8}"
VM_NAME="$(./namegen)"
VM_DIR="$STATE/vm-$VM_ID"
mkdir -p "$VM_DIR"
@ -153,7 +154,9 @@ log "starting virtual machine"
cat > "$VM_DIR/info" <<EOF
vm_id=$VM_ID
name=$VM_NAME
pid=$FC_PID
created_at=$(date -Iseconds)
guest_ip=$GUEST_IP
tap=$TAP_DEV
api_sock=$API_SOCK