Bug 770971
| Summary: | Expose 'virDomain{Get,Set}InterfaceParameters' APIs in python binding | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Alex Jia <ajia> |
| Component: | libvirt | Assignee: | Alex Jia <ajia> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 6.3 | CC: | acathrow, dyuan, gsun, mzhan, rwu, veillard |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-0.9.10-2.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-06-20 06:40:49 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Patch for upstream: https://www.redhat.com/archives/libvir-list/2012-January/msg00695.html *** Bug 771015 has been marked as a duplicate of this bug. *** 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>
# 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. 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 |
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