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 770971 - Expose 'virDomain{Get,Set}InterfaceParameters' APIs in python binding
Summary: Expose 'virDomain{Get,Set}InterfaceParameters' APIs in python binding
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.3
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Alex Jia
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 771015 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-30 16:40 UTC by Alex Jia
Modified: 2012-06-20 06:40 UTC (History)
6 users (show)

Fixed In Version: libvirt-0.9.10-2.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-20 06:40:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 19:31:38 UTC

Description Alex Jia 2011-12-30 16:40:23 UTC
Description of problem:
Expose 'virDomain{Get,Set}InterfaceParameters' API in python binding.

Version-Release number of selected component (if applicable):
# rpm -q libvirt
libvirt-0.9.9-0rc1.el6.x86_64

How reproducible:
always

Steps to Reproduce:

Run the following codes in interactive python:

import libvirt
con = libvirt.open(None)
dom = con.lookupByName('foo')
dom.interfaceParameters('vnet0', None, None, 0)
dom.setInterfaceParameters('vnet0', None, None, 0)
  
Actual results:

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    print dom.interfaceParameters('vnet0', None, None, 0)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 635, in interfaceParameters
    ret = libvirtmod.virDomainGetInterfaceParameters(self._o, device, params, nparams, flags)
AttributeError: 'module' object has no attribute 'virDomainGetInterfaceParameters'


Traceback (most recent call last):
  File "test.py", line 5, in <module>
    print dom.setInterfaceParameters('vnet0', None, None, 0)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1140, in setInterfaceParameters
    ret = libvirtmod.virDomainSetInterfaceParameters(self._o, device, params, nparams, flags)
AttributeError: 'module' object has no attribute 'virDomainSetInterfaceParameters'

Expected results:
Expose them.

Additional info:

# nm -a -D /usr/lib64/python2.6/site-packages/libvirtmod.
so|grep virDomainGetInterfaceParameters

# nm -a -D /usr/lib64/python2.6/site-packages/libvirtmod.
so|grep virDomainSetInterfaceParameters

Comment 1 Alex Jia 2012-01-18 09:39:20 UTC
Patch for upstream:
https://www.redhat.com/archives/libvir-list/2012-January/msg00695.html

Comment 2 Alex Jia 2012-01-18 09:42:52 UTC
*** Bug 771015 has been marked as a duplicate of this bug. ***

Comment 3 Alex Jia 2012-02-16 03:11:14 UTC
In POST:
commit 8b29c4598609d9b22a39e6f6bf3bf7afe8303faa
Author: Alex Jia <ajia>
Date:   Tue Feb 14 10:46:23 2012 +0800

    python: Expose virDomain{G,S}etInterfaceParameters APIs in python binding
    
    The v4 patch corrects indentation issues.
    
    The v3 patch follows latest python binding codes and change 'size'
    type from int to Py_ssize_t.
    
    An simple example to show how to use it:
    
    #!/usr/bin/env python
    
    import libvirt
    
    conn = libvirt.open(None)
    dom = conn.lookupByName('foo')
    
    print dom.interfaceParameters('vnet0', 0)
    
    params = {'outbound.peak': 10,
              'inbound.peak': 10,
              'inbound.burst': 20,
              'inbound.average': 20,
              'outbound.average': 30,
              'outbound.burst': 30}
    
    print dom.setInterfaceParameters('vnet0', params, 0)
    print dom.interfaceParameters('vnet0', 0)
    
    Signed-off-by: Alex Jia <ajia>

Comment 6 Wayne Sun 2012-02-22 07:59:22 UTC
# rpm -q libvirt libvirt-python
libvirt-0.9.10-2.el6.x86_64
libvirt-python-0.9.10-2.el6.x86_64

1. prepare a running domain
# virsh start dom_test

2. check with python
# python
Python 2.6.6 (r266:84292, Sep 12 2011, 14:03:14) 
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open(None)
>>> domobj = conn.lookupByName("dom_test")
>>> domobj.interfaceParameters("vnet0", 0)
{'outbound.peak': 0, 'inbound.peak': 0, 'inbound.burst': 0, 'inbound.average': 0, 'outbound.average': 0, 'outbound.burst': 0}
>>> domobj.interfaceParameters("vnet0", 1)
{'outbound.peak': 0, 'inbound.peak': 0, 'inbound.burst': 0, 'inbound.average': 0, 'outbound.average': 0, 'outbound.burst': 0}
>>> params = {'outbound.peak': 40, 'inbound.peak': 40, 'inbound.burst': 20, 'inbound.average': 20, 'outbound.average': 30, 'outbound.burst': 30}
>>> domobj.setInterfaceParameters("vnet0", params, 0)
0
>>> domobj.interfaceParameters("vnet0", 1)
{'outbound.peak': 40, 'inbound.peak': 40, 'inbound.burst': 20, 'inbound.average': 20, 'outbound.average': 30, 'outbound.burst': 30}
>>> domobj.interfaceParameters("vnet0", 0)
{'outbound.peak': 40, 'inbound.peak': 40, 'inbound.burst': 20, 'inbound.average': 20, 'outbound.average': 30, 'outbound.burst': 30}
>>> domobj.setInterfaceParameters("54:52:00:98:92:8d", params, 2)
0

destroy domian in another console
# virsh destroy dom_test

recheck with python
>>> domobj.interfaceParameters("54:52:00:98:92:8d", 2)
{'outbound.peak': 40, 'inbound.peak': 40, 'inbound.burst': 20, 'inbound.average': 20, 'outbound.average': 30, 'outbound.burst': 30}
>>> domobj.interfaceParameters("54:52:00:98:92:8d", 0)
{'outbound.peak': 40, 'inbound.peak': 40, 'inbound.burst': 20, 'inbound.average': 20, 'outbound.average': 30, 'outbound.burst': 30}
>>> 


so, this is fixed.

Comment 8 errata-xmlrpc 2012-06-20 06:40:49 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/RHSA-2012-0748.html


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