RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1377071 - guestVcpus fail with wrong argument number.
Summary: guestVcpus fail with wrong argument number.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt-python
Version: 7.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: lcheng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-18 08:04 UTC by lcheng
Modified: 2017-08-01 15:01 UTC (History)
3 users (show)

Fixed In Version: libvirt-python-2.5.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 15:01:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1847 0 normal SHIPPED_LIVE libvirt-python bug fix update 2017-08-01 17:49:33 UTC

Description lcheng 2016-09-18 08:04:50 UTC
Description of problem:
guestVcpus fail with wrong argument number. 

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

How reproducible:
100%

Steps to Reproduce:

# python
Python 2.7.5 (default, Aug  2 2016, 04:20:16) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> import os
>>> conn = libvirt.open()
>>> dom = conn.lookupByName("r73")
>>> dom.guestVcpus()
>>> vcpu = {}
>>> num = 0
>>> dom.guestVcpus(vcpu, num)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1268, in guestVcpus
    ret = libvirtmod.virDomainGetGuestVcpus(self._o, params, nparams, flags)
TypeError: virDomainGetGuestVcpus() takes exactly 2 arguments (4 given)


Actual results:
As above.

Expected results:
Get guest vcpus information.

Comment 2 Peter Krempa 2016-09-19 15:20:09 UTC
Fixed upstream:

commit 0061566872ed3fdf7b0ec101c20d3ddb78093a06
Author: Peter Krempa <pkrempa>
Date:   Mon Sep 19 13:54:37 2016 +0200

    override: Properly override wrapper for virDomainGetGuestVcpus
    
    Without the change to libvirt-override-api.xml generator.py would
    generate the following function header:
    
        def guestVcpus(self, params, nparams, flags=0):
    
    Since @params and @nparams are output-only in C and the python C
    implementation actualy creates a dict from them we should not need to
    pass them. Add the API definition to drop the two unnecessary args:
    
        def guestVcpus(self, flags=0):
    
    The code did not work at all until this change as the C impl expects
    only two arguments but the python required use of four.

Comment 4 lcheng 2016-12-09 07:30:39 UTC
Verified on libvirt-python-2.5.0-1.el7.x86_64. 

# python
Python 2.7.5 (default, Aug  2 2016, 04:20:16) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> import os
>>> conn = libvirt.open()
>>> dom = conn.lookupByName('test')
>>> dom.guestVcpus()
{'vcpus': '0-5', 'offlinable': '0-5', 'online': '0-5'}
>>> dom.setGuestVcpus('1,3', 0)
0
>>> dom.guestVcpus()
{'vcpus': '0-5', 'offlinable': '0-5', 'online': '0,2,4-5'}

Comment 5 errata-xmlrpc 2017-08-01 15:01:57 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://access.redhat.com/errata/RHEA-2017:1847


Note You need to log in before you can comment on or make changes to this bug.