Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incusd/instance/drivers/qemu: Limit CPU flag calculation to x86_64 #992

Merged
merged 1 commit into from
Jul 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions internal/server/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}

Expand Down
Loading