Skip to content

Commit

Permalink
chore: improve cluster create UX on aarch64
Browse files Browse the repository at this point in the history
Improve cluster create UX on aarch64.

Signed-off-by: Noel Georgi <git@frezbo.dev>
  • Loading branch information
frezbo committed Aug 16, 2024
1 parent 45cc868 commit 6f969e3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pkg/provision/providers/qemu/arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type PFlash struct {
func (arch Arch) PFlash(uefiEnabled bool, extraUEFISearchPaths []string) []PFlash {
switch arch {
case ArchArm64:
uefiSourcePaths := []string{"/usr/share/qemu-efi-aarch64/QEMU_EFI.fd", "/usr/share/OVMF/QEMU_EFI.fd"}
uefiSourcePaths := []string{"/usr/share/qemu-efi-aarch64/QEMU_EFI.fd", "/usr/share/OVMF/QEMU_EFI.fd", "/usr/share/edk2/aarch64/QEMU_EFI.fd"}
for _, p := range extraUEFISearchPaths {
uefiSourcePaths = append(uefiSourcePaths, filepath.Join(p, "QEMU_EFI.fd"))
}
Expand Down Expand Up @@ -178,3 +178,8 @@ func (arch Arch) QemuExecutable() string {

return ""
}

// Architecture returns the architecture.
func (arch Arch) Architecture() string {
return string(arch)
}
8 changes: 7 additions & 1 deletion pkg/provision/providers/qemu/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type LaunchConfig struct {
VCPUCount int64
MemSize int64
QemuExecutable string
Architecture string
KernelImagePath string
InitrdPath string
ISOPath string
Expand Down Expand Up @@ -392,7 +393,12 @@ func launchVM(config *LaunchConfig) error {
machineArg := config.MachineType

if config.EnableKVM {
machineArg += ",accel=kvm,smm=on"
machineArg += ",accel=kvm"

// smm is not supported on aarch64
if Arch(config.QemuExecutable) == ArchAmd64 {
machineArg += ",smm=on"
}
}

args = append(args, "-machine", machineArg)
Expand Down
1 change: 1 addition & 0 deletions pkg/provision/providers/qemu/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func (p *provisioner) createNode(state *vm.State, clusterReq provision.ClusterRe

launchConfig := LaunchConfig{
QemuExecutable: arch.QemuExecutable(),
Architecture: arch.Architecture(),
DiskPaths: diskPaths,
DiskDrivers: xslices.Map(nodeReq.Disks, func(disk *provision.Disk) string {
return disk.Driver
Expand Down

0 comments on commit 6f969e3

Please sign in to comment.