Skip to content

Commit

Permalink
incusd/instance/qemu: Fix handling of > 64 limits.cpu
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Sponsored-by: ActivePort (https://www.activeport.com.au)
  • Loading branch information
stgraber committed Mar 21, 2024
1 parent e474cf6 commit 94b1508
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/server/instance/drivers/driver_qemu_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ type qemuNumaEntry struct {
type qemuCPUOpts struct {
architecture string
cpuCount int
cpuRequested int
cpuSockets int
cpuCores int
cpuThreads int
Expand Down Expand Up @@ -489,6 +490,8 @@ func qemuCPU(opts *qemuCPUOpts, pinning bool) []cfgSection {
max := 64
if int(cpu.Total) < max {
max = int(cpu.Total)
} else if opts.cpuRequested > max {
max = opts.cpuRequested
} else if opts.cpuCount > max {
max = opts.cpuCount
}
Expand Down

0 comments on commit 94b1508

Please sign in to comment.