sandia-minimega / minimega

minimega
GNU General Public License v3.0
148 stars 68 forks source link

Unsufficient amount of CPU cores allocated #1527

Closed Narratot closed 8 months ago

Narratot commented 9 months ago

Describe your environment

  1. minimega version minimega 48a8fe511406bfd78468c0acd3fedaa5dfb9a09a 2023-11-28
  2. Linux distro/version ubuntu 20.04
  3. Go compiler version current
  4. VM types all

Describe the bug I am not able to create guests with more than 2 CPU cores (I am within the phenix frontend).

To Reproduce Steps to reproduce the behavior:

  1. Only specifiy vm.VCPUs (neither vm.Cores, vm.Threads, vm.Sockets)

Expected behavior I expect the guests to have the defied core count.

Narratot commented 9 months ago

Within https://github.com/sandia-minimega/minimega/blob/master/cmd/minimega/kvm.go change lines 1313 to 1323 to

smp := strconv.FormatUint(vm.VCPUs, 10)
    if vm.Cores != 0 {
        smp = "cores=" + strconv.FormatUint(vm.Cores, 10)
    } else {
        smp = "cores=" + strconv.FormatUint(vm.VCPUs, 10)
    }
    if vm.Threads != 0 {
        smp += ",threads=" + strconv.FormatUint(vm.Threads, 10)
    }
    if vm.Sockets != 0 {
        smp += ",sockets=" + strconv.FormatUint(vm.Sockets, 10)
    } else {
        smp += ",sockets=" + strconv.FormatUint(1, 10)
    }

The proposed change should enable the VM to have the allocated core count.

activeshadow commented 9 months ago

Within https://github.com/sandia-minimega/minimega/blob/master/cmd/minimega/kvm.go change lines 1313 to 1323 to

smp := strconv.FormatUint(vm.VCPUs, 10)
  if vm.Cores != 0 {
      smp = "cores=" + strconv.FormatUint(vm.Cores, 10)
  } else {
      smp = "cores=" + strconv.FormatUint(vm.VCPUs, 10)
  }
  if vm.Threads != 0 {
      smp += ",threads=" + strconv.FormatUint(vm.Threads, 10)
  }
  if vm.Sockets != 0 {
      smp += ",sockets=" + strconv.FormatUint(vm.Sockets, 10)
  } else {
      smp += ",sockets=" + strconv.FormatUint(1, 10)
  }

The proposed change should enable the VM to have the allocated core count.

Hi @Narratot this looks like great content for a PR if you would like to submit one!

activeshadow commented 9 months ago

@Narratot scratch that, I missed the PR you already submitted. :joy: Thank you!

jacdavi commented 8 months ago

Fixed by #1531