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: |
Description
Alex Jia
2011-12-30 16:40:23 UTC
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 |