Bug 1070680
| Summary: | cpu-stats boundary value problem | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Jincheng Miao <jmiao> | 
| Component: | libvirt | Assignee: | Ján Tomko <jtomko> | 
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | 
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.0 | CC: | dyuan, gsun, honzhang, jtomko, mzhan, rbalakri, vivianzhang | 
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.7-1.el7 | Doc Type: | Bug Fix | 
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-03-05 07:30: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
        
        
          Jincheng Miao
        
        
        
        
        
          2014-02-27 11:01:01 UTC
        
       Upstream patch has been posted by Jincheng Miao in February: https://www.redhat.com/archives/libvir-list/2014-February/msg01579.html I've sent a series fixing the problem and cleaning up the function: https://www.redhat.com/archives/libvir-list/2014-April/msg00172.html The series is now pushed upstream, with this commit fixing the boundary check:
commit 9fe5267adecc6c87074ce673626a73ea4d9f2d6e
Author:     Ján Tomko <jtomko>
CommitDate: 2014-04-09 16:24:08 +0200
    Check maximum startcpu value correctly
    
    The cpus are indexed from 0, so a startcpu value equal
    to the number of CPUs is invalid.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1070680
git describe: v1.2.3-103-g9fe5267
I can produce this bug on build libvirt-1.1.1-23.el7.x86_64 verify it on build libvirt-1.2.8-9.el7.x86_64 qemu-kvm-rhev-2.1.2-12.el7.x86_64 kernel-3.10.0-208.el7.x86_64 verify steps: 1. check valid cpu id # lscpu |grep CPU CPU op-mode(s): 32-bit, 64-bit CPU(s): 8 On-line CPU(s) list: 0-7 CPU family: 6 Model name: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz CPU MHz: 3878.921 NUMA node0 CPU(s): 0-7 so the max cpu id is 7 2. get cpu stats start from 8, error reported to inform maximum is 7 # virsh cpu-stats rhel7new --start 8 error: Failed to retrieve CPU statistics for domain 'rhel7new' error: invalid argument: start_cpu 8 larger than maximum of 7 # echo $? 1 3. get cpu stats start from 7, return value is normal # virsh cpu-stats rhel7new --start 7 CPU7: cpu_time 0.358009875 seconds vcpu_time 0.000042752 seconds # echo $? 0 4. try more # virsh cpu-stats rhel7new --start 9 error: Failed to retrieve CPU statistics for domain 'rhel7new' error: invalid argument: start_cpu 9 larger than maximum of 7 5. verify more steps about cpu-stats # virsh cpu-stats rhel7new --start 7 --total CPU7: cpu_time 0.418870727 seconds vcpu_time 0.000000000 seconds Total: cpu_time 25.916091411 seconds user_time 2.800000000 seconds system_time 4.220000000 seconds [root@server images]# virsh cpu-stats rhel7new --start 7 --total --count 0 Total: cpu_time 26.096086335 seconds user_time 2.800000000 seconds system_time 4.230000000 seconds [root@server images]# virsh cpu-stats rhel7new --start 7 --total --count 1 CPU7: cpu_time 0.418979441 seconds vcpu_time 0.000000000 seconds Total: cpu_time 26.115569245 seconds user_time 2.800000000 seconds system_time 4.230000000 seconds [root@server images]# virsh cpu-stats rhel7new --start 2 --total --count 3 CPU2: cpu_time 2.835158656 seconds vcpu_time 1.799808960 seconds CPU3: cpu_time 3.713079677 seconds vcpu_time 3.231146174 seconds CPU4: cpu_time 3.254891858 seconds vcpu_time 2.849673348 seconds Total: cpu_time 26.151207055 seconds user_time 2.810000000 seconds system_time 4.230000000 seconds [root@server images]# virsh cpu-stats rhel7new --start 2 --total --count 8 CPU2: cpu_time 2.836865893 seconds vcpu_time 1.799808960 seconds CPU3: cpu_time 3.723412885 seconds vcpu_time 3.235013680 seconds CPU4: cpu_time 3.262947951 seconds vcpu_time 2.849673348 seconds CPU5: cpu_time 3.709556985 seconds vcpu_time 3.500103878 seconds CPU6: cpu_time 0.011104798 seconds vcpu_time 0.000921704 seconds CPU7: cpu_time 0.418979441 seconds vcpu_time 0.000000000 seconds Total: cpu_time 26.178165567 seconds user_time 2.810000000 seconds system_time 4.230000000 seconds [root@server images]# virsh cpu-stats rhel7new --start 9 --count 8 error: Failed to retrieve CPU statistics for domain 'rhel7new' error: invalid argument: start_cpu 9 larger than maximum of 7 [root@server images]# virsh cpu-stats rhel7new --start 7 --count 8 CPU7: cpu_time 2.124014381 seconds vcpu_time 1.585571433 seconds [root@server images]# virsh cpu-stats rhel7new --start 7 --count 0 [root@server images]# virsh cpu-stats rhel7new --start 7 --count 1 CPU7: cpu_time 2.144098909 seconds vcpu_time 1.585571433 seconds [root@server images]# virsh cpu-stats rhel7new --start 7 --count 3333 Only 8 CPUs available to show CPU7: cpu_time 2.144098909 seconds vcpu_time 1.585571433 seconds [root@server images]# virsh cpu-stats rhel7new --start 7 --count aa error: Unable to parse integer parameter for CPUs to show [root@server images]# virsh cpu-stats rhel7new --start a error: Unable to parse integer parameter for start above steps are all right behaviour about cpu-stats move 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-2015-0323.html |