Bug 771591

Summary: Expose 'virDomain{G, S}etNumaParameters' APIs in python binding
Product: Red Hat Enterprise Linux 6 Reporter: Alex Jia <ajia>
Component: libvirtAssignee: Gunannan Ren <gren>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, dallan, dyuan, gsun, mzhan, rwu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.10-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:46:05 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 2012-01-04 09:04:38 UTC
Description of problem:
virsh numatune works well and need to expose 'virDomain{G, S}etNumaParameters' APIs in python binding.

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

How reproducible:
always

Steps to Reproduce:
# 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
>>> con = libvirt.open(None)
>>> dom = con.lookupByName(con.listDefinedDomains()[0])
>>> dom.numaParameters(0, 0, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 999, in numaParameters
    ret = libvirtmod.virDomainGetNumaParameters(self._o, params, nparams, flags)
AttributeError: 'module' object has no attribute 'virDomainGetNumaParameters'
>>> dom.setNumaParameters(0, 0, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1198, in setNumaParameters
    ret = libvirtmod.virDomainSetNumaParameters(self._o, params, nparams, flags)
AttributeError: 'module' object has no attribute 'virDomainSetNumaParameters'
  
Actual results:

AttributeError: 'module' object has no attribute 'virDomainGetNumaParameters'
AttributeError: 'module' object has no attribute 'virDomainSetNumaParameters'

Expected results:
expose them in python binding.

Additional info:

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

Comment 1 Gunannan Ren 2012-01-16 11:00:02 UTC
the patch has been sent to upstream
https://www.redhat.com/archives/libvir-list/2012-January/msg00585.html

Comment 2 Gunannan Ren 2012-02-10 06:52:43 UTC
commit 9c8466daac19379c41be39ec8f18db36c9573c02
Author: Guannan Ren <gren>
Date:   Wed Feb 8 20:20:50 2012 +0800

    python: refactoring virTypedParameter conversion for NUMA tuning APIs
    
              *getPyVirTypedParameter
              *setPyVirTypedParameter
              *virDomainSetNumaParameters
              *virDomainGetNumaParameters
    
    Signed-off-by: Eric Blake <eblake>

Comment 5 Wayne Sun 2012-02-14 10:48:25 UTC
# rpm -q libvirt
libvirt-0.9.10-1.el6.x86_64

# 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)
>>> dom = conn.lookupByName("rhel6u2")
>>> dir(dom)
['ID', 'OSType', 'UUID', 'UUIDString', 'XMLDesc', '__del__', '__doc__', '__init__', '__module__', '_conn', '_o', 'abortJob', 'attachDevice', 'attachDeviceFlags', 'autostart', 'blkioParameters', 'blockInfo', 'blockIoTune', 'blockJobAbort', 'blockJobInfo', 'blockJobSetSpeed', 'blockPeek', 'blockPull', 'blockRebase', 'blockResize', 'blockStats', 'blockStatsFlags', 'cPUStats', 'connect', 'controlInfo', 'coreDump', 'create', 'createWithFlags', 'destroy', 'destroyFlags', 'detachDevice', 'detachDeviceFlags', 'diskErrors', 'hasCurrentSnapshot', 'hasManagedSaveImage', 'info', 'injectNMI', 'interfaceParameters', 'interfaceStats', 'isActive', 'isPersistent', 'isUpdated', 'jobInfo', 'managedSave', 'managedSaveRemove', 'maxMemory', 'maxVcpus', 'memoryParameters', 'memoryPeek', 'memoryStats', 'metadata', 'migrate', 'migrate2', 'migrateGetMaxSpeed', 'migrateSetMaxDowntime', 'migrateSetMaxSpeed', 'migrateToURI', 'migrateToURI2', 'name', 'numaParameters', 'openConsole', 'openGraphics', 'pMSuspendForDuration', 'pinVcpu', 'pinVcpuFlags', 'reboot', 'reset', 'resume', 'revertToSnapshot', 'save', 'saveFlags', 'schedulerParameters', 'schedulerParametersFlags', 'schedulerType', 'screenshot', 'sendKey', 'setAutostart', 'setBlkioParameters', 'setBlockIoTune', 'setInterfaceParameters', 'setMaxMemory', 'setMemory', 'setMemoryFlags', 'setMemoryParameters', 'setMetadata', 'setNumaParameters', 'setSchedulerParameters', 'setSchedulerParametersFlags', 'setVcpus', 'setVcpusFlags', 'shutdown', 'shutdownFlags', 'snapshotCreateXML', 'snapshotCurrent', 'snapshotListNames', 'snapshotLookupByName', 'snapshotNum', 'state', 'suspend', 'undefine', 'undefineFlags', 'updateDeviceFlags', 'vcpuPinInfo', 'vcpus', 'vcpusFlags']
>>> dom.numaParameters(0)
{'numa_nodeset': '0-1', 'numa_mode': 0}
>>> param = {'numa_nodeset': '1', 'numa_mode': 1}
>>> dom.setNumaParameters(param, 2)
0

# destroy and start the domain in another console

>>> dom.numaParameters(0)
{'numa_nodeset': '0-1', 'numa_mode': 1}

So, it's working.

Comment 7 errata-xmlrpc 2012-06-20 06:46:05 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