Bug 701872

Summary: libvirt-python did not catch libvirt setvcpus error of setting too many vcpus
Product: Red Hat Enterprise Linux 5 Reporter: Wayne Sun <gsun>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.7CC: dallan, dyuan, gren, hjiang, mshao, yupzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-15 19:45:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Wayne Sun 2011-05-04 06:40:24 UTC
Description of problem:
When run set guest vcpu number bigger than guest max vcpu number, an error msg will be thrown out:
# virsh setvcpus rhel5 8
error: Too many virtual CPUs.

But under libvirt-python:
# python
Python 2.4.3 (#1, Dec 10 2010, 17:24:35) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import libvirt
>>> conn = libvirt.open("")
>>> domobj  = conn.lookupByName("rhel5")
>>> domobj.setVcpus(8)
0

The return value is 0, which recoginze as success, this is not expected. 

Version-Release number of selected component (if applicable):
build: RHEL5.7-Server-20110430.2
kernel: 2.6.18-238.9.1.el5xen
packages:
libvirt-0.8.2-18.el5
libvirt-python-0.8.2-18.el5
xen-3.0.3-130.el5

How reproducible:
always

Steps to Reproduce:
1.as description
2.
3.
  
Actual results:
libvirt-python did not catch the error

Expected results:
libvirt-python can catch the error

Additional info:

Comment 1 Huming Jiang 2011-06-01 05:06:45 UTC
Could reproduce this bug on the following components of rh5.6:
kernel-xen-2.6.18-238.el5
libvirt-0.8.2-15.el5
xen-3.0.3-120.el5
libvirt-python-0.8.2-15.el5
virt-manager-0.6.1-13.el5

Steps:
# virsh setvcpus a 33
error: Too many virtual CPUs.

But under libvirt-python:
# python
Python 2.4.3 (#1, Dec 10 2010, 17:24:35) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import libvirt
>>> conn = libvirt.open("")
>>> domobj  = conn.lookupByName("a")
>>> domobj.setVcpus(33)
0

Comment 2 RHEL Program Management 2011-06-20 22:45:00 UTC
This request was evaluated by Red Hat Product Management for inclusion in Red Hat Enterprise Linux 5.7 and Red Hat does not plan to fix this issue the currently developed update.

Contact your manager or support representative in case you need to escalate this bug.

Comment 4 RHEL Program Management 2011-08-15 19:45:41 UTC
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request.

Comment 5 yuping zhang 2012-07-05 07:08:14 UTC
Test with libvirt-0.8.2-27.el5.Now libvirt-python can catch the error message.

# virsh setvcpus demo 33
error: Too many virtual CPUs.

# python
Python 2.4.3 (#1, Jun 20 2012, 20:08:35) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open("")
>>> domobj = conn.lookupByName("demo")
>>> domobj.setVcpus(33)
libvir: QEMU error : invalid argument in requested vcpus is greater than max allowable vcpus for the domain: 33 > 16
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.4/site-packages/libvirt.py", line 651, in setVcpus
    if ret == -1: raise libvirtError ('virDomainSetVcpus() failed', dom=self)
libvirt.libvirtError: invalid argument in requested vcpus is greater than max allowable vcpus for the domain: 33 > 16