Hello community, here is the log from the commit of package libvirt-python for openSUSE:Factory checked in at 2017-02-01 09:52:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2017-01-04 19:30:34.686121819 +0100 +++ /work/SRC/openSUSE:Factory/.libvirt-python.new/libvirt-python.changes 2017-02-03 17:48:52.241902052 +0100 @@ -1,0 +2,6 @@ +Thu Jan 19 19:04:30 UTC 2017 - [email protected] + +- Update to 3.0.0 + - Add all new APIs and constants in libvirt 3.0.0 + +------------------------------------------------------------------- Old: ---- libvirt-python-2.5.0.tar.gz libvirt-python-2.5.0.tar.gz.asc New: ---- libvirt-python-3.0.0.tar.gz libvirt-python-3.0.0.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libvirt-python.spec ++++++ --- /var/tmp/diff_new_pack.IhUT4Z/_old 2017-02-03 17:48:52.657843413 +0100 +++ /var/tmp/diff_new_pack.IhUT4Z/_new 2017-02-03 17:48:52.665842286 +0100 @@ -1,7 +1,7 @@ # # spec file for package libvirt-python # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ Name: libvirt-python Url: http://libvirt.org/ -Version: 2.5.0 +Version: 3.0.0 Release: 0 Summary: Library providing a simple virtualization API License: LGPL-2.1+ ++++++ libvirt-python-2.5.0.tar.gz -> libvirt-python-3.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-2.5.0/AUTHORS new/libvirt-python-3.0.0/AUTHORS --- old/libvirt-python-2.5.0/AUTHORS 2016-12-04 22:09:12.000000000 +0100 +++ new/libvirt-python-3.0.0/AUTHORS 2017-01-17 19:22:27.000000000 +0100 @@ -63,6 +63,7 @@ Pavel Hrdina <[email protected]> Peter Krempa <[email protected]> Philipp Hahn <[email protected]> + Prabodh Agarwal <[email protected]> Pradipta Kr. Banerjee <[email protected]> Qiaowei Ren <[email protected]> Richard W.M. Jones <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-2.5.0/ChangeLog new/libvirt-python-3.0.0/ChangeLog --- old/libvirt-python-2.5.0/ChangeLog 2016-12-04 22:09:12.000000000 +0100 +++ new/libvirt-python-3.0.0/ChangeLog 2017-01-17 19:22:27.000000000 +0100 @@ -1,3 +1,64 @@ +2017-01-10 Michal Privoznik <[email protected]> + + examples: Update event-test.py + With recent changes there are new events known to libvirt. + Reflect those changes in our event-test.py example script. + + + +2017-01-10 Daniel P. Berrange <[email protected]> + + Fix typos in previous secrets event patch + + +2017-01-09 Daniel P. Berrange <[email protected]> + + Add support for domain metadata change event + + +2017-01-09 Daniel P. Berrange <[email protected]> + + Add support for secret event APIs + + +2016-12-21 Daniel P. Berrange <[email protected]> + + Add override impl for virStorageVolGetInfoFlags + + +2016-12-21 Daniel P. Berrange <[email protected]> + + Remove bogus \o escape in regex + One of the regexes has a bogus \o instead of plain 'o'. Somehow + this magically worked on all versions of python, until 3.6 came + along and complained + + + +2016-12-14 Daniel P. Berrange <[email protected]> + + Fix running of nosetests on python 3 + Previously the way Fedora installed /usr/bin/nosetests allowed it + to be invoked with either python 2 or 3. Since Fedora 25 though, + it contains a module name that only exists on python 2. So we need + to be more intelligent and pick a different nosetests binary per + version. + + + +2016-12-13 Prabodh Agarwal <[email protected]> + + HACKING: fix grammar + + +2016-12-05 Daniel P. Berrange <[email protected]> + + Fill out more fields for PKG-INFO file + Ensure the description and license are set in PKG-INFO, + and clarify the summary field. + + + 2016-11-11 Konstantin Neumoin <[email protected]> don't overrun buffer when converting cpumap diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-2.5.0/PKG-INFO new/libvirt-python-3.0.0/PKG-INFO --- old/libvirt-python-2.5.0/PKG-INFO 2016-12-04 22:09:12.000000000 +0100 +++ new/libvirt-python-3.0.0/PKG-INFO 2017-01-17 19:22:27.000000000 +0100 @@ -1,12 +1,15 @@ Metadata-Version: 1.1 Name: libvirt-python -Version: 2.5.0 -Summary: The libvirt virtualization API +Version: 3.0.0 +Summary: The libvirt virtualization API python binding Home-page: http://www.libvirt.org Author: Libvirt Maintainers Author-email: [email protected] -License: UNKNOWN -Description: UNKNOWN +License: LGPLv2+ +Description: The libvirt-python package provides a module that permits applications + written in the Python programming language to call the interface + supplied by the libvirt library, to manage the virtualization capabilities + of recent versions of Linux (and other OSes). Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-2.5.0/examples/event-test.py new/libvirt-python-3.0.0/examples/event-test.py --- old/libvirt-python-2.5.0/examples/event-test.py 2016-11-01 21:49:14.000000000 +0100 +++ new/libvirt-python-3.0.0/examples/event-test.py 2017-01-17 19:20:56.000000000 +0100 @@ -538,6 +538,9 @@ def myDomainEventDeviceRemovalFailedCallback(conn, dom, dev, opaque): print("myDomainEventDeviceRemovalFailedCallback: Domain %s(%s) failed to remove device: %s" % ( dom.name(), dom.ID(), dev)) +def myDomainEventMetadataChangeCallback(conn, dom, mtype, nsuri, opaque): + print("myDomainEventMetadataChangeCallback: Domain %s(%s) changed metadata mtype=%d nsuri=%s" % ( + dom.name(), dom.ID(), mtype, nsuri)) ########################################################################## # Network events @@ -601,6 +604,23 @@ print("myNodeDeviceEventUpdateCallback: Node device %s" % dev.name()) ########################################################################## +# Secret events +########################################################################## +def secretEventToString(event): + secretEventStrings = ( "Defined", + "Undefined", + ) + return secretEventStrings[event] + +def mySecretEventLifecycleCallback(conn, secret, event, detail, opaque): + print("mySecretEventLifecycleCallback: Secret %s %s %d" % (secret.UUIDString(), + secretEventToString(event), + detail)) + +def mySecretEventValueChanged(conn, secret, opaque): + print("mySecretEventValueChanged: Secret %s" % secret.UUIDString()) + +########################################################################## # Set up and run the program ########################################################################## @@ -689,6 +709,7 @@ vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION, myDomainEventMigrationIteration, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_JOB_COMPLETED, myDomainEventJobCompletedCallback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED, myDomainEventDeviceRemovalFailedCallback, None) + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_METADATA_CHANGE, myDomainEventMetadataChangeCallback, None) vc.networkEventRegisterAny(None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE, myNetworkEventLifecycleCallback, None) @@ -698,6 +719,9 @@ vc.nodeDeviceEventRegisterAny(None, libvirt.VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE, myNodeDeviceEventLifecycleCallback, None) vc.nodeDeviceEventRegisterAny(None, libvirt.VIR_NODE_DEVICE_EVENT_ID_UPDATE, myNodeDeviceEventUpdateCallback, None) + vc.secretEventRegisterAny(None, libvirt.VIR_SECRET_EVENT_ID_LIFECYCLE, mySecretEventLifecycleCallback, None) + vc.secretEventRegisterAny(None, libvirt.VIR_SECRET_EVENT_ID_VALUE_CHANGED, mySecretEventValueChanged, None) + vc.setKeepAlive(5, 3) # The rest of your app would go here normally, but for sake diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-2.5.0/generator.py new/libvirt-python-3.0.0/generator.py --- old/libvirt-python-2.5.0/generator.py 2016-11-01 21:49:14.000000000 +0100 +++ new/libvirt-python-3.0.0/generator.py 2017-01-17 19:20:56.000000000 +0100 @@ -455,6 +455,7 @@ 'virStoragePoolLookupByUUID', 'virStoragePoolGetInfo', 'virStorageVolGetInfo', + 'virStorageVolGetInfoFlags', 'virStoragePoolGetAutostart', 'virStoragePoolListVolumes', 'virDomainBlockPeek', @@ -527,6 +528,8 @@ 'virConnectStoragePoolEventDeregisterAny', # overridden in virConnect.py 'virConnectNodeDeviceEventRegisterAny', # overridden in virConnect.py 'virConnectNodeDeviceEventDeregisterAny', # overridden in virConnect.py + 'virConnectSecretEventRegisterAny', # overridden in virConnect.py + 'virConnectSecretEventDeregisterAny', # overridden in virConnect.py 'virSaveLastError', # We have our own python error wrapper 'virFreeError', # Only needed if we use virSaveLastError 'virConnectListAllDomains', # overridden in virConnect.py @@ -1091,7 +1094,7 @@ return not re.search ("^(unsigned)? ?(int|long)$", name) is None def is_optional_arg(info): - return re.search("^\(?\optional\)?", info) is not None + return re.search("^\(?optional\)?", info) is not None # Functions returning lists which need special rules to check for errors # and raise exceptions. functions_list_exception_test = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-2.5.0/libvirt-override-api.xml new/libvirt-python-3.0.0/libvirt-override-api.xml --- old/libvirt-python-2.5.0/libvirt-override-api.xml 2016-11-01 21:49:14.000000000 +0100 +++ new/libvirt-python-3.0.0/libvirt-override-api.xml 2017-01-17 19:20:56.000000000 +0100 @@ -410,6 +410,12 @@ <return type='char *' info='the list of information or None in case of error'/> <arg name='vol' type='virStorageVolPtr' info='a storage vol object'/> </function> + <function name='virStorageVolGetInfoFlags' file='python'> + <info>Extract information about a storage volume. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.</info> + <return type='char *' info='the list of information or None in case of error'/> + <arg name='vol' type='virStorageVolPtr' info='a storage vol object'/> + <arg name='flags' type='unsigned int' info='bitwise-OR of virStorageVolInfoFlags'/> + </function> <function name='virNodeListDevices' file='python'> <info>list the node devices</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-2.5.0/libvirt-override-virConnect.py new/libvirt-python-3.0.0/libvirt-override-virConnect.py --- old/libvirt-python-2.5.0/libvirt-override-virConnect.py 2016-11-01 21:49:14.000000000 +0100 +++ new/libvirt-python-3.0.0/libvirt-override-virConnect.py 2017-01-17 19:20:56.000000000 +0100 @@ -243,6 +243,15 @@ cb(self, virDomain(self, _obj=dom), devAlias, opaque) return 0 + def _dispatchDomainEventMetadataChangeCallback(self, dom, mtype, nsuri, cbData): + """Dispatches event to python user domain device removal failed event callbacks + """ + cb = cbData["cb"] + opaque = cbData["opaque"] + + cb(self, virDomain(self, _obj=dom), mtype, nsuri, opaque) + return 0 + def domainEventDeregisterAny(self, callbackID): """Removes a Domain Event Callback. De-registering for a domain callback will disable delivery of this event type """ @@ -392,6 +401,49 @@ self.nodeDeviceEventCallbackID[ret] = opaque return ret + def _dispatchSecretEventLifecycleCallback(self, secret, event, detail, cbData): + """Dispatches events to python user secret lifecycle event callbacks + """ + cb = cbData["cb"] + opaque = cbData["opaque"] + + cb(self, virSecret(self, _obj=secret), event, detail, opaque) + return 0 + + def _dispatchSecretEventGenericCallback(self, secret, cbData): + """Dispatches events to python user secret generic event callbacks + """ + cb = cbData["cb"] + opaque = cbData["opaque"] + + cb(self, virSecret(self, _obj=secret), opaque) + return 0 + + def secretEventDeregisterAny(self, callbackID): + """Removes a Secret Event Callback. De-registering for a + secret callback will disable delivery of this event type""" + try: + ret = libvirtmod.virConnectSecretEventDeregisterAny(self._o, callbackID) + if ret == -1: raise libvirtError ('virConnectSecretEventDeregisterAny() failed', conn=self) + del self.secretEventCallbackID[callbackID] + except AttributeError: + pass + + def secretEventRegisterAny(self, secret, eventID, cb, opaque): + """Adds a Secret Event Callback. Registering for a secret + callback will enable delivery of the events""" + if not hasattr(self, 'secretEventCallbackID'): + self.secretEventCallbackID = {} + cbData = { "cb": cb, "conn": self, "opaque": opaque } + if secret is None: + ret = libvirtmod.virConnectSecretEventRegisterAny(self._o, None, eventID, cbData) + else: + ret = libvirtmod.virConnectSecretEventRegisterAny(self._o, secret._o, eventID, cbData) + if ret == -1: + raise libvirtError ('virConnectSecretEventRegisterAny() failed', conn=self) + self.secretEventCallbackID[ret] = opaque + return ret + def listAllDomains(self, flags=0): """List all domains and returns a list of domain objects""" ret = libvirtmod.virConnectListAllDomains(self._o, flags) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-2.5.0/libvirt-override.c new/libvirt-python-3.0.0/libvirt-override.c --- old/libvirt-python-2.5.0/libvirt-override.c 2016-12-04 22:06:22.000000000 +0100 +++ new/libvirt-python-3.0.0/libvirt-override.c 2017-01-17 19:20:56.000000000 +0100 @@ -3681,6 +3681,46 @@ return NULL; } +#if LIBVIR_CHECK_VERSION(3, 0, 0) +static PyObject * +libvirt_virStorageVolGetInfoFlags(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *py_retval; + int c_retval; + virStorageVolPtr pool; + PyObject *pyobj_pool; + virStorageVolInfo info; + unsigned int flags; + + if (!PyArg_ParseTuple(args, (char *)"OI:virStorageVolGetInfoFlags", &pyobj_pool, &flags)) + return NULL; + pool = (virStorageVolPtr) PyvirStorageVol_Get(pyobj_pool); + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virStorageVolGetInfoFlags(pool, &info, flags); + LIBVIRT_END_ALLOW_THREADS; + if (c_retval < 0) + return VIR_PY_NONE; + + if ((py_retval = PyList_New(3)) == NULL) + return NULL; + + VIR_PY_LIST_SET_GOTO(py_retval, 0, + libvirt_intWrap((int) info.type), error); + VIR_PY_LIST_SET_GOTO(py_retval, 1, + libvirt_ulonglongWrap(info.capacity), error); + VIR_PY_LIST_SET_GOTO(py_retval, 2, + libvirt_ulonglongWrap(info.allocation), error); + + return py_retval; + + error: + Py_DECREF(py_retval); + return NULL; +} +#endif + static PyObject * libvirt_virStoragePoolGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) @@ -6839,6 +6879,58 @@ } #endif /* VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED */ +#ifdef VIR_DOMAIN_EVENT_ID_METADATA_CHANGE +static int +libvirt_virConnectDomainEventMetadataChangeCallback(virConnectPtr conn ATTRIBUTE_UNUSED, + virDomainPtr dom, + int type, + const char *nsuri, + void *opaque) +{ + PyObject *pyobj_cbData = (PyObject*)opaque; + PyObject *pyobj_dom; + PyObject *pyobj_ret = NULL; + PyObject *pyobj_conn; + PyObject *dictKey; + int ret = -1; + + LIBVIRT_ENSURE_THREAD_STATE; + + if (!(dictKey = libvirt_constcharPtrWrap("conn"))) + goto cleanup; + pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey); + Py_DECREF(dictKey); + + /* Create a python instance of this virDomainPtr */ + virDomainRef(dom); + if (!(pyobj_dom = libvirt_virDomainPtrWrap(dom))) { + virDomainFree(dom); + goto cleanup; + } + Py_INCREF(pyobj_cbData); + + /* Call the Callback Dispatcher */ + pyobj_ret = PyObject_CallMethod(pyobj_conn, + (char*)"_dispatchDomainEventMetadataChangeCallback", + (char*)"OisO", + pyobj_dom, type, nsuri, pyobj_cbData); + + Py_DECREF(pyobj_cbData); + Py_DECREF(pyobj_dom); + + cleanup: + if (!pyobj_ret) { + DEBUG("%s - ret:%p\n", __FUNCTION__, pyobj_ret); + PyErr_Print(); + } else { + Py_DECREF(pyobj_ret); + ret = 0; + } + + LIBVIRT_RELEASE_THREAD_STATE; + return ret; +} +#endif /* VIR_DOMAIN_EVENT_ID_METADATA_CHANGE */ static PyObject * libvirt_virConnectDomainEventRegisterAny(PyObject *self ATTRIBUTE_UNUSED, @@ -6955,6 +7047,11 @@ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventDeviceRemovalFailedCallback); break; #endif /* VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED */ +#ifdef VIR_DOMAIN_EVENT_ID_METADATA_CHANGE + case VIR_DOMAIN_EVENT_ID_METADATA_CHANGE: + cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventMetadataChangeCallback); + break; +#endif /* VIR_DOMAIN_EVENT_ID_METADATA_CHANGE */ case VIR_DOMAIN_EVENT_ID_LAST: break; } @@ -9098,6 +9195,205 @@ #endif /* LIBVIR_CHECK_VERSION(2, 2, 0)*/ +#if LIBVIR_CHECK_VERSION(3, 0, 0) +static void +libvirt_virConnectSecretEventFreeFunc(void *opaque) +{ + PyObject *pyobj_conn = (PyObject*)opaque; + LIBVIRT_ENSURE_THREAD_STATE; + Py_DECREF(pyobj_conn); + LIBVIRT_RELEASE_THREAD_STATE; +} + +static int +libvirt_virConnectSecretEventLifecycleCallback(virConnectPtr conn ATTRIBUTE_UNUSED, + virSecretPtr secret, + int event, + int detail, + void *opaque) +{ + PyObject *pyobj_cbData = (PyObject*)opaque; + PyObject *pyobj_secret; + PyObject *pyobj_ret = NULL; + PyObject *pyobj_conn; + PyObject *dictKey; + int ret = -1; + + LIBVIRT_ENSURE_THREAD_STATE; + + if (!(dictKey = libvirt_constcharPtrWrap("conn"))) + goto cleanup; + pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey); + Py_DECREF(dictKey); + + /* Create a python instance of this virSecretPtr */ + virSecretRef(secret); + if (!(pyobj_secret = libvirt_virSecretPtrWrap(secret))) { + virSecretFree(secret); + goto cleanup; + } + Py_INCREF(pyobj_cbData); + + /* Call the Callback Dispatcher */ + pyobj_ret = PyObject_CallMethod(pyobj_conn, + (char*)"_dispatchSecretEventLifecycleCallback", + (char*)"OiiO", + pyobj_secret, + event, + detail, + pyobj_cbData); + + Py_DECREF(pyobj_cbData); + Py_DECREF(pyobj_secret); + + cleanup: + if (!pyobj_ret) { + DEBUG("%s - ret:%p\n", __FUNCTION__, pyobj_ret); + PyErr_Print(); + } else { + Py_DECREF(pyobj_ret); + ret = 0; + } + + LIBVIRT_RELEASE_THREAD_STATE; + return ret; +} + +static int +libvirt_virConnectSecretEventGenericCallback(virConnectPtr conn ATTRIBUTE_UNUSED, + virSecretPtr secret, + void *opaque) +{ + PyObject *pyobj_cbData = (PyObject*)opaque; + PyObject *pyobj_secret; + PyObject *pyobj_ret = NULL; + PyObject *pyobj_conn; + PyObject *dictKey; + int ret = -1; + + LIBVIRT_ENSURE_THREAD_STATE; + + if (!(dictKey = libvirt_constcharPtrWrap("conn"))) + goto cleanup; + pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey); + Py_DECREF(dictKey); + + /* Create a python instance of this virSecretPtr */ + virSecretRef(secret); + if (!(pyobj_secret = libvirt_virSecretPtrWrap(secret))) { + virSecretFree(secret); + goto cleanup; + } + Py_INCREF(pyobj_cbData); + + /* Call the Callback Dispatcher */ + pyobj_ret = PyObject_CallMethod(pyobj_conn, + (char*)"_dispatchSecretEventGenericCallback", + (char*)"OO", + pyobj_secret, + pyobj_cbData); + + Py_DECREF(pyobj_cbData); + Py_DECREF(pyobj_secret); + + cleanup: + if (!pyobj_ret) { + DEBUG("%s - ret:%p\n", __FUNCTION__, pyobj_ret); + PyErr_Print(); + } else { + Py_DECREF(pyobj_ret); + ret = 0; + } + + LIBVIRT_RELEASE_THREAD_STATE; + return ret; +} + +static PyObject * +libvirt_virConnectSecretEventRegisterAny(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *pyobj_conn; /* virConnectPtr */ + PyObject *pyobj_secret; + PyObject *pyobj_cbData; /* hash of callback data */ + int eventID; + virConnectPtr conn; + int ret = 0; + virConnectSecretEventGenericCallback cb = NULL; + virSecretPtr secret; + + if (!PyArg_ParseTuple(args, + (char *) "OOiO:virConnectSecretEventRegisterAny", + &pyobj_conn, &pyobj_secret, &eventID, &pyobj_cbData)) + return NULL; + + DEBUG("libvirt_virConnectSecretEventRegister(%p %p %d %p) called\n", + pyobj_conn, pyobj_secret, eventID, pyobj_cbData); + conn = PyvirConnect_Get(pyobj_conn); + if (pyobj_secret == Py_None) + secret = NULL; + else + secret = PyvirSecret_Get(pyobj_secret); + + switch ((virSecretEventID) eventID) { + case VIR_SECRET_EVENT_ID_LIFECYCLE: + cb = VIR_SECRET_EVENT_CALLBACK(libvirt_virConnectSecretEventLifecycleCallback); + break; + + case VIR_SECRET_EVENT_ID_VALUE_CHANGED: + cb = VIR_SECRET_EVENT_CALLBACK(libvirt_virConnectSecretEventGenericCallback); + break; + + case VIR_SECRET_EVENT_ID_LAST: + break; + } + + if (!cb) { + return VIR_PY_INT_FAIL; + } + + Py_INCREF(pyobj_cbData); + + LIBVIRT_BEGIN_ALLOW_THREADS; + ret = virConnectSecretEventRegisterAny(conn, secret, eventID, + cb, pyobj_cbData, + libvirt_virConnectSecretEventFreeFunc); + LIBVIRT_END_ALLOW_THREADS; + + if (ret < 0) { + Py_DECREF(pyobj_cbData); + } + + return libvirt_intWrap(ret); +} + +static PyObject * +libvirt_virConnectSecretEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *pyobj_conn; + int callbackID; + virConnectPtr conn; + int ret = 0; + + if (!PyArg_ParseTuple(args, (char *) "Oi:virConnectSecretEventDeregister", + &pyobj_conn, &callbackID)) + return NULL; + + DEBUG("libvirt_virConnectSecretEventDeregister(%p) called\n", pyobj_conn); + + conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn); + + LIBVIRT_BEGIN_ALLOW_THREADS; + + ret = virConnectSecretEventDeregisterAny(conn, callbackID); + + LIBVIRT_END_ALLOW_THREADS; + + return libvirt_intWrap(ret); +} +#endif /* LIBVIR_CHECK_VERSION(3, 0, 0)*/ + /************************************************************************ * * * The registration stuff * @@ -9203,6 +9499,9 @@ #endif /* LIBVIR_CHECK_VERSION(0, 10, 2) */ {(char *) "virStoragePoolGetInfo", libvirt_virStoragePoolGetInfo, METH_VARARGS, NULL}, {(char *) "virStorageVolGetInfo", libvirt_virStorageVolGetInfo, METH_VARARGS, NULL}, +#if LIBVIR_CHECK_VERSION(3, 0, 0) + {(char *) "virStorageVolGetInfoFlags", libvirt_virStorageVolGetInfoFlags, METH_VARARGS, NULL}, +#endif /* LIBVIR_CHECK_VERSION(3, 0, 0) */ {(char *) "virStoragePoolGetUUID", libvirt_virStoragePoolGetUUID, METH_VARARGS, NULL}, {(char *) "virStoragePoolGetUUIDString", libvirt_virStoragePoolGetUUIDString, METH_VARARGS, NULL}, {(char *) "virStoragePoolLookupByUUID", libvirt_virStoragePoolLookupByUUID, METH_VARARGS, NULL}, @@ -9314,6 +9613,10 @@ {(char *) "virConnectNodeDeviceEventRegisterAny", libvirt_virConnectNodeDeviceEventRegisterAny, METH_VARARGS, NULL}, {(char *) "virConnectNodeDeviceEventDeregisterAny", libvirt_virConnectNodeDeviceEventDeregisterAny, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(2, 2, 0) */ +#if LIBVIR_CHECK_VERSION(3, 0, 0) + {(char *) "virConnectSecretEventRegisterAny", libvirt_virConnectSecretEventRegisterAny, METH_VARARGS, NULL}, + {(char *) "virConnectSecretEventDeregisterAny", libvirt_virConnectSecretEventDeregisterAny, METH_VARARGS, NULL}, +#endif /* LIBVIR_CHECK_VERSION(3, 0, 0) */ {NULL, NULL, 0, NULL} }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-2.5.0/libvirt-python.spec new/libvirt-python-3.0.0/libvirt-python.spec --- old/libvirt-python-2.5.0/libvirt-python.spec 2016-12-04 22:09:12.000000000 +0100 +++ new/libvirt-python-3.0.0/libvirt-python.spec 2017-01-17 19:22:27.000000000 +0100 @@ -6,7 +6,7 @@ Summary: The libvirt virtualization API python2 binding Name: libvirt-python -Version: 2.5.0 +Version: 3.0.0 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-2.5.0/sanitytest.py new/libvirt-python-3.0.0/sanitytest.py --- old/libvirt-python-2.5.0/sanitytest.py 2016-11-01 21:49:14.000000000 +0100 +++ new/libvirt-python-3.0.0/sanitytest.py 2017-01-17 19:20:56.000000000 +0100 @@ -179,6 +179,9 @@ if (name.startswith("virConnectNodeDeviceEvent") and name.endswith("Callback")): continue + if (name.startswith("virConnectSecretEvent") and + name.endswith("Callback")): + continue # virEvent APIs go into main 'libvirt' namespace not any class diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-2.5.0/setup.py new/libvirt-python-3.0.0/setup.py --- old/libvirt-python-2.5.0/setup.py 2016-12-04 22:06:22.000000000 +0100 +++ new/libvirt-python-3.0.0/setup.py 2017-01-17 19:22:22.000000000 +0100 @@ -277,6 +277,20 @@ self.build_platlib = os.path.join(self.build_base, 'lib' + plat_specifier) + def find_nosetests_path(self): + paths = [ + "/usr/bin/nosetests-%d.%d" % (sys.version_info[0], + sys.version_info[1]), + "/usr/bin/nosetests-%d" % (sys.version_info[0]), + "/usr/bin/nosetests", + ] + + for path in paths: + if os.path.exists(path): + return path + + raise Exception("Cannot find any nosetests binary") + def run(self): """ Run test suite @@ -289,7 +303,8 @@ else: os.environ["PYTHONPATH"] = self.build_platlib self.spawn([sys.executable, "sanitytest.py", self.build_platlib, apis[0]]) - self.spawn([sys.executable, "/usr/bin/nosetests"]) + nose = self.find_nosetests_path() + self.spawn([sys.executable, nose]) class my_clean(clean): @@ -307,11 +322,17 @@ _c_modules, _py_modules = get_module_lists() setup(name = 'libvirt-python', - version = '2.5.0', + version = '3.0.0', url = 'http://www.libvirt.org', maintainer = 'Libvirt Maintainers', maintainer_email = '[email protected]', - description = 'The libvirt virtualization API', + description = 'The libvirt virtualization API python binding', + long_description = + '''The libvirt-python package provides a module that permits applications +written in the Python programming language to call the interface +supplied by the libvirt library, to manage the virtualization capabilities +of recent versions of Linux (and other OSes).''', + license = 'LGPLv2+', ext_modules = _c_modules, py_modules = _py_modules, package_dir = {
