From 1b4ab443cebcf5d3ec1a950be4a4ad952bd91fcd Mon Sep 17 00:00:00 2001 From: MickLesk <47820557+MickLesk@users.noreply.github.com> Date: Mon, 26 Oct 2026 10:29:29 +0100 Subject: [PATCH] VMs: pass the machine type, CPU, disk cache and discard settings to qm MikroTik RouterOS asked for machine type, CPU model and disk cache and used none of them, nor its discard/ssd flags. HAOS and TrueNAS dropped the chosen disk cache, UniFi OS Server the discard/ssd flags. Fixes #18211 --- vm/haos-vm.sh | 2 +- vm/mikrotik-routeros.sh | 4 ++-- vm/truenas-vm.sh | 2 +- vm/unifi-os-server-vm.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vm/haos-vm.sh b/vm/haos-vm.sh index 2325a0c98..8047a5e9a 100644 --- a/vm/haos-vm.sh +++ b/vm/haos-vm.sh @@ -149,7 +149,7 @@ rm -f "$FILE_IMG" msg_info "Attaching EFI and root disk" qm set $VMID \ --efidisk0 ${STORAGE}:0,efitype=4m \ - --scsi0 ${DISK_REF},ssd=1,discard=on \ + --scsi0 ${DISK_REF},${DISK_CACHE}ssd=1,discard=on \ --boot order=scsi0 \ --serial0 socket >/dev/null qm set $VMID --agent enabled=1 >/dev/null diff --git a/vm/mikrotik-routeros.sh b/vm/mikrotik-routeros.sh index 6d7fa8205..710e38207 100644 --- a/vm/mikrotik-routeros.sh +++ b/vm/mikrotik-routeros.sh @@ -201,12 +201,12 @@ DISK_REF="${STORAGE}:${DISK_REF:-}${DISK_VAR:-}" msg_ok "Extracted Mikrotik RouterOS CHR Disk Image" msg_info "Creating Mikrotik RouterOS CHR VM" -qm create $VMID -tablet 0 -localtime 1 -cores $CORE_COUNT -memory $RAM_SIZE -name $HN \ +qm create $VMID${MACHINE} -tablet 0 -localtime 1${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE -name $HN \ -tags community-script -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU \ -onboot 1 -ostype l26 -scsihw virtio-scsi-pci qm importdisk $VMID "$FILE" $STORAGE ${DISK_IMPORT:-} 1>&/dev/null qm set $VMID \ - -scsi0 "$DISK_REF" \ + -scsi0 "${DISK_REF},${DISK_CACHE}${THIN%,}" \ -boot order=scsi0 >/dev/null set_description diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index df71d26e4..4a76c3ba1 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -161,7 +161,7 @@ msg_info "Creating TrueNAS VM shell" qm create "$VMID"${MACHINE} -bios ovmf -agent enabled=1 -tablet 0 -localtime 1${CPU_TYPE} \ -cores "$CORE_COUNT" -memory "$RAM_SIZE" -balloon 0 -name "$HN" -tags community-script \ -net0 "virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU" -onboot 1 -ostype l26 \ - -efidisk0 $STORAGE:1,efitype=4m,pre-enrolled-keys=0 -sata0 ${STORAGE}:${DISK_SIZE%G},ssd=1 \ + -efidisk0 $STORAGE:1,efitype=4m,pre-enrolled-keys=0 -sata0 ${STORAGE}:${DISK_SIZE%G},${DISK_CACHE}ssd=1 \ -scsihw virtio-scsi-single -cdrom "$ISO_VOLUME" -boot order='sata0;ide2' -vga virtio >/dev/null msg_ok "Created VM shell" diff --git a/vm/unifi-os-server-vm.sh b/vm/unifi-os-server-vm.sh index 8b4d8ab5f..913676f6f 100644 --- a/vm/unifi-os-server-vm.sh +++ b/vm/unifi-os-server-vm.sh @@ -374,7 +374,7 @@ vm_import_disk "$VMID" "$FILE" "$STORAGE" "$DISK_IMPORT_FORMAT" qm set "$VMID" \ -efidisk0 "${STORAGE}:0,efitype=4m" \ - -scsi0 "${VM_IMPORTED_DISK},${DISK_CACHE}size=${DISK_SIZE}" \ + -scsi0 "${VM_IMPORTED_DISK},${DISK_CACHE}${THIN}size=${DISK_SIZE}" \ -boot order=scsi0 -serial0 socket >/dev/null vm_resize_disk qm set "$VMID" --agent enabled=1 >/dev/null