From ee24c49a275268f08f9dd060fba1256699fee65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Sat, 13 Jul 2024 00:10:41 -0400 Subject: [PATCH] incusd/instance/drivers/qemu: Limit CPU flag calculation to x86_64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "kvm64" CPU definition doesn't exist on aarch64 and possibly on other platforms, so restrict the logic to x86_64 for the time being. Signed-off-by: Stéphane Graber --- .../server/instance/drivers/driver_qemu.go | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/internal/server/instance/drivers/driver_qemu.go b/internal/server/instance/drivers/driver_qemu.go index 315d56a5cd7..0e0c6c2d6a8 100644 --- a/internal/server/instance/drivers/driver_qemu.go +++ b/internal/server/instance/drivers/driver_qemu.go @@ -1498,8 +1498,8 @@ func (d *qemu) start(stateful bool, op *operationlock.InstanceOperation) error { cpuType := "host" - // Get CPU flags if clustered and migration is enabled. - if d.state.ServerClustered && util.IsTrue(d.expandedConfig["migration.stateful"]) { + // Get CPU flags if clustered and migration is enabled (x86_64 only for now). + if d.architecture != osarch.ARCH_64BIT_INTEL_X86 && d.state.ServerClustered && util.IsTrue(d.expandedConfig["migration.stateful"]) { cpuFlags, err := d.getClusterCPUFlags() if err != nil { op.Done(err) @@ -8681,24 +8681,26 @@ func (d *qemu) checkFeatures(hostArch int, qemuPath string) (map[string]any, err features["vhost_net"] = struct{}{} } - // Get the host CPU model. - model, err := monitor.QueryCPUModel("kvm64") - if err != nil { - return nil, err - } + // Get the host CPU model (x86_64 only for now). + if hostArch != osarch.ARCH_64BIT_INTEL_X86 { + model, err := monitor.QueryCPUModel("kvm64") + if err != nil { + return nil, err + } - cpuFlags := map[string]bool{} - for k, v := range model.Flags { - value, ok := v.(bool) - if !ok { - continue + cpuFlags := map[string]bool{} + for k, v := range model.Flags { + value, ok := v.(bool) + if !ok { + continue + } + + cpuFlags[k] = value } - cpuFlags[k] = value + features["flags"] = cpuFlags } - features["flags"] = cpuFlags - return features, nil }