Hello community, here is the log from the commit of package libvirt-python for openSUSE:Factory checked in at 2014-07-10 08:18:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libvirt-python (Old) and /work/SRC/openSUSE:Factory/.libvirt-python.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libvirt-python" Changes: -------- --- /work/SRC/openSUSE:Factory/libvirt-python/libvirt-python.changes 2014-06-10 14:39:17.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libvirt-python.new/libvirt-python.changes 2014-07-10 09:32:03.000000000 +0200 @@ -1,0 +2,6 @@ +Wed Jul 2 13:36:18 MDT 2014 - [email protected] + +- Update to 1.2.6 + - Add all new APIs and constants in libvirt 1.2.6 + +------------------------------------------------------------------- Old: ---- libvirt-python-1.2.5.tar.bz2 New: ---- libvirt-python-1.2.6.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libvirt-python.spec ++++++ --- /var/tmp/diff_new_pack.UvDpQY/_old 2014-07-10 09:32:04.000000000 +0200 +++ /var/tmp/diff_new_pack.UvDpQY/_new 2014-07-10 09:32:04.000000000 +0200 @@ -18,7 +18,7 @@ Name: libvirt-python Url: http://libvirt.org/ -Version: 1.2.5 +Version: 1.2.6 Release: 0 Summary: Library providing a simple virtualization API License: LGPL-2.1+ ++++++ libvirt-python-1.2.5.tar.bz2 -> libvirt-python-1.2.6.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/AUTHORS new/libvirt-python-1.2.6/AUTHORS --- old/libvirt-python-1.2.5/AUTHORS 2014-06-02 03:55:34.000000000 +0200 +++ new/libvirt-python-1.2.6/AUTHORS 2014-07-02 08:12:23.000000000 +0200 @@ -346,6 +346,10 @@ Eric Blake <[email protected]> Eric Blake <[email protected]> Eric Blake <[email protected]> + Eric Blake <[email protected]> + Eric Blake <[email protected]> + Eric Blake <[email protected]> + Eric Blake <[email protected]> Federico Simoncelli <[email protected]> Giuseppe Scrivano <[email protected]> Giuseppe Scrivano <[email protected]> @@ -380,6 +384,7 @@ Hu Tao <[email protected]> Hu Tao <[email protected]> Hu Tao <[email protected]> + Jason Andryuk <[email protected]> Jim Fehlig <[email protected]> Jim Meyering <[email protected]> Jim Meyering <[email protected]> @@ -443,6 +448,7 @@ Martin Kletzander <[email protected]> Martin Kletzander <[email protected]> Martin Kletzander <[email protected]> + Martin Kletzander <[email protected]> MATSUDA Daiki <[email protected]> MATSUDA Daiki <[email protected]> Matthias Bolte <[email protected]> @@ -465,9 +471,12 @@ Michal Privoznik <[email protected]> Michal Privoznik <[email protected]> Michal Privoznik <[email protected]> + Michal Privoznik <[email protected]> Miloslav Trmač <[email protected]> Minoru Usui <[email protected]> Minoru Usui <[email protected]> + Nehal J Wani <[email protected]> + Nehal J Wani <[email protected]> Nikunj A. Dadhania <[email protected]> Osier Yang <[email protected]> Osier Yang <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/ChangeLog new/libvirt-python-1.2.6/ChangeLog --- old/libvirt-python-1.2.5/ChangeLog 2014-06-02 03:55:34.000000000 +0200 +++ new/libvirt-python-1.2.6/ChangeLog 2014-07-02 08:12:23.000000000 +0200 @@ -1,3 +1,125 @@ +2014-06-27 Nehal J Wani <[email protected]> + + Implement new virNetworkGetDHCPLeases API + This API returns a list of DHCP leases for all network interfaces + connected to the given virtual network or limited output just for one + interface if mac is specified. + + Example Output: + [{'iface': 'virbr3', 'ipaddr': '192.168.150.181', 'hostname': 'ubuntu14', + 'expirytime': 1403737495L, 'prefix': 24, 'clientid': None, + 'mac': '52:54:00:e8:73:eb', 'iaid': None, 'type': 0}, + {'iface': 'virbr3', 'ipaddr': '2001:db8:ca2:2:1::bd', 'hostname': 'fedora20-test', + 'expirytime': 1403738587L, 'prefix': 64, 'clientid': '00:04:b1:d8:86:42:e1:6a:aa:cf:d5:86:94:23:6f:94:04:cd', + 'mac': '52:54:00:5b:40:98', 'iaid': '5980312', 'type': 1}] + + + +2014-06-25 Eric Blake <[email protected]> + + maint: document development against uninstalled libvirt + Thanks to Dan's recent work in libvirt.git, it is much easier to + develop against uninstalled libvirt. Mention how. + + * README: More details. + + + +2014-06-25 Nehal J Wani <[email protected]> + + build: use correct int conversion in NodeGetFreePages + Commit c8ba859bc7 introduced a compiler warning while un-wrapping + a python object to uint in libvirt_virNodeGetFreePages. + + On compiling libvirt-python against libvirt 1.2.6, we get: + + libvirt-override.c: In function ‘libvirt_virNodeGetFreePages’: + libvirt-override.c:7811:9: warning: pointer targets in passing argument 2 of ‘libvirt_intUnwrap’ differ in signedness [-Wpointer-sign] + if (libvirt_intUnwrap(tmp, &pages[i]) < 0) + ^ + In file included from libvirt-override.c:24:0: + typewrappers.h:169:5: note: expected ‘int *’ but argument is of type ‘unsigned int *’ + int libvirt_intUnwrap(PyObject *obj, int *val); + ^ + + + +2014-06-20 Michal Privoznik <[email protected]> + + Implement new virNodeGetFreePages API + The API expose information on host's free pages counts. For easier + access, in python this API returns a dictionary such as: + + In [4]: conn.getFreePages([2048,1*1024*1024], -1, 5) + Out[4]: + {-1: {2048: 114, 1048576: 4}, + 0: {2048: 3, 1048576: 1}, + 1: {2048: 100, 1048576: 1}, + 2: {2048: 10, 1048576: 1}, + 3: {2048: 1, 1048576: 1}} + + At the top level of the returned dictionary there's a pair of <NUMA + node> and another dictionary that contains detailed information on + each supported page size. The information then consists of fairs of + <page size> and <count of free pages>. + + + +2014-06-19 Jason Andryuk <[email protected]> + + Correct virDomainMigrateToURI3 definition + dconnuri is a string, so update the definition to match. Without this, + the generated python would fail when passed a string. + + +2014-06-18 Eric Blake <[email protected]> + + build: provide wrapper makefile + After years of finger training, I'm so used to 'make check' just + working, that I lose quite a bit of time re-learning that in this + project, it is spelled 'python setup.py build check'. A shim + makefile bridges the gap. + + * Makefile: New file. + + + +2014-06-18 Eric Blake <[email protected]> + + event-test: add missing events + Update the example to be able to trace all events. + + * examples/event-test.py (main): Match full list of domain events. + (myDomainEventIOErrorReasonCallback) + (myDomainEventControlErrorCallback) + (myDomainEventBlockJobCallback, myDomainEventBlockJob2Callback) + (blockJobTypeToString, blockJobStatusToString): New functions. + + + +2014-06-18 Eric Blake <[email protected]> + + blockjob: support new BLOCK_JOB_2 event + Libvirt 1.2.6 is introducing a new block job event that passes disk + information by target device rather than host file name. At the + python level, we are just a passthrough, so we can reuse all the + existing code and just wire up the new enum value. + + * libvirt-override-virConnect.py + (_dispatchDomainEventBlockPullCallback): Rename... + (_dispatchDomainEventBlockJobCallback): ...to this, and make + generic to both events. + * libvirt-override.c + (libvirt_virConnectDomainEventBlockJobCallback): Match naming. + (libvirt_virConnectDomainEventRegisterAny): Allow new registration. + + + +2014-06-02 Martin Kletzander <[email protected]> + + Bump version to 1.2.6 for new dev cycle + + 2014-05-27 Martin Kletzander <[email protected]> fix leak in memoryStats with older python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/PKG-INFO new/libvirt-python-1.2.6/PKG-INFO --- old/libvirt-python-1.2.5/PKG-INFO 2014-06-02 03:55:35.000000000 +0200 +++ new/libvirt-python-1.2.6/PKG-INFO 2014-07-02 08:12:23.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: libvirt-python -Version: 1.2.5 +Version: 1.2.6 Summary: The libvirt virtualization API Home-page: http://www.libvirt.org Author: Libvirt Maintainers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/README new/libvirt-python-1.2.6/README --- old/libvirt-python-1.2.5/README 2014-05-04 08:57:48.000000000 +0200 +++ new/libvirt-python-1.2.6/README 2014-06-30 08:25:00.000000000 +0200 @@ -21,6 +21,21 @@ python setup.py build python setup.py install --user +If python-nose is installed, you can test the package with + + python setup.py test + +A makefile shim is provided so that you can do + + make && make check + +rather than directly invoking setup.py. + +As of libvirt 1.2.6, it is possible to develop against an uninstalled +libvirt.git checkout, by setting some environment variables: + + export PKG_CONFIG_PATH=/path/to/libvirt/git/src/ + export LD_LIBRARY_PATH=/path/to/libvirt/git/src/.libs/ Patches for this code should be sent to the main libvirt development mailing list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/examples/event-test.py new/libvirt-python-1.2.6/examples/event-test.py --- old/libvirt-python-1.2.5/examples/event-test.py 2014-05-04 08:57:48.000000000 +0200 +++ new/libvirt-python-1.2.6/examples/event-test.py 2014-06-30 08:25:00.000000000 +0200 @@ -456,6 +456,14 @@ ) return domEventStrings[event][detail] +def blockJobTypeToString(type): + blockJobTypes = ( "unknown", "Pull", "Copy", "Commit", "ActiveCommit", ) + return blockJobTypes[type] + +def blockJobStatusToString(status): + blockJobStatus = ( "Completed", "Failed", "Canceled", "Ready", ) + return blockJobStatus[status] + def myDomainEventCallback1 (conn, dom, event, detail, opaque): print("myDomainEventCallback1 EVENT: Domain %s(%s) %s %s" % (dom.name(), dom.ID(), domEventToString(event), @@ -477,10 +485,14 @@ def myDomainEventIOErrorCallback(conn, dom, srcpath, devalias, action, opaque): print("myDomainEventIOErrorCallback: Domain %s(%s) %s %s %d" % (dom.name(), dom.ID(), srcpath, devalias, action)) - +def myDomainEventIOErrorReasonCallback(conn, dom, srcpath, devalias, action, reason, opaque): + print("myDomainEventIOErrorReasonCallback: Domain %s(%s) %s %s %d %s" % (dom.name(), dom.ID(), srcpath, devalias, action, reason)) def myDomainEventGraphicsCallback(conn, dom, phase, localAddr, remoteAddr, authScheme, subject, opaque): print("myDomainEventGraphicsCallback: Domain %s(%s) %d %s" % (dom.name(), dom.ID(), phase, authScheme)) - +def myDomainEventControlErrorCallback(conn, dom, opaque): + print("myDomainEventControlErrorCallback: Domain %s(%s)" % (dom.name(), dom.ID())) +def myDomainEventBlockJobCallback(conn, dom, disk, type, status, opaque): + print("myDomainEventBlockJobCallback: Domain %s(%s) %s on disk %s %s" % (dom.name(), dom.ID(), blockJobTypeToString(type), disk, blockJobStatusToString(status))) def myDomainEventDiskChangeCallback(conn, dom, oldSrcPath, newSrcPath, devAlias, reason, opaque): print("myDomainEventDiskChangeCallback: Domain %s(%s) disk change oldSrcPath: %s newSrcPath: %s devAlias: %s reason: %s" % ( dom.name(), dom.ID(), oldSrcPath, newSrcPath, devAlias, reason)) @@ -501,6 +513,8 @@ def myDomainEventDeviceRemovedCallback(conn, dom, dev, opaque): print("myDomainEventDeviceRemovedCallback: Domain %s(%s) device removed: %s" % ( dom.name(), dom.ID(), dev)) +def myDomainEventBlockJob2Callback(conn, dom, disk, type, status, opaque): + print("myDomainEventBlockJob2Callback: Domain %s(%s) %s on disk %s %s" % (dom.name(), dom.ID(), blockJobTypeToString(type), disk, blockJobStatusToString(status))) ########################################################################## # Network events @@ -591,14 +605,17 @@ vc.registerCloseCallback(myConnectionCloseCallback, None) - #Add 2 callbacks to prove this works with more than just one + #Add 2 lifecycle callbacks to prove this works with more than just one vc.domainEventRegister(myDomainEventCallback1,None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_LIFECYCLE, myDomainEventCallback2, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_REBOOT, myDomainEventRebootCallback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_RTC_CHANGE, myDomainEventRTCChangeCallback, None) - vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR, myDomainEventIOErrorCallback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_WATCHDOG, myDomainEventWatchdogCallback, None) + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR, myDomainEventIOErrorCallback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_GRAPHICS, myDomainEventGraphicsCallback, None) + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON, myDomainEventIOErrorReasonCallback, None) + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_CONTROL_ERROR, myDomainEventControlErrorCallback, None) + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BLOCK_JOB, myDomainEventBlockJobCallback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DISK_CHANGE, myDomainEventDiskChangeCallback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_TRAY_CHANGE, myDomainEventTrayChangeCallback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_PMWAKEUP, myDomainEventPMWakeupCallback, None) @@ -606,6 +623,7 @@ vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE, myDomainEventBalloonChangeCallback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK, myDomainEventPMSuspendDiskCallback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED, myDomainEventDeviceRemovedCallback, None) + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2, myDomainEventBlockJob2Callback, None) vc.networkEventRegisterAny(None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE, myNetworkEventLifecycleCallback, None) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/generator.py new/libvirt-python-1.2.6/generator.py --- old/libvirt-python-1.2.5/generator.py 2014-06-02 03:54:49.000000000 +0200 +++ new/libvirt-python-1.2.6/generator.py 2014-06-30 08:25:00.000000000 +0200 @@ -462,6 +462,8 @@ 'virDomainMigrate3', 'virDomainMigrateToURI3', 'virConnectGetCPUModelNames', + 'virNodeGetFreePages', + 'virNetworkGetDHCPLeases', ) lxc_skip_impl = ( @@ -567,6 +569,8 @@ "virTypedParamsGetString", "virTypedParamsGetUInt", "virTypedParamsGetULLong", + + 'virNetworkDHCPLeaseFree', # only useful in C, python code uses list ) lxc_skip_function = ( @@ -1114,6 +1118,7 @@ elif name[0:13] == "virNetworkGet": func = name[13:] func = func[0:1].lower() + func[1:] + func = func.replace("dHCP", "DHCP") elif name[0:10] == "virNetwork": func = name[10:] func = func[0:1].lower() + func[1:] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/libvirt-override-api.xml new/libvirt-python-1.2.6/libvirt-override-api.xml --- old/libvirt-python-1.2.5/libvirt-override-api.xml 2014-05-04 08:57:48.000000000 +0200 +++ new/libvirt-python-1.2.6/libvirt-override-api.xml 2014-06-30 08:25:00.000000000 +0200 @@ -562,7 +562,7 @@ <info>Migrate the domain object from its current host to the destination host given by URI.</info> <arg name='domain' type='virDomainPtr' info='a domain object'/> - <arg name='dconnuri' type='virConnectPtr' info='URI for target libvirtd if @flags includes VIR_MIGRATE_PEER2PEER'/> + <arg name='dconnuri' type='char *' info='URI for target libvirtd if @flags includes VIR_MIGRATE_PEER2PEER'/> <arg name='params' type='char *' info='dictionary with migration parameters'/> <arg name='flags' type='unsigned int' info='an OR'ed set of virDomainMigrateFlags'/> <return type='int' info='0 in case of success, -1 in case of failure.'/> @@ -624,5 +624,21 @@ <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='flags' type='int' info='unused, pass 0'/> </function> + <function name="virNodeGetFreePages" file='python'> + <info>Returns the number of available pages for a list of cells and page sizes</info> + <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> + <arg name='pages' type='char *' info='list of desired page sizes'/> + <arg name='startCell' type='int' info='first cell in the list'/> + <arg name='maxCells' type='int' info='number of cell in the list'/> + <arg name='flags' type='int' info='unused, pass 0'/> + <return type='char *' info='the list available memory in the cells'/> + </function> + <function name="virNetworkGetDHCPLeases" file='python'> + <info>Returns a list of dhcp leases for interfaces connected to the given virtual network</info> + <arg name='network' type='virNetworkPtr' info='a network object'/> + <arg name='mac' type='const char *' info='optional mac address'/> + <arg name='flags' type='unsigned int' info='unused, pass 0'/> + <return type='char *' info="list of leases"/> + </function> </symbols> </api> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/libvirt-override-virConnect.py new/libvirt-python-1.2.6/libvirt-override-virConnect.py --- old/libvirt-python-1.2.5/libvirt-override-virConnect.py 2014-05-04 08:57:48.000000000 +0200 +++ new/libvirt-python-1.2.6/libvirt-override-virConnect.py 2014-06-30 08:25:00.000000000 +0200 @@ -113,14 +113,14 @@ authScheme, subject, opaque) return 0 - def _dispatchDomainEventBlockPullCallback(self, dom, path, type, status, cbData): - """Dispatches events to python user domain blockJob event callbacks + def _dispatchDomainEventBlockJobCallback(self, dom, disk, type, status, cbData): + """Dispatches events to python user domain blockJob/blockJob2 event callbacks """ try: cb = cbData["cb"] opaque = cbData["opaque"] - cb(self, virDomain(self, _obj=dom), path, type, status, opaque) + cb(self, virDomain(self, _obj=dom), disk, type, status, opaque) return 0 except AttributeError: pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/libvirt-override.c new/libvirt-python-1.2.6/libvirt-override.c --- old/libvirt-python-1.2.5/libvirt-override.c 2014-06-02 03:54:49.000000000 +0200 +++ new/libvirt-python-1.2.6/libvirt-override.c 2014-06-30 08:25:00.000000000 +0200 @@ -6085,7 +6085,7 @@ static int libvirt_virConnectDomainEventBlockJobCallback(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainPtr dom, - const char *path, + const char *disk, int type, int status, void *opaque) @@ -6114,9 +6114,9 @@ /* Call the Callback Dispatcher */ pyobj_ret = PyObject_CallMethod(pyobj_conn, - (char*)"_dispatchDomainEventBlockPullCallback", + (char*)"_dispatchDomainEventBlockJobCallback", (char*)"OsiiO", - pyobj_dom, path, type, status, pyobj_cbData); + pyobj_dom, disk, type, status, pyobj_cbData); Py_DECREF(pyobj_cbData); Py_DECREF(pyobj_dom); @@ -6506,6 +6506,7 @@ } #endif /* LIBVIR_CHECK_VERSION(1, 1, 1) */ + static PyObject * libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) @@ -6561,6 +6562,9 @@ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventGenericCallback); break; case VIR_DOMAIN_EVENT_ID_BLOCK_JOB: +#if LIBVIR_CHECK_VERSION(1, 2, 6) + case VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2: +#endif /* LIBVIR_CHECK_VERSION(1, 2, 6) */ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventBlockJobCallback); break; case VIR_DOMAIN_EVENT_ID_DISK_CHANGE: @@ -7760,6 +7764,197 @@ } #endif /* LIBVIR_CHECK_VERSION(1, 2, 5) */ + +#if LIBVIR_CHECK_VERSION(1, 2, 6) +static PyObject * +libvirt_virNodeGetFreePages(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) { + PyObject *py_retval = NULL; + PyObject *pyobj_conn; + PyObject *pyobj_pagesize; + PyObject *pyobj_counts = NULL; + virConnectPtr conn; + unsigned int *pages = NULL; + int startCell; + unsigned int cellCount; + unsigned int flags; + unsigned long long *counts = NULL; + int c_retval; + ssize_t pyobj_pagesize_size, i, j; + + if (!PyArg_ParseTuple(args, (char *)"OOiii:virNodeGetFreePages", + &pyobj_conn, &pyobj_pagesize, &startCell, + &cellCount, &flags)) + return NULL; + + if (!PyList_Check(pyobj_pagesize)) { + PyErr_Format(PyExc_TypeError, "pagesize must be list"); + return NULL; + } + + if (cellCount == 0) { + PyErr_Format(PyExc_LookupError, "cellCount must not be zero"); + return NULL; + } + + conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn); + + pyobj_pagesize_size = PyList_Size(pyobj_pagesize); + if (VIR_ALLOC_N(pages, pyobj_pagesize_size) < 0 || + VIR_ALLOC_N(counts, pyobj_pagesize_size * cellCount) < 0 || + !(pyobj_counts = PyDict_New())) + goto cleanup; + + for (i = 0; i < pyobj_pagesize_size; i++) { + PyObject *tmp = PyList_GetItem(pyobj_pagesize, i); + + if (libvirt_uintUnwrap(tmp, &pages[i]) < 0) + goto cleanup; + } + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virNodeGetFreePages(conn, + pyobj_pagesize_size, pages, + startCell, cellCount, + counts, flags); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) { + py_retval = VIR_PY_NONE; + goto cleanup; + } + + for (i = 0; i < c_retval;) { + PyObject *per_node = NULL; + PyObject *node = NULL; + + if (!(per_node = PyDict_New()) || + !(node = libvirt_intWrap(startCell + i/pyobj_pagesize_size))) { + Py_XDECREF(per_node); + Py_XDECREF(node); + goto cleanup; + } + + for (j = 0; j < pyobj_pagesize_size; j ++) { + PyObject *page = NULL; + PyObject *count = NULL; + + if (!(page = libvirt_intWrap(pages[j])) || + !(count = libvirt_intWrap(counts[i + j])) || + PyDict_SetItem(per_node, page, count) < 0) { + Py_XDECREF(page); + Py_XDECREF(count); + Py_XDECREF(per_node); + Py_XDECREF(node); + goto cleanup; + } + } + i += pyobj_pagesize_size; + + if (PyDict_SetItem(pyobj_counts, node, per_node) < 0) { + Py_XDECREF(per_node); + Py_XDECREF(node); + goto cleanup; + } + } + + py_retval = pyobj_counts; + pyobj_counts = NULL; + cleanup: + Py_XDECREF(pyobj_counts); + VIR_FREE(pages); + VIR_FREE(counts); + return py_retval; +} + + +static PyObject * +libvirt_virNetworkGetDHCPLeases(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *py_retval = NULL; + PyObject *py_lease = NULL; + virNetworkPtr network; + PyObject *pyobj_network; + unsigned int flags; + virNetworkDHCPLeasePtr *leases = NULL; + int leases_count; + char *mac = NULL; + size_t i; + + if (!PyArg_ParseTuple(args, (char *) "Ozi:virNetworkDHCPLeasePtr", + &pyobj_network, &mac, &flags)) + return NULL; + + network = (virNetworkPtr) PyvirNetwork_Get(pyobj_network); + + LIBVIRT_BEGIN_ALLOW_THREADS; + leases_count = virNetworkGetDHCPLeases(network, mac, &leases, flags); + LIBVIRT_END_ALLOW_THREADS; + + if (leases_count < 0) { + py_retval = VIR_PY_NONE; + goto cleanup; + } + + if (!(py_retval = PyList_New(leases_count))) + goto no_memory; + + for (i = 0; i < leases_count; i++) { + virNetworkDHCPLeasePtr lease = leases[i]; + + if ((py_lease = PyDict_New()) == NULL) + goto no_memory; + +#define VIR_SET_LEASE_ITEM(NAME, VALUE_OBJ_FUNC) \ + do { \ + PyObject *tmp_val; \ + \ + if (!(tmp_val = VALUE_OBJ_FUNC)) \ + goto no_memory; \ + \ + if (PyDict_SetItemString(py_lease, NAME, tmp_val) < 0) { \ + Py_DECREF(tmp_val); \ + goto no_memory; \ + } \ + } while (0) + + VIR_SET_LEASE_ITEM("iface", libvirt_charPtrWrap(lease->iface)); + VIR_SET_LEASE_ITEM("expirytime", libvirt_longlongWrap(lease->expirytime)); + VIR_SET_LEASE_ITEM("type", libvirt_intWrap(lease->type)); + VIR_SET_LEASE_ITEM("mac", libvirt_charPtrWrap(lease->mac)); + VIR_SET_LEASE_ITEM("ipaddr", libvirt_charPtrWrap(lease->ipaddr)); + VIR_SET_LEASE_ITEM("prefix", libvirt_uintWrap(lease->prefix)); + VIR_SET_LEASE_ITEM("hostname", libvirt_charPtrWrap(lease->hostname)); + VIR_SET_LEASE_ITEM("clientid", libvirt_charPtrWrap(lease->clientid)); + VIR_SET_LEASE_ITEM("iaid", libvirt_charPtrWrap(lease->iaid)); + +#undef VIR_SET_LEASE_ITEM + + if (PyList_SetItem(py_retval, i, py_lease) < 0) + goto no_memory; + + py_lease = NULL; + } + + cleanup: + Py_XDECREF(py_lease); + if (leases) { + for (i = 0; i < leases_count; i++) + virNetworkDHCPLeaseFree(leases[i]); + } + VIR_FREE(leases); + + return py_retval; + + no_memory: + Py_XDECREF(py_retval); + py_retval = PyErr_NoMemory(); + goto cleanup; +} + +#endif /* LIBVIR_CHECK_VERSION(1, 2, 6) */ + /************************************************************************ * * * The registration stuff * @@ -7941,6 +8136,10 @@ {(char *) "virDomainGetTime", libvirt_virDomainGetTime, METH_VARARGS, NULL}, {(char *) "virDomainSetTime", libvirt_virDomainSetTime, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(1, 2, 5) */ +#if LIBVIR_CHECK_VERSION(1, 2, 6) + {(char *) "virNodeGetFreePages", libvirt_virNodeGetFreePages, METH_VARARGS, NULL}, + {(char *) "virNetworkGetDHCPLeases", libvirt_virNetworkGetDHCPLeases, METH_VARARGS, NULL}, +#endif /* LIBVIR_CHECK_VERSION(1, 2, 6) */ {NULL, NULL, 0, NULL} }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/libvirt-python.spec new/libvirt-python-1.2.6/libvirt-python.spec --- old/libvirt-python-1.2.5/libvirt-python.spec 2014-06-02 03:55:34.000000000 +0200 +++ new/libvirt-python-1.2.6/libvirt-python.spec 2014-07-02 08:12:22.000000000 +0200 @@ -6,7 +6,7 @@ Summary: The libvirt virtualization API python2 binding Name: libvirt-python -Version: 1.2.5 +Version: 1.2.6 Release: 1%{?dist}%{?extra_release} Source0: http://libvirt.org/sources/python/%{name}-%{version}.tar.gz Url: http://libvirt.org diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/sanitytest.py new/libvirt-python-1.2.6/sanitytest.py --- old/libvirt-python-1.2.5/sanitytest.py 2014-06-02 03:54:49.000000000 +0200 +++ new/libvirt-python-1.2.6/sanitytest.py 2014-06-30 08:25:00.000000000 +0200 @@ -78,6 +78,9 @@ if name[0:14] == "virTypedParams": continue + if name[0:23] == "virNetworkDHCPLeaseFree": + continue + # These aren't functions, they're callback signatures if name in ["virConnectAuthCallbackPtr", "virConnectCloseFunc", "virStreamSinkFunc", "virStreamSourceFunc", "virStreamEventCallback", @@ -210,6 +213,9 @@ if func[0:8] == "fSFreeze" or func[0:6] == "fSThaw": func = "fs" + func[2:] + if klass == "virNetwork": + func = func.replace("dHCP", "DHCP") + # ...except when they don't. More stupid naming # decisions we can't fix if func == "iD": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-1.2.5/setup.py new/libvirt-python-1.2.6/setup.py --- old/libvirt-python-1.2.5/setup.py 2014-06-02 03:54:49.000000000 +0200 +++ new/libvirt-python-1.2.6/setup.py 2014-06-30 08:25:00.000000000 +0200 @@ -309,7 +309,7 @@ _c_modules, _py_modules = get_module_lists() setup(name = 'libvirt-python', - version = '1.2.5', + version = '1.2.6', url = 'http://www.libvirt.org', maintainer = 'Libvirt Maintainers', maintainer_email = '[email protected]', -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
