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

stress_boot: Fixed the issue of unequal number of vCPUs when booting vm #4120

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

yiqianwei
Copy link
Contributor

ID: 2602

@yiqianwei
Copy link
Contributor Author

yiqianwei commented Jul 29, 2024

Test results:
(1/1) Host_RHEL.mxx.u0.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.xx.0.x86_64.io-github-autotest-qemu.stress_boot.q35: PASS (380.55 s)

@yiqianwei
Copy link
Contributor Author

@yanan-fu and @jingzhao84 , Could you help to review this patch? thanks

@yanan-fu
Copy link
Contributor

There are not only 1 problems about the cpu topology in this case:

  1. Suggest align the vm cpu number to 2:
    vcpu_maxcpus = int(math.floor(float(vm_cpu_num) / 2) * 2)
  2. Do not set smp, set the vcpu_maxcpus only, avocado-vt will adjust the topology automatically
  3. If the vcpu_maxcpus=1, launch vm will failed as the default vcpu_sockets is 2, To resolve this issue, you can refer:
vcpu_sockets = 1
vcpu_cores = 1
vcpu_threads = 1

@yiqianwei
Copy link
Contributor Author

Test results:
(1/1) Host_RHEL.m10.u0.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.0.x86_64.io-github-autotest-qemu.stress_boot.q35: PASS (837.65 s)

@yiqianwei
Copy link
Contributor Author

@yanan-fu , I have updated this patch, please check it again,thanks

@yanan-fu
Copy link
Contributor

Suggest add one more checking:

if host_cpu_num <= max_vms:
    test.cancel("No enough physical cpus to pin all guests")

@yiqianwei
Copy link
Contributor Author

test.cancel("No enough physical cpus to pin all guests")

Hi @yanan-fu , Could I modify the code as follows? thanks

if host_cpu_num <= int(params.get("max_vms")):
    test.cancel("No enough physical cpus to pin all guests")
elif vm_cpu_num == 1:
    params["vcpu_sockets"] = 1
    params["vcpu_threads"] = 1
    params["vcpu_cores"] = 1
else:
    vm_cpu_num = int(math.floor(float(vm_cpu_num) / 2) * 2)

@yanan-fu yanan-fu merged commit ce29f01 into autotest:master Sep 25, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants