VMs: pass the machine type, CPU, disk cache and discard settings to qm (#18232)

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
This commit is contained in:
CanbiZ (MickLesk)
2026-10-26 11:13:59 +01:00
committed by GitHub
parent 9a0863d319
commit 7d5857f1b9
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -149,7 +149,7 @@ rm -f "$FILE_IMG"
msg_info "Attaching EFI and root disk" msg_info "Attaching EFI and root disk"
qm set $VMID \ qm set $VMID \
--efidisk0 ${STORAGE}:0,efitype=4m \ --efidisk0 ${STORAGE}:0,efitype=4m \
--scsi0 ${DISK_REF},ssd=1,discard=on \ --scsi0 ${DISK_REF},${DISK_CACHE}ssd=1,discard=on \
--boot order=scsi0 \ --boot order=scsi0 \
--serial0 socket >/dev/null --serial0 socket >/dev/null
qm set $VMID --agent enabled=1 >/dev/null qm set $VMID --agent enabled=1 >/dev/null
+2 -2
View File
@@ -201,12 +201,12 @@ DISK_REF="${STORAGE}:${DISK_REF:-}${DISK_VAR:-}"
msg_ok "Extracted Mikrotik RouterOS CHR Disk Image" msg_ok "Extracted Mikrotik RouterOS CHR Disk Image"
msg_info "Creating Mikrotik RouterOS CHR VM" 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 \ -tags community-script -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU \
-onboot 1 -ostype l26 -scsihw virtio-scsi-pci -onboot 1 -ostype l26 -scsihw virtio-scsi-pci
qm importdisk $VMID "$FILE" $STORAGE ${DISK_IMPORT:-} 1>&/dev/null qm importdisk $VMID "$FILE" $STORAGE ${DISK_IMPORT:-} 1>&/dev/null
qm set $VMID \ qm set $VMID \
-scsi0 "$DISK_REF" \ -scsi0 "${DISK_REF},${DISK_CACHE}${THIN%,}" \
-boot order=scsi0 >/dev/null -boot order=scsi0 >/dev/null
set_description set_description
+1 -1
View File
@@ -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} \ 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 \ -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 \ -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 -scsihw virtio-scsi-single -cdrom "$ISO_VOLUME" -boot order='sata0;ide2' -vga virtio >/dev/null
msg_ok "Created VM shell" msg_ok "Created VM shell"
+1 -1
View File
@@ -374,7 +374,7 @@ vm_import_disk "$VMID" "$FILE" "$STORAGE" "$DISK_IMPORT_FORMAT"
qm set "$VMID" \ qm set "$VMID" \
-efidisk0 "${STORAGE}:0,efitype=4m" \ -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 -boot order=scsi0 -serial0 socket >/dev/null
vm_resize_disk vm_resize_disk
qm set "$VMID" --agent enabled=1 >/dev/null qm set "$VMID" --agent enabled=1 >/dev/null