Bug 1035109

Summary: Implement the error message while plug more CPUs than set in "current" using the guest agent
Product: Red Hat Enterprise Linux 6 Reporter: zhenfeng wang <zhwang>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 6.5CC: ajia, dyuan, gsun, jmiao, mzhan, pkrempa, rbalakri, shyu, ydu, zsong
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-32.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1035108 Environment:
Last Closed: 2014-10-14 04:18:42 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:
Bug Depends On: 1035108    
Bug Blocks:    

Description zhenfeng wang 2013-11-27 05:49:50 UTC
+++ This bug was initially created as a clone of Bug #1035108 +++

Description of problem:
Implement the error message while plug more CPUs than set in "current" using the guest agent

Version-Release number of selected component (if applicable):
 qemu-kvm-rhev-1.5.3-19.el7.x86_64
 libvirt-1.1.1-13.el7.x86_64
 kernel-3.10.0-47.el7.x86_6
 qemu-guest-agent-1.5.3-19.el7.x86_64.rpm

How reproducible:
100%

Steps
1.Prepare a running guest with qemu-ga service installed
# virsh list
 Id    Name                           State
----------------------------------------------------
 32    rhel7                          running

# virsh dumpxml rhel7 |grep cpu -A 3
  <vcpu placement='static' current='1'>3</vcpu>

2. Start the qemu-guest-agent service in the guest
#systemctl start qemu-guest-agent

3. Do cpu hotpulug and plug more CPUs than set in "current" using the guest agent, it report an unclear error

# virsh setvcpus rhel7 --guest 2
error: internal error: guest agent reports less cpu than requested

# virsh vcpucount rhel7 --guest
1

4.Both rhel6 and rhel7 have the same result with step3   

Actual results:
Didn't report an clear error while plug more CPUs than set in "current" using the guest agent
Expected results:
Should report an clear error message

Comment 1 zhengqin 2014-02-21 03:09:08 UTC
Could reporduce it on RHEL6.5 with following packages:
qemu-kvm-rhev-0.12.1.2-2.415.el6_5.3.x86_64
libvirt-client-0.10.2-29.el6_5.2.x86_64
libvirt-0.10.2-29.el6_5.2.x86_64
qemu-guest-agent-0.12.1.2-2.415.el6.x86_64

The step is same with bug description, and the result shows below:
[root@red01 images]# virsh  dumpxml rhel6u5_qcow2 | grep vcpu
  <vcpu placement='static' current='1'>3</vcpu>
[root@red01 images]# virsh  setvcpus rhel6u5_qcow2 --guest 2
error: internal error guest agent reports less cpu than requested

[root@red01 images]# virsh  setvcpus rhel6u5_qcow2 --guest
error: command 'setvcpus' requires --count option
[root@red01 images]# virsh  vcpucount rhel6u5_qcow2 --guest         
1

Comment 3 Peter Krempa 2014-04-09 15:17:21 UTC
Fixed upstream:

commit 34b8449027adc44bd38151f384f5a5cdd64d996f
Author: Peter Krempa <pkrempa>
Date:   Thu Dec 5 17:47:14 2013 +0100

    qemu: Improve error when setting invalid count of vcpus via agent
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1035108
    
    When attempting to enable more vCPUs in the guest than is currently
    enabled in the guest but less than the maximum count for the VM we
    currently reported an unhelpful message:
    
     error: internal error: guest agent reports less cpu than requested
    
    This patch changes it to:
    
     error: invalid argument: requested vcpu count is greater than the count
     of enabled vcpus in the domain: 3 > 2

Comment 6 Jincheng Miao 2014-04-14 09:11:47 UTC
This bug is fixed in latest libvirt-0.10.2-32.el6, the verification steps are below:

# virsh dumpxml r6 | grep cpu -A 3
  <vcpu placement='auto' current='3'>5</vcpu>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>

# virsh setvcpus r6 4 --guest 
error: invalid argument: requested vcpu count is greater than the count of enabled vcpus in the domain: 4 > 3

# virsh vcpucount r6 --guest
3

# virsh setvcpus r6 2 --guest 

# virsh vcpucount r6 --guest
2

# virsh setvcpus r6 -1 --guest 
error: Invalid number of virtual CPUs

# virsh setvcpus r6 99999 --guest 
error: numerical overflow: input too large: 99999

# virsh setvcpus r6 9999 --guest 
error: invalid argument: requested vcpus is greater than max allowable vcpus for the domain: 9999 > 5

And I change the status to VERIFIED.

Comment 8 errata-xmlrpc 2014-10-14 04:18:42 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.

http://rhn.redhat.com/errata/RHBA-2014-1374.html