Bug 1000357

Summary: vcpu hotplug without <acpi> feature fail but vcpucount updated
Product: Red Hat Enterprise Linux 6 Reporter: Wayne Sun <gsun>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: dyuan, honzhang, jiahu, mzhan, pkrempa, rbalakri, tlavigne, xuzhang
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-32.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1000354 Environment:
Last Closed: 2014-10-14 04:16:56 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: 1000354    
Bug Blocks:    

Description Wayne Sun 2013-08-23 09:28:37 UTC
This also exist on libvirt-0.10.2-23.el6.x86_64 with virsh setvcpus fail but xml/vcpucount is updated

# virsh setvcpus kvm-rhel6.4-x86_64-qcow2-ide 2
error: internal error got wrong number of vCPU pids from QEMU monitor. got 1, wanted 2

# echo $?
1

# virsh dumpxml kvm-rhel6.4-x86_64-qcow2-ide |grep vcpu
  <vcpu placement='static' current='2'>4</vcpu>

# virsh vcpucount kvm-rhel6.4-x86_64-qcow2-ide
maximum      config         4
maximum      live           4
current      config         1
current      live           2

# virsh vcpuinfo kvm-rhel6.4-x86_64-qcow2-ide
VCPU:           0
CPU:            50
State:          running
CPU time:       9.9s
CPU Affinity:   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

+++ This bug was initially created as a clone of Bug #1000354 +++

Description of problem:
Without <acpi> feature, virsh setvcpus not fail and xml/vcpucount/vcpuinfo updated.

Version-Release number of selected component (if applicable):
libvirt-1.1.1-2.el7.x86_64


How reproducible:
always

Steps to Reproduce:
1. edit domain
...
   <features>
     <apic/>
     <pae/>
   </features>
...
<vcpu current='1'>3</vcpu>
...

No <acpi> feature and current as 1.

2.  start domain

# virsh start rhel7
Domain rhel7 started

Login the guest and check

# cat /proc/cpuinfo|grep processor|wc -l
1


3. Hotplug the vcpu

# virsh setvcpus rhel7 2

# echo $?
0

# virsh dumpxml rhel7

...
   <vcpu placement='static' current='2'>4</vcpu>
...

# virsh vcpucount rhel7
maximum      config        32
maximum      live          32
current      config         1
current      live           2

# virsh vcpuinfo rhel7
VCPU:           0
CPU:            8
State:          running
CPU time:       12.9s
CPU Affinity:   yyyyyyyyyyyyyyyy

VCPU:           1
CPU:            12
State:          running
CPU Affinity:   yyyyyyyyyyyyyyyy


Login the guest and check

# cat /proc/cpuinfo|grep processor|wc -l
1


Actual results:
hotplug fail but vcpu info updated

Expected results:
xml not updated

Additional info:

Comment 2 Peter Krempa 2013-08-26 12:33:38 UTC
commit 761fc481365703b861429d73a341bde352ba8d41
Author: Peter Krempa <pkrempa>
Date:   Tue Jan 15 16:09:43 2013 +0100

    qemu: Don't update count of vCPUs if hot-unplug has failed

forgot to fix one more error path, thus the count is still updated in some cases of failure.

Comment 3 Peter Krempa 2013-08-26 13:14:14 UTC
Fixed upstream:

commit f17f164e3acefd590437da84cdcf08c63c7abb0b
Author: Peter Krempa <pkrempa>
Date:   Mon Aug 26 14:34:56 2013 +0200

    qemu: Don't update count of vCPUs if hot-plug fails silently
    
    When cpu hotplug fails without reporting an error, we would fail the
    command but update the count of vCPUs anyways.
    
    Commit 761fc481365703b861429d73a341bde352ba8d41 fixed the case when CPU
    hot-unplug failed silently, but forgot to fix up the value in this case.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1000357

Comment 10 Hu Jianwei 2014-04-14 08:28:59 UTC
I can reproduce it on libvirt-0.10.2-31.el6, but can not reproduce it on below version.

Version:
libvirt-0.10.2-32.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.423.el6.x86_64
kernel-2.6.32-456.el6.x86_64

Steps:
[root@intel-5205-32-2 ~]# virsh dumpxml r6 | grep features -A5
  <features>
    <apic/>
    <pae/>
  </features>
...

[root@intel-5205-32-2 ~]# virsh setvcpus r6 2
error: internal error got wrong number of vCPU pids from QEMU monitor. got 1, wanted 2

[root@intel-5205-32-2 ~]# echo $?
1
[root@intel-5205-32-2 ~]# virsh dumpxml r6| grep vcpu
  <vcpu placement='static' current='1'>4</vcpu>
[root@intel-5205-32-2 ~]# virsh vcpucount r6
maximum      config         4
maximum      live           4
current      config         1
current      live           1

[root@intel-5205-32-2 ~]# virsh vcpuinfo r6
VCPU:           0
CPU:            2
State:          running
CPU time:       34.5s
CPU Affinity:   yyyy

[In guest]:
[root@foo ~]# cat /proc/cpuinfo|grep processor|wc -l
1

We can get expected results, changed to verified.

Comment 12 errata-xmlrpc 2014-10-14 04:16:56 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