Red Hat Bugzilla – Bug 771591
Expose 'virDomain{G, S}etNumaParameters' APIs in python binding
Last modified: 2012-06-20 02:46:05 EDT
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
the patch has been sent to upstream https://www.redhat.com/archives/libvir-list/2012-January/msg00585.html
commit 9c8466daac19379c41be39ec8f18db36c9573c02 Author: Guannan Ren <gren@redhat.com> 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@redhat.com>
# 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.
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