Bug 1248277
Summary: | no error output when pass a negative number to setvcpus | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Luyao Huang <lhuang> |
Component: | libvirt | Assignee: | Libvirt Maintainers <libvirt-maint> |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | low | Docs Contact: | |
Priority: | low | ||
Version: | 7.2 | CC: | dyuan, mzhan, pkrempa, rbalakri, yafu |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | libvirt-1.3.1-1.el7 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2016-11-03 18:21:39 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Luyao Huang
2015-07-30 02:44:33 UTC
Send a patch to upstream: https://www.redhat.com/archives/libvir-list/2015-July/msg01109.html Fixed upstream: commit c62c59a9840cde925f4f88fddf639e434bcef33d Author: Luyao Huang <lhuang> AuthorDate: Thu Oct 22 11:27:35 2015 +0800 Commit: Andrea Bolognani <abologna> CommitDate: Thu Oct 22 09:22:44 2015 +0200 virsh: Display an error when passing count <= 0 to setvcpus The number of vCPUs for a guest must be between 1 and the maximum value configured in the domain XML. This commit introduces checks to make sure that passing count <= 0 results in an error. Passed with version libvirt-1.3.1-1.el7.x86_64. steps: 1.#virsh setvcpus rhel7.2 0 error: Can't set 0 processors for a VM 2.#virsh setvcpus rhel7.2 -1 error: Numeric value '-1' for <count> option is malformed or out of range 3.#virsh setvcpus rhel7.2 4294967296 error: Numeric value '4294967296' for <count> option is malformed or out of range 4.#virsh setvcpus rhel7.2 4294967295 error: invalid argument: requested vcpus is greater than max allowable vcpus for the domain: -1 > 1 5.#virsh setvcpus rhel7.2 4294967297 error: Numeric value '4294967297' for <count> option is malformed or out of range Reproduced with libvirt-1.2.17-2.el7.x86_64. Verified pass with libvirt-2.0.0-5.el7.x86_64. steps: 1.virsh setvcpus rhel7.2 0 error: Can't set 0 processors for a VM 2.#virsh setvcpus rhel7.2 -1 error: Numeric value '-1' for <count> option is malformed or out of range 3.#virsh setvcpus rhle7.2 -4294967296 error: Numeric value '-4294967296' for <count> option is malformed or out of range 4.virsh setvcpus rhel7 -4.0 error: Numeric value '-4.1' for <count> option is malformed or out of range Hi,Peter, When I pass a number between 2^31 to 2^32-1,the error output is strange: 1.#virsh setvcpus rhel7.2 2147483648 error: invalid argument: requested vcpus is greater than max allowable vcpus for the domain: -2147483648 > 4 2.# virsh setvcpus rhel7 4294967295 error: invalid argument: requested vcpus is greater than max allowable vcpus for the domain: -1 > 4 Would you help to check whether it needs to be fixed please? Thank you! The problem is in the format character in the error message: if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM) && nvcpus > maxvcpus) { virReportError(VIR_ERR_INVALID_ARG, _("requested vcpus is greater than max allowable" " vcpus for the domain: %d > %d"), nvcpus, maxvcpus); goto endjob; } Both nvcpus and maxvcpus are unsigned. I'll post a patch upstream. The error message should make more sense as of: commit e96041ff1ac270b719e43bf0e3d5a224fe61c26a Author: Peter Krempa <pkrempa> Date: Wed Aug 3 12:57:23 2016 +0200 qemu: setcpus: Report better errors Mention whether it was the live or persistent definition which caused an error reported and explicitly error out in case when attempting to set maximum vcpu count for a live domain. According to comment 5, move this BZ to verified. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-2577.html |