mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: arm image support UEFI by default
This commit is contained in:
@@ -58,6 +58,7 @@ type ImageOptionalOptions struct {
|
||||
DiskDriver string `help:"Perfer disk driver" choices:"virtio|scsi|pvscsi|ide|sata"`
|
||||
NetDriver string `help:"Preferred network driver" choices:"virtio|e1000|vmxnet3"`
|
||||
DisableUsbKbd bool `help:"Disable usb keyboard on this image(for hypervisor kvm)"`
|
||||
BootMode string `help:"UEFI support" choices:"UEFI|BIOS"`
|
||||
}
|
||||
|
||||
func addImageOptionalOptions(s *mcclient.ClientSession, params *jsonutils.JSONDict, args ImageOptionalOptions) error {
|
||||
@@ -138,6 +139,11 @@ func addImageOptionalOptions(s *mcclient.ClientSession, params *jsonutils.JSONDi
|
||||
if args.DisableUsbKbd {
|
||||
params.Add(jsonutils.NewString("true"), "properties", "disable_usb_kbd")
|
||||
}
|
||||
if args.BootMode == "UEFI" {
|
||||
params.Add(jsonutils.JSONTrue, "properties", "uefi_support")
|
||||
} else if args.BootMode == "BIOS" {
|
||||
params.Add(jsonutils.JSONFalse, "properties", "uefi_support")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1193,11 +1193,19 @@ func (manager *SGuestManager) validateCreateData(
|
||||
}
|
||||
}
|
||||
|
||||
if arch := imgProperties["os_arch"]; strings.Contains(arch, "aarch") || strings.Contains(arch, "arm") {
|
||||
input.OsArch = apis.OS_ARCH_AARCH64
|
||||
}
|
||||
|
||||
imgSupportUEFI := imgProperties[imageapi.IMAGE_UEFI_SUPPORT] == "true"
|
||||
// imgIsWindows := imgProperties[imageapi.IMAGE_OS_TYPE] == "Windows"
|
||||
// if imgSupportUEFI && imgIsWindows && len(input.IsolatedDevices) > 0 {
|
||||
// input.Bios = "UEFI" // windows gpu passthrough
|
||||
// }
|
||||
if input.OsArch == apis.OS_ARCH_AARCH64 {
|
||||
// arm image supports UEFI by default
|
||||
imgSupportUEFI = true
|
||||
}
|
||||
|
||||
if imgSupportUEFI {
|
||||
if len(input.Bios) == 0 {
|
||||
@@ -1212,10 +1220,6 @@ func (manager *SGuestManager) validateCreateData(
|
||||
}
|
||||
}
|
||||
|
||||
if arch := imgProperties["os_arch"]; strings.Contains(arch, "aarch") {
|
||||
input.OsArch = apis.OS_ARCH_AARCH64
|
||||
}
|
||||
|
||||
if len(imgProperties) == 0 {
|
||||
imgProperties = map[string]string{"os_type": "Linux"}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user