s6 bhyve fuckstack schlimmer gemacht

This commit is contained in:
Fritz Grimpen 2025-01-04 03:36:17 +01:00
parent 167702d345
commit da0941bdef
4 changed files with 21 additions and 27 deletions

View File

@ -241,6 +241,8 @@ bhyve_guests:
- DISKS
disks:
- name: disk
virtio: true
virtio_slot: 8
properties:
volsize: 128g
volblocksize: 64k

View File

@ -25,7 +25,7 @@
label: 'bhyve-{{ item.0.name }}{{ item.1.name }}'
with_nested:
- '{{ bhyve_guests }}'
- '{{ bhyve_templates }}'
- '{{ bhyve_templates }}'
notify:
- Reload s6-rc

View File

@ -1,5 +1,5 @@
{% set disks = [] %}
{% for disk in item.0.disks %}
{% for disk in item.0.disks if not disk.virtio|default(False) %}
{{- disks.append("hd:/dev/zvol/"+bhyve_pool+"/bhyve/guests/"+item.0.name+"/"+disk.name) -}}
{% endfor %}
{{ disks | join(",") }}

View File

@ -1,9 +1,9 @@
#!/usr/local/bin/execlineb -P
# {{ ansible_managed }}
# {{ ansible_managed }}
s6-envdir ./env
multisubstitute {
importas -i -u NAME NAME
importas -i -u NAME NAME
importas -i -u -s ORDER ORDER
importas -i -u RAM RAM
importas -i -u ROM ROM
@ -15,7 +15,7 @@ multisubstitute {
}
backtick -n AHCI {
forx X { $ORDER }
forx X { $ORDER }
importas X X
importas Y $X
echo -n ,$Y
@ -29,25 +29,17 @@ foreground { fdmove -c 1 2 echo "bhyve-${NAME}: Starting VM ${NAME} with ${CPUS}
s6-notifyoncheck -d -w 100 -n 70
fdmove -c 2 1
# Use a static password to make VNC clients happy
ifelse { test -n "$PASS" } {
bhyve -c "${CPUS}" -m "${RAM}" -w -A -P -H
-s "0,amd_hostbridge"
-s "2:0,ahci${AHCI}"
-s "3,virtio-net,${NIC}"
-s "4,virtio-rnd"
-s "29,fbuf,tcp=[::1]:${PORT},w=800,h=600,password=${PASS}"
-s "31,lpc"
-l "com1,/dev/${COM}"
-l "bootrom,${ROM}"
"${NAME}"
}
bhyve -c "${CPUS}" -m "${RAM}" -w -A -P -H
-s "0,amd_hostbridge"
-s "2:0,ahci${AHCI}"
-s "3,virtio-net,${NIC}"
-s "4,virtio-rnd"
-s "31,lpc"
-l "com1,/dev/${COM}"
-l "bootrom,${ROM}"
"${NAME}"
bhyve -c "{{ item.0.cpus }}" -m "{{ item.0.ram }}" -w -A -P -h
-s "0,amd_hostbridge"
-s "2:0,ahci${AHCI}"
-s "3,virtio-net,${NIC}"
-s "4,virtio-rnd"
{% for disk in item.0.disks if disk.virtio|default(False) -%}
-s "{{ disk.virtio_slot }},virtio,/dev/zvol/{{ bhyve_pool }}/bhyve/guests/{{ item.0.name }}/{{ disk.name }}"
{% endfor -%}
{% if item.0.password is defined -%}
-s "29,fbuf,tcp=[::1]:${PORT},w=800,h=600,password=${PASS}"
{% endif -%}
-s "31,lpc"
-l "com1,/dev/${COM}"
-l "bootrom,${ROM}"