Add VM metadata and naming
This commit is contained in:
parent
5b1de19cf5
commit
e4039ca7e9
3 changed files with 435 additions and 2 deletions
15
README.md
15
README.md
|
|
@ -27,6 +27,21 @@ ssh -i "./id_ed25519" root@<guest_ip>
|
||||||
reboot
|
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
|
## Log Notes
|
||||||
- `PCI: Fatal: No config space access function found` and `MissingAddressRange` lines are expected with `pci=off` in `run.sh`.
|
- `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.
|
- `SELinux: Could not open policy file ...` is expected in the minimal rootfs.
|
||||||
|
|
|
||||||
415
namegen
Executable file
415
namegen
Executable file
|
|
@ -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"
|
||||||
7
run.sh
7
run.sh
|
|
@ -20,8 +20,9 @@ BR_DEV="br-fc"
|
||||||
BR_IP="172.16.0.1"
|
BR_IP="172.16.0.1"
|
||||||
CIDR="24"
|
CIDR="24"
|
||||||
|
|
||||||
VM_ID="$(date +%s)-$$"
|
VM_ID="$(head -c 32 /dev/urandom | xxd -p -c 256)"
|
||||||
VM_TAG="${VM_ID##*-}"
|
VM_TAG="${VM_ID:0:8}"
|
||||||
|
VM_NAME="$(./namegen)"
|
||||||
VM_DIR="$STATE/vm-$VM_ID"
|
VM_DIR="$STATE/vm-$VM_ID"
|
||||||
mkdir -p "$VM_DIR"
|
mkdir -p "$VM_DIR"
|
||||||
|
|
||||||
|
|
@ -153,7 +154,9 @@ log "starting virtual machine"
|
||||||
|
|
||||||
cat > "$VM_DIR/info" <<EOF
|
cat > "$VM_DIR/info" <<EOF
|
||||||
vm_id=$VM_ID
|
vm_id=$VM_ID
|
||||||
|
name=$VM_NAME
|
||||||
pid=$FC_PID
|
pid=$FC_PID
|
||||||
|
created_at=$(date -Iseconds)
|
||||||
guest_ip=$GUEST_IP
|
guest_ip=$GUEST_IP
|
||||||
tap=$TAP_DEV
|
tap=$TAP_DEV
|
||||||
api_sock=$API_SOCK
|
api_sock=$API_SOCK
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue