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
disks: disks:
- name: disk - name: disk
virtio: true
virtio_slot: 8
properties: properties:
volsize: 128g volsize: 128g
volblocksize: 64k volblocksize: 64k

View File

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

View File

@ -1,5 +1,5 @@
{% set disks = [] %} {% 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) -}} {{- disks.append("hd:/dev/zvol/"+bhyve_pool+"/bhyve/guests/"+item.0.name+"/"+disk.name) -}}
{% endfor %} {% endfor %}
{{ disks | join(",") }} {{ disks | join(",") }}

View File

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