Skip to content

Commit e58d1dc

Browse files
authored
Add conditional logic for EFI disk allocation (#8024)
1 parent 2a765f5 commit e58d1dc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

vm/openwrt-vm.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,12 @@ msg_ok "Extracted OpenWrt Disk Image ${CL}${BL}$FILE${CL}"
530530
msg_info "Creating OpenWrt VM"
531531
qm create "$VMID" -cores "$CORE_COUNT" -memory "$RAM_SIZE" -name "$HN" \
532532
-onboot 1 -ostype l26 -scsihw virtio-scsi-pci --tablet 0
533-
pvesm alloc "$STORAGE" "$VMID" "vm-$VMID-disk-0" 4M >/dev/null
533+
if [[ "$(pvesm status | awk -v s=$STORAGE '$1==s {print $2}')" == "dir" ]]; then
534+
qm set "$VMID" -efidisk0 "${STORAGE}:0,efitype=4m,size=4M"
535+
else
536+
pvesm alloc "$STORAGE" "$VMID" "vm-$VMID-disk-0" 4M >/dev/null
537+
qm set "$VMID" -efidisk0 "${STORAGE}:vm-$VMID-disk-0,efitype=4m,size=4M"
538+
fi
534539

535540
IMPORT_OUT="$(qm importdisk "$VMID" "$FILE" "$STORAGE" --format raw 2>&1 || true)"
536541
DISK_REF="$(printf '%s\n' "$IMPORT_OUT" | sed -n "s/.*successfully imported disk '\([^']\+\)'.*/\1/p")"

0 commit comments

Comments
 (0)