diff --git a/README.md b/README.md index 3582223..29c5a41 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,21 @@ ssh -i "./id_ed25519" root@ reboot ``` +## VM Info File +Each VM writes a metadata file at `state/vm-*/info` with the following fields: +- `vm_id`: unique identifier for the VM instance. +- `pid`: Firecracker process ID. +- `created_at`: timestamp when the VM was launched. +- `guest_ip`: IP address assigned to the guest. +- `tap`: host TAP interface name attached to the bridge. +- `api_sock`: path to the Firecracker API socket. +- `log`: path to the Firecracker log file. +- `base_loop`: loop device backing the base rootfs (if present). +- `cow_file`: copy-on-write image file (if present). +- `cow_loop`: loop device for the COW image (if present). +- `dm_name`: device-mapper name for the merged rootfs (if present). +- `dm_dev`: device-mapper device path for the merged rootfs (if present). + ## Log Notes - `PCI: Fatal: No config space access function found` and `MissingAddressRange` lines are expected with `pci=off` in `run.sh`. - `SELinux: Could not open policy file ...` is expected in the minimal rootfs. diff --git a/namegen b/namegen new file mode 100755 index 0000000..ed133a8 --- /dev/null +++ b/namegen @@ -0,0 +1,415 @@ +#!/usr/bin/env bash +set -euo pipefail + +ADJECTIVES=( + ace + apt + fit + fun + odd + top + able + beau + bold + calm + chic + cool + deep + deft + easy + epic + fair + fine + free + full + game + glad + glow + good + holy + keen + kind + lean + mild + neat + nice + open + pure + real + snug + spry + tidy + true + warm + wavy + wise + adept + agile + alert + alive + ample + angel + awake + aware + brave + brisk + chill + clean + clear + close + comic + eager + elite + first + fleet + fresh + grace + grand + great + happy + hardy + ideal + jolly + light + lithe + loyal + lucid + lucky + lunar + magic + merry + nifty + noble + peppy + perky + proud + quick + quiet + ready + regal + savvy + sharp + smart + solid + sound + sunny + super + sweet + swift + vivid + witty + zesty +) + +SUBSTANTIVES=( + ox + aim + air + arm + bud + day + hay + jam + jay + joy + key + map + may + nod + ore + pen + sky + sun + way + zen + ant + ape + auk + bat + bee + cat + cod + cow + dog + elk + fox + hen + owl + pig + ram + rat + yak + boar + buck + bull + calf + carp + crab + crow + deer + dove + fish + foal + frog + goat + gull + hare + hawk + ibex + kiwi + kudu + lamb + lion + lynx + mink + mole + mule + newt + orca + oryx + puma + seal + slug + stag + swan + tern + toad + tuna + wasp + wolf + zebu + bison + camel + crane + eagle + finch + goose + heron + hippo + horse + hyena + koala + llama + macaw + moose + otter + quail + raven + robin + shark + sheep + shrew + skunk + sloth + snail + squid + tapir + tiger + trout + whale + zebra + ally + arch + area + aura + axis + bank + barn + beam + bell + belt + bend + bird + boat + bond + book + boot + bowl + brim + calm + camp + card + care + cell + city + clan + club + code + core + crux + dawn + deal + film + firm + flag + flow + foam + gate + gift + glow + hall + hand + harp + hill + home + hope + host + idea + isle + item + keel + knot + land + leaf + link + lion + loom + love + luck + mark + moon + moss + nook + note + pact + page + path + peak + poem + port + ring + road + rock + roof + rule + sail + seal + seed + song + star + tide + tree + tune + walk + ward + wave + well + wind + wing + wish + wood + work + zone + amity + asset + bloom + brook + bunch + charm + chart + cheer + chord + cliff + cloud + coast + comet + craft + crane + crest + crowd + crown + cycle + faith + field + flame + fleet + focus + forge + frame + fruit + glade + grace + grain + grove + guide + guild + haven + heart + honey + honor + humor + image + index + jewel + judge + kudos + lumen + lunar + magic + march + marsh + mercy + model + moral + music + niche + oasis + ocean + opera + orbit + order + peace + pearl + petal + phase + piano + pilot + place + plaza + prism + proof + pulse + quest + quiet + quill + radar + rally + range + realm + reign + river + route + scene + scope + score + shade + shape + shore + skill + spark + spice + spire + spoke + stone + story + table + token + trend + tribe + trust + unity + valor + value + verse + vista + voice + world +) + +rand() { + echo $(( RANDOM % $1 )) +} + +adjective="${ADJECTIVES[$(rand ${#ADJECTIVES[@]})]}" + substantive="${SUBSTANTIVES[$(rand ${#SUBSTANTIVES[@]})]}" + printf '%s_%s' "$adjective" "$substantive" diff --git a/run.sh b/run.sh index 762f6b5..89f87d4 100755 --- a/run.sh +++ b/run.sh @@ -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" <