Simplify netboot VM start by script.
This commit is contained in:
parent
0a0e942fd0
commit
138c4f7d7e
2 changed files with 38 additions and 0 deletions
24
roles/lmn_vm/files/vm-netboot
Executable file
24
roles/lmn_vm/files/vm-netboot
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# Start a netboot VM
|
||||
#
|
||||
set -eu
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
arg="--memory 4096 --vcpu 4"
|
||||
fi
|
||||
|
||||
# find macvtap interface MAC address:
|
||||
MAC="$(ip link | grep -A1 "vm-macvtap" | \
|
||||
sed -nE "s%\s+link/ether ([[:xdigit:]:]{17}) .+%\1%p")"
|
||||
|
||||
XDG_CONFIG_HOME="/tmp/${UID}/.config" \
|
||||
exec virt-install \
|
||||
--name bookworm \
|
||||
--osinfo debiantesting \
|
||||
--nodisks --import \
|
||||
--pxe --boot loader=/usr/share/OVMF/OVMF_CODE_4M.fd,\
|
||||
loader.readonly=yes,loader.type=pflash,\
|
||||
nvram.template=/usr/share/OVMF/OVMF_VARS_4M.fd \
|
||||
--network type=ethernet,mac=${MAC},\
|
||||
target.dev=vm-macvtap,xpath1.set=./target/@managed=no $@ ${arg:-}
|
Loading…
Add table
Add a link
Reference in a new issue