RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 996466 - Incorrect return value when setvcpus using invalid vcpu number.
Summary: Incorrect return value when setvcpus using invalid vcpu number.
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.5
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 996552
TreeView+ depends on / blocked
 
Reported: 2013-08-13 08:29 UTC by Hao Liu
Modified: 2014-04-04 20:57 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 996552 (view as bug list)
Environment:
Last Closed: 2014-04-04 20:57:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Hao Liu 2013-08-13 08:29:14 UTC
Description of problem:
Incorrect return value when setvcpus using invalid vcpu number.

Version-Release number of selected component (if applicable):
libvirt-0.10.2-21.el6.x86_64
kernel-2.6.32-410.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.386.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. make sure a domain 'foo' is managed, no matter if started or shut off.
2. set vcpu number using an invalid number.
# virsh setvcpus foo --count invalid-number
3. check the return value.
# echo $?

Actual results:

output:
for step 2:
error: Invalid number of virtual CPUs
for step 3:
0

Expected results:
for step 3:
1

Additional Info:
in cmdSetvcpus of virsh-domain.c:
>   if (vshCommandOptInt(cmd, "count", &count) < 0 || count <= 0) {
>       vshError(ctl, "%s", _("Invalid number of virtual CPUs"));
>       goto cleanup;
>   }

might should be changed to:
>   if (vshCommandOptInt(cmd, "count", &count) < 0 || count <= 0) {
>       vshError(ctl, "%s", _("Invalid number of virtual CPUs"));
>       ret = false;
>       goto cleanup;
>   }

Comment 2 Peter Krempa 2013-08-13 12:29:08 UTC
Fixed upstream with:

commit 3abb6ec077f7fdc9ac9969b5c33f2c2d270903f3
Author: Peter Krempa <pkrempa>
Date:   Tue Aug 13 11:14:56 2013 +0200

    virsh-domain: Flip logic in cmdSetvcpus
    
    To avoid having to assign a failure code to the returned variable switch
    this function to negative logic. This will fix issue with invalid number
    of cpus returning success return code.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=996466

Comment 3 CongDong 2013-09-11 06:56:24 UTC
I can repruduce this with:
# rpm -qa libvirt kernel qemu-kvm
qemu-kvm-0.12.1.2-2.401.el6.x86_64
kernel-2.6.32-412.el6.x86_64
libvirt-0.10.2-23.el6.x86_64

Invalid value
# virsh setvcpus rhel6.4 asdf
error: Invalid number of virtual CPUs

# echo $?
0
# virsh setvcpus rhel6.4 --count -1 --config
error: Invalid number of virtual CPUs

# echo $?
0
# virsh setvcpus rhel6.4 --count -1
error: Invalid number of virtual CPUs

# echo $?
0

Result:
Error message:
error: Invalid number of virtual CPUs
But the reture value is always 0.

Comment 7 RHEL Program Management 2014-04-04 20:57:27 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.


Note You need to log in before you can comment on or make changes to this bug.