Bug 1331228

Summary: No error messages for cpu-stats with --start option.
Product: Red Hat Enterprise Linux 7 Reporter: yalzhang <yalzhang>
Component: libvirtAssignee: Andrea Bolognani <abologna>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: dyuan, fjin, jsuchane, lhuang, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.3.4-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:43:49 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 yalzhang@redhat.com 2016-04-28 03:53:14 UTC
Description of problem:
No error messages for cpu-stats with --start option.

Version-Release number of selected component (if applicable):
libvirt-1.3.3-2.el7.x86_64
qemu-kvm-rhev-2.5.0-4.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
# virsh cpu-stats R7.2
CPU0:
    cpu_time             9.798005025 seconds
    vcpu_time            9.364671581 seconds
CPU1:
    cpu_time             9.076250379 seconds
    vcpu_time            8.675238766 seconds
CPU2:
    cpu_time             7.054429959 seconds
    vcpu_time            6.625330794 seconds
CPU3:
    cpu_time             5.368119343 seconds
    vcpu_time            4.751755399 seconds
Total:
    cpu_time            31.296804706 seconds
    user_time            1.100000000 seconds
    system_time         13.560000000 seconds

2.
# virsh cpu-stats R7.2 --start 4

# echo $?
0

3.
# virsh cpu-stats R7.2 --start 5

# echo $?
1

Actual results:
There are no error messages if cpu-stats with the option --start larger than maximum cpu number.


Expected results:
step 2 the "echo $?" should be "1", and for step 2 and step 3, there should be error messages such as:
# virsh cpu-stats rhel62 --start 4
error: Failed to retrieve CPU statistics for domain 'rhel62'
error: invalid argument: start_cpu 4 larger than maximum of 3

Additional info:
N/A

Comment 2 Jaroslav Suchanek 2016-04-29 12:54:01 UTC
Fixed by:

commit 0ed35e0939c8ee2c38dbb4d67233e864499287ee
Author: Nitesh Konkar <niteshkonkar.libvirt>
Date:   Fri Apr 15 03:28:53 2016 -0400

    Return error when --start <number> in cpu-stats is invalid.
    
    Signed-off-by: Nitesh Konkar <nitkon12.ibm.com>

Comment 4 yalzhang@redhat.com 2016-05-08 09:05:10 UTC
verified on libvirt-1.3.4-1.el7.x86_64, all the results is as expected.

# virsh cpu-stats rh7.2
CPU0:
	cpu_time             8.133394075 seconds
	vcpu_time            7.614799103 seconds
CPU1:
	cpu_time             8.736083836 seconds
	vcpu_time            8.023468680 seconds
CPU2:
	cpu_time             7.717729821 seconds
	vcpu_time            7.020648041 seconds
CPU3:
	cpu_time             9.465514535 seconds
	vcpu_time            8.454502046 seconds
Total:
	cpu_time            34.052722267 seconds
	user_time            1.190000000 seconds
	system_time         14.220000000 seconds

# virsh cpu-stats rh7.2 --start 4
error: Start CPU 4 is out of range (min: 0, max: 3)
# echo $?
1

# virsh cpu-stats rh7.2 --start -1
error: Invalid value for start CPU
# echo $?
1

# virsh cpu-stats rh7.2 --start 6555234
error: Start CPU 6555234 is out of range (min: 0, max: 3)
# echo $?
1
# virsh cpu-stats rh7.2 --start sdf
error: Numeric value 'sdf' for <start> option is malformed or out of range
# echo $?
1

# virsh cpu-stats rh7.2 --start ' '
error: Numeric value ' ' for <start> option is malformed or out of range
# echo $?
1

# virsh cpu-stats rh7.2 --start ''
error: Numeric value '' for <start> option is malformed or out of range
# echo $?
1

change the bug to verified.

Comment 6 errata-xmlrpc 2016-11-03 18:43:49 UTC
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