Bug 847198

Summary: The count of vcpu with config flag should be compared with the maximum vcpus with config flag
Product: Red Hat Enterprise Linux 7 Reporter: hongming <honzhang>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 7.0CC: cwei, dyuan, lhuang, mzhan, pkrempa, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.16-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:35:38 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 hongming 2012-08-10 05:08:14 UTC
Description of problem:
When set the count of vcpu with config flag , the  value should be less than  or equal to the maximum vcpus with config flag rather than the maximum vcpus with current flag. 

Version-Release number of selected component (if applicable):
libvirt-0.10.0-0rc0.el6.x86_64
qemu-kvm-0.12.1.2-2.295.el6.x86_64
kernel-2.6.32-276.el6.x86_64 

How reproducible:
100% 

Steps to Reproduce:

1.# virsh vcpucount rhel6q
maximum      config        15
maximum      live          10
current      config         5
current      live           2


2. # virsh setvcpus rhel6q 15 --config
error: invalid argument: requested vcpus is greater than max allowable vcpus for the domain: 15 > 10
(It shoud be  compared  with the maximum and config value- "15" , rather than the maximum and current value "10" )


3.# virsh setvcpus rhel6q 10 --config


4. # virsh vcpucount rhel6q
maximum      config        15
maximum      live          10
current      config        10
current      live           2

  
Actual results:
The setting count value of vcpu with config flag is compared with the the maximum value of vcpu with current flag. 

Expected results:
The setting count value of vcpu with config flag should be compared  with  the maximum value of vcpus with config flag ,rather than the maximum vcpus with current flag


Additional info:

Comment 4 Laine Stump 2013-07-02 07:12:16 UTC
Moving to RHEL6.6 for capacity reasons.

Comment 7 Jiri Denemark 2014-04-04 21:36:42 UTC
This bug was not selected to be addressed in Red Hat Enterprise Linux 6. We will look at it again within the Red Hat Enterprise Linux 7 product.

Comment 10 Peter Krempa 2015-05-15 09:14:47 UTC
Fixed upstream in:

commit 60f7303c151cccdbe214b9f9ac59ecaf95cbf24b
Author: Eric Blake <eblake>
Date:   Fri Jan 24 10:52:23 2014 -0700

    qemu: adjust maxmem/maxvcpu computation
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1038363
    
    If a domain has a different maximum for persistent and live maxmem
    or max vcpus, then it is possible to hit cases where libvirt
    refuses to adjust the current values or gets halfway through
    the adjustment before failing.  Better is to determine up front
    if the change is possible for all requested flags.
    
    Based on an idea by Geoff Franks.
    
    * src/qemu/qemu_driver.c (qemuDomainSetMemoryFlags): Compute
    correct maximum if both live and config are being set.
    (qemuDomainSetVcpusFlags): Likewise.
    
    Signed-off-by: Eric Blake <eblake>

v1.2.1-280-g60f7303

Comment 12 Luyao Huang 2015-08-31 08:40:45 UTC
I can reproduce this issue with libvirt-1.1.1-29.el7_0.4.x86_64:

1. prepare a guest with 15 maximum vcpus and 10 current vcpus
# virsh start test4
Domain test4 started

2.
# virsh vcpucount test4
maximum      config        15
maximum      live          15
current      config        10
current      live          10

3.
# virsh setvcpus test4 20 --config --maximum 

4.
# virsh vcpucount test4
maximum      config        20
maximum      live          15
current      config        10
current      live          10

5.
# virsh setvcpus test4 20 --config
error: invalid argument: requested vcpus is greater than max allowable vcpus for the domain: 20 > 15


And verify this bug with libvirt-1.2.17-6.el7.x86_64:

1. 
# virsh vcpucount test4
maximum      config        15
current      config        10

2.
# virsh vcpucount test4
maximum      config        15
maximum      live          15
current      config        10
current      live          10

3.
# virsh setvcpus test4 20 --config --maximum 

4.
# virsh vcpucount test4
maximum      config        20
maximum      live          15
current      config        10
current      live          10

5.
# virsh setvcpus test4 20 --config

6.
# virsh vcpucount test4
maximum      config        20
maximum      live          15
current      config        20
current      live          10

7.

# virsh dumpxml test4 --inactive
<domain type='kvm'>
  <name>test4</name>
  <uuid>b1e7936b-104b-430e-9211-d6c61b8df313</uuid>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>559104</currentMemory>
  <vcpu placement='static' cpuset='0-1'>20</vcpu>

Comment 14 errata-xmlrpc 2015-11-19 05:35:38 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/RHBA-2015-2202.html