diff -Nru libvirt-python-1.2.12/AUTHORS libvirt-python-1.2.15/AUTHORS --- libvirt-python-1.2.12/AUTHORS 2015-01-27 08:04:12.000000000 +0000 +++ libvirt-python-1.2.15/AUTHORS 2015-05-04 03:40:33.000000000 +0000 @@ -212,6 +212,7 @@ Daniel P. Berrange Daniel P. Berrange Daniel P. Berrange + Daniel P. Berrange Daniel Veillard Daniel Veillard Daniel Veillard @@ -432,8 +433,15 @@ Jiri Denemark Jiri Denemark Jiri Denemark + Jiri Denemark Jiri Denemark John Ferlan + John Ferlan + John Ferlan + Ján Tomko + Ján Tomko + Ján Tomko + Ján Tomko Ján Tomko KAMEZAWA Hiroyuki Lai Jiangshan @@ -538,6 +546,8 @@ Pavel Hrdina Pavel Hrdina Pavel Hrdina + Pavel Hrdina + Pavel Hrdina Peter Krempa Peter Krempa Peter Krempa @@ -583,6 +593,9 @@ Tomoki Sekiyama Tomoki Sekiyama Tomoki Sekiyama + Victor Stinner + Victor Stinner + Victor Stinner Viktor Mihajlovski Viktor Mihajlovski Viktor Mihajlovski diff -Nru libvirt-python-1.2.12/ChangeLog libvirt-python-1.2.15/ChangeLog --- libvirt-python-1.2.12/ChangeLog 2015-01-27 08:04:12.000000000 +0000 +++ libvirt-python-1.2.15/ChangeLog 2015-05-04 03:40:33.000000000 +0000 @@ -1,3 +1,135 @@ +2015-04-22 Victor Stinner + + libvirt-python: add classifiers to setup.py + Add the Python 3 classifier, needed by the caniusepython3 tool to check + if dependencies of a projects are Python 3 compatible: + + https://caniusepython3.com/ + + +2015-04-22 Victor Stinner + + Add tox.ini to run tests on Python 2.6, 2.7 & 3.4 + + +2015-04-22 Victor Stinner + + sanitytest.py parameters are now optional + When called without parameters, sanitytest.py doesn't touch sys.path and + locates itself the patch to the libvirt-api.xml file using pkg-config. + + This change makes possible to run sanitytest.py from tox. + + +2015-04-15 Ján Tomko + + Implement the DEVICE_ADDED event + + +2015-04-02 Jiri Denemark + + Post-release version bump to 1.2.15 + + +2015-03-28 Pavel Hrdina + + Expose virDomainInterfacesAddresses to python binding + examples/Makefile.am: + * Add new file domipaddrs.py + + examples/README: + * Add documentation for the python example + + libvirt-override-api.xml: + * Add new symbol for virDomainInterfacesAddresses + + libvirt-override.c: + * Hand written python api + + Example: + $ python examples/domipaddrs.py qemu:///system f18 + Interface MAC address Protocol Address + vnet0 52:54:00:20:70:3d ipv4 192.168.105.240/16 + + + +2015-03-26 Ján Tomko + + Rename virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo + + +2015-03-26 Ján Tomko + + Rename virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree + + +2015-03-19 Pavel Hrdina + + Post-release version bump to 1.2.14 + + +2015-03-11 John Ferlan + + Support virDomainPinIOThread + Support the libvirt_virDomainSetIOThreads method using code that mimics + the existing libvirt_virDomainPinVcpuFlags method + + The following is a sample session assuming guest 'iothr-gst' has IOThreads + configured (it's currently running, too) + + >>> import libvirt + >>> con=libvirt.open("qemu:///system") + >>> dom=con.lookupByName('iothr-gst') + >>> dom.ioThreadsInfo() + [(1, [False, False, True, False]), (2, [False, False, False, True]), (3, [True, True, True, True])] + >>> cpumap=(True,True,True,False) + >>> dom.pinIOThread(3,cpumap) + 0 + >>> print dom.ioThreadsInfo() + [(1, [False, False, True, False]), (2, [False, False, False, True]), (3, [True, True, True, False])] + >>> + + merge + + +2015-03-11 John Ferlan + + Support virDomainGetIOThreadsInfo and virDomainIOThreadsInfoFree + Add support for the libvirt_virDomainGetIOThreadsInfo method. This + code mostly follows the libvirt_virDomainGetVcpuPinInfo method, but + also takes some from the libvirt_virNodeGetCPUMap method with respect + to building the cpumap into the returned tuple rather than two separate + tuples which vcpu pinning generates + + Assuming two domains, one with IOThreads defined (eg, 'iothr-gst') and + one without ('noiothr-gst'), execute the following in an 'iothr.py' file: + + import libvirt + con=libvirt.open("qemu:///system") + dom=con.lookupByName('iothr-gst') + print dom.ioThreadsInfo() + dom2=con.lookupByName('noiothr-gst') + print dom2.ioThreadsInfo() + + $ python iothr.py + [(1, [False, False, True, False]), (2, [False, False, False, True]), (3, [True, True, True, True])] + [] + $ + + +2015-03-05 Ján Tomko + + Clarify description for virNodeGetSecurityModel + s/host/hypervisor/ to match the wording used by the C binding. + + https://bugzilla.redhat.com/show_bug.cgi?id=1198518 + + +2015-01-27 Daniel P. Berrange + + Post-release version bump to 1.2.13 + + 2015-01-19 Pavel Hrdina sanitytest: fix mapping test for virDomainDefineXMLFlags diff -Nru libvirt-python-1.2.12/debian/changelog libvirt-python-1.2.15/debian/changelog --- libvirt-python-1.2.12/debian/changelog 2015-02-04 16:06:41.000000000 +0000 +++ libvirt-python-1.2.15/debian/changelog 2015-05-07 15:39:46.000000000 +0000 @@ -1,3 +1,9 @@ +libvirt-python (1.2.15-0ubuntu1) wily; urgency=medium + + * New upstream release. + + -- Chuck Short Thu, 07 May 2015 11:39:33 -0400 + libvirt-python (1.2.12-0ubuntu1) vivid; urgency=medium * New uptream release. diff -Nru libvirt-python-1.2.12/examples/domipaddrs.py libvirt-python-1.2.15/examples/domipaddrs.py --- libvirt-python-1.2.12/examples/domipaddrs.py 1970-01-01 00:00:00.000000000 +0000 +++ libvirt-python-1.2.15/examples/domipaddrs.py 2015-04-02 07:37:06.000000000 +0000 @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# domipaddrs - print domain interfaces along with their MAC and IP addresses + +import libvirt +import sys + +def usage(): + print "Usage: %s [URI] DOMAIN" % sys.argv[0] + print " Print domain interfaces along with their MAC and IP addresses" + +uri = None +name = None +args = len(sys.argv) + +if args == 2: + name = sys.argv[1] +elif args == 3: + uri = sys.argv[1] + name = sys.argv[2] +else: + usage() + sys.exit(2) + +conn = libvirt.open(uri) +if conn == None: + print "Unable to open connection to libvirt" + sys.exit(1) + +try: + dom = conn.lookupByName(name) +except libvirt.libvirtError: + print "Domain %s not found" % name + sys.exit(0) + +ifaces = dom.interfaceAddresses(libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE); +if (ifaces == None): + print "Failed to get domain interfaces" + sys.exit(0) + +print " {0:10} {1:20} {2:12} {3}".format("Interface", "MAC address", "Protocol", "Address") + +def toIPAddrType(addrType): + if addrType == libvirt.VIR_IP_ADDR_TYPE_IPV4: + return "ipv4" + elif addrType == libvirt.VIR_IP_ADDR_TYPE_IPV6: + return "ipv6" + +for (name, val) in ifaces.iteritems(): + if val['addrs']: + for addr in val['addrs']: + print " {0:10} {1:19}".format(name, val['hwaddr']), + print " {0:12} {1}/{2} ".format(toIPAddrType(addr['type']), addr['addr'], addr['prefix']), + print + else: + print " {0:10} {1:19}".format(name, val['hwaddr']), + print " {0:12} {1}".format("N/A", "N/A"), + print diff -Nru libvirt-python-1.2.12/examples/event-test.py libvirt-python-1.2.15/examples/event-test.py --- libvirt-python-1.2.12/examples/event-test.py 2014-12-13 02:42:57.000000000 +0000 +++ libvirt-python-1.2.15/examples/event-test.py 2015-05-04 03:28:00.000000000 +0000 @@ -527,6 +527,9 @@ print("myDomainEventTunableCallback: Domain %s(%s) %s" % (dom.name(), dom.ID(), params)) def myDomainEventAgentLifecycleCallback(conn, dom, state, reason, opaque): print("myDomainEventAgentLifecycleCallback: Domain %s(%s) %s %s" % (dom.name(), dom.ID(), agentLifecycleStateToString(state), agentLifecycleReasonToString(reason))) +def myDomainEventDeviceAddedCallback(conn, dom, dev, opaque): + print("myDomainEventDeviceAddedCallback: Domain %s(%s) device added: %s" % ( + dom.name(), dom.ID(), dev)) ########################################################################## # Network events @@ -638,6 +641,7 @@ vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2, myDomainEventBlockJob2Callback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_TUNABLE, myDomainEventTunableCallback, None) vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE, myDomainEventAgentLifecycleCallback, None) + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE_ADDED, myDomainEventDeviceAddedCallback, None) vc.networkEventRegisterAny(None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE, myNetworkEventLifecycleCallback, None) diff -Nru libvirt-python-1.2.12/generator.py libvirt-python-1.2.15/generator.py --- libvirt-python-1.2.12/generator.py 2015-01-21 07:24:08.000000000 +0000 +++ libvirt-python-1.2.15/generator.py 2015-04-02 07:37:06.000000000 +0000 @@ -435,6 +435,8 @@ 'virDomainGetVcpuPinInfo', 'virDomainGetEmulatorPinInfo', 'virDomainPinEmulator', + 'virDomainGetIOThreadInfo', + 'virDomainPinIOThread', 'virSecretGetValue', 'virSecretSetValue', 'virSecretGetUUID', @@ -481,6 +483,7 @@ 'virDomainBlockCopy', 'virNodeAllocPages', 'virDomainGetFSInfo', + 'virDomainInterfaceAddresses', ) lxc_skip_impl = ( @@ -592,6 +595,8 @@ 'virNetworkDHCPLeaseFree', # only useful in C, python code uses list 'virDomainStatsRecordListFree', # only useful in C, python uses dict 'virDomainFSInfoFree', # only useful in C, python code uses list + 'virDomainIOThreadInfoFree', # only useful in C, python code uses list + 'virDomainInterfaceFree', # only useful in C, python code uses list ) lxc_skip_function = ( @@ -1144,6 +1149,9 @@ elif name[0:20] == "virDomainGetCPUStats": func = name[9:] func = func[0:1].lower() + func[1:] + elif name[0:24] == "virDomainGetIOThreadInfo": + func = name[12:] + func = func[0:2].lower() + func[2:] elif name[0:18] == "virDomainGetFSInfo": func = name[12:] func = func[0:2].lower() + func[2:] diff -Nru libvirt-python-1.2.12/libvirt-override-api.xml libvirt-python-1.2.15/libvirt-override-api.xml --- libvirt-python-1.2.12/libvirt-override-api.xml 2014-12-13 02:42:57.000000000 +0000 +++ libvirt-python-1.2.15/libvirt-override-api.xml 2015-04-02 07:37:06.000000000 +0000 @@ -105,7 +105,7 @@ - Extract information about the host security model + Extract information about the hypervisor security model @@ -278,6 +278,20 @@ + + Query the CPU affinity setting of the IOThreads of the domain + + + + + + Dynamically change the real CPUs which can be allocated to an IOThread. This function requires privileged access to the hypervisor. + + + + + + Change the scheduler parameters @@ -664,5 +678,12 @@ + + returns a dictionary of domain interfaces along with their MAC and IP addresses + + + + + diff -Nru libvirt-python-1.2.12/libvirt-override.c libvirt-python-1.2.15/libvirt-override.c --- libvirt-python-1.2.12/libvirt-override.c 2015-01-21 07:24:08.000000000 +0000 +++ libvirt-python-1.2.15/libvirt-override.c 2015-05-04 03:28:00.000000000 +0000 @@ -1990,6 +1990,162 @@ } #endif /* LIBVIR_CHECK_VERSION(0, 10, 0) */ +#if LIBVIR_CHECK_VERSION(1, 2, 14) +static PyObject * +libvirt_virDomainGetIOThreadInfo(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + virDomainPtr domain; + PyObject *pyobj_domain; + PyObject *py_retval = NULL; + PyObject *py_iothrinfo = NULL; + virDomainIOThreadInfoPtr *iothrinfo = NULL; + unsigned int flags; + size_t pcpu, i; + int niothreads, cpunum; + + if (!PyArg_ParseTuple(args, (char *)"OI:virDomainGetIOThreadInfo", + &pyobj_domain, &flags)) + return NULL; + domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + + if ((cpunum = getPyNodeCPUCount(virDomainGetConnect(domain))) < 0) + return VIR_PY_NONE; + + LIBVIRT_BEGIN_ALLOW_THREADS; + niothreads = virDomainGetIOThreadInfo(domain, &iothrinfo, flags); + LIBVIRT_END_ALLOW_THREADS; + + if (niothreads < 0) { + py_retval = VIR_PY_NONE; + goto cleanup; + } + + /* convert to a Python list */ + if ((py_iothrinfo = PyList_New(niothreads)) == NULL) + goto cleanup; + + /* NOTE: If there are zero IOThreads we will return an empty list */ + for (i = 0; i < niothreads; i++) { + PyObject *iothrtpl = NULL; + PyObject *iothrid = NULL; + PyObject *iothrmap = NULL; + virDomainIOThreadInfoPtr iothr = iothrinfo[i]; + + if (iothr == NULL) { + py_retval = VIR_PY_NONE; + goto cleanup; + } + + if ((iothrtpl = PyTuple_New(2)) == NULL || + PyList_SetItem(py_iothrinfo, i, iothrtpl) < 0) { + Py_XDECREF(iothrtpl); + goto cleanup; + } + + /* 0: IOThread ID */ + if ((iothrid = libvirt_uintWrap(iothr->iothread_id)) == NULL || + PyTuple_SetItem(iothrtpl, 0, iothrid) < 0) { + Py_XDECREF(iothrid); + goto cleanup; + } + + /* 1: CPU map */ + if ((iothrmap = PyList_New(cpunum)) == NULL || + PyTuple_SetItem(iothrtpl, 1, iothrmap) < 0) { + Py_XDECREF(iothrmap); + goto cleanup; + } + for (pcpu = 0; pcpu < cpunum; pcpu++) { + PyObject *pyused; + if ((pyused = PyBool_FromLong(VIR_CPU_USED(iothr->cpumap, + pcpu))) == NULL) { + py_retval = VIR_PY_NONE; + goto cleanup; + } + if (PyList_SetItem(iothrmap, pcpu, pyused) < 0) { + Py_XDECREF(pyused); + goto cleanup; + } + } + } + + py_retval = py_iothrinfo; + py_iothrinfo = NULL; + +cleanup: + for (i = 0; i < niothreads; i++) + virDomainIOThreadInfoFree(iothrinfo[i]); + VIR_FREE(iothrinfo); + Py_XDECREF(py_iothrinfo); + return py_retval; +} + +static PyObject * +libvirt_virDomainPinIOThread(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + virDomainPtr domain; + PyObject *pyobj_domain, *pycpumap; + PyObject *ret = NULL; + unsigned char *cpumap; + int cpumaplen, iothread_val, tuple_size, cpunum; + size_t i; + unsigned int flags; + int i_retval; + + if (!PyArg_ParseTuple(args, (char *)"OiOI:virDomainPinIOThread", + &pyobj_domain, &iothread_val, &pycpumap, &flags)) + return NULL; + domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + + if ((cpunum = getPyNodeCPUCount(virDomainGetConnect(domain))) < 0) + return VIR_PY_INT_FAIL; + + if (PyTuple_Check(pycpumap)) { + if ((tuple_size = PyTuple_Size(pycpumap)) == -1) + return ret; + } else { + PyErr_SetString(PyExc_TypeError, "Unexpected type, tuple is required"); + return ret; + } + + cpumaplen = VIR_CPU_MAPLEN(cpunum); + if (VIR_ALLOC_N(cpumap, cpumaplen) < 0) + return PyErr_NoMemory(); + + for (i = 0; i < tuple_size; i++) { + PyObject *flag = PyTuple_GetItem(pycpumap, i); + bool b; + + if (!flag || libvirt_boolUnwrap(flag, &b) < 0) + goto cleanup; + + if (b) + VIR_USE_CPU(cpumap, i); + else + VIR_UNUSE_CPU(cpumap, i); + } + + for (; i < cpunum; i++) + VIR_UNUSE_CPU(cpumap, i); + + LIBVIRT_BEGIN_ALLOW_THREADS; + i_retval = virDomainPinIOThread(domain, iothread_val, + cpumap, cpumaplen, flags); + LIBVIRT_END_ALLOW_THREADS; + if (i_retval < 0) { + ret = VIR_PY_INT_FAIL; + goto cleanup; + } + ret = VIR_PY_INT_SUCCESS; + +cleanup: + VIR_FREE(cpumap); + return ret; +} + +#endif /* LIBVIR_CHECK_VERSION(1, 2, 14) */ /************************************************************************ * * @@ -4964,6 +5120,131 @@ return py_retval; } + +#if LIBVIR_CHECK_VERSION(1, 2, 14) +static PyObject * +libvirt_virDomainInterfaceAddresses(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *py_retval = VIR_PY_NONE; + PyObject *pyobj_domain; + virDomainPtr domain; + virDomainInterfacePtr *ifaces = NULL; + unsigned int source; + unsigned int flags; + int ifaces_count = 0; + size_t i, j; + + if (!PyArg_ParseTuple(args, (char *) "Oii:virDomainInterfaceAddresses", + &pyobj_domain, &source, &flags)) + goto error; + + domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + + LIBVIRT_BEGIN_ALLOW_THREADS; + ifaces_count = virDomainInterfaceAddresses(domain, &ifaces, source, flags); + LIBVIRT_END_ALLOW_THREADS; + + if (ifaces_count < 0) + goto cleanup; + + if (!(py_retval = PyDict_New())) + goto error; + + for (i = 0; i < ifaces_count; i++) { + virDomainInterfacePtr iface = ifaces[i]; + PyObject *py_addrs = NULL; + PyObject *py_iface = NULL; + PyObject *py_iname = NULL; + PyObject *py_ivalue = NULL; + + if (!(py_iface = PyDict_New())) + goto error; + + if ((py_iname = libvirt_charPtrWrap(iface->name)) == NULL || + PyDict_SetItem(py_retval, py_iname, py_iface) < 0) { + Py_XDECREF(py_iname); + Py_DECREF(py_iface); + goto error; + } + + if (iface->naddrs) { + if (!(py_addrs = PyList_New(iface->naddrs))) { + goto error; + } + } else { + py_addrs = VIR_PY_NONE; + } + + if ((py_iname = libvirt_constcharPtrWrap("addrs")) == NULL || + PyDict_SetItem(py_iface, py_iname, py_addrs) < 0) { + Py_XDECREF(py_iname); + Py_DECREF(py_addrs); + goto error; + } + + if ((py_iname = libvirt_constcharPtrWrap("hwaddr")) == NULL || + (py_ivalue = libvirt_constcharPtrWrap(iface->hwaddr)) == NULL || + PyDict_SetItem(py_iface, py_iname, py_ivalue) < 0) { + Py_XDECREF(py_iname); + Py_XDECREF(py_ivalue); + goto error; + } + + for (j = 0; j < iface->naddrs; j++) { + virDomainIPAddressPtr addr = &(iface->addrs[j]); + PyObject *py_addr = PyDict_New(); + + if (!py_addr) + goto error; + + if (PyList_SetItem(py_addrs, j, py_addr) < 0) { + Py_DECREF(py_addr); + goto error; + } + + if ((py_iname = libvirt_constcharPtrWrap("addr")) == NULL || + (py_ivalue = libvirt_constcharPtrWrap(addr->addr)) == NULL || + PyDict_SetItem(py_addr, py_iname, py_ivalue) < 0) { + Py_XDECREF(py_iname); + Py_XDECREF(py_ivalue); + goto error; + } + if ((py_iname = libvirt_constcharPtrWrap("prefix")) == NULL || + (py_ivalue = libvirt_intWrap(addr->prefix)) == NULL || + PyDict_SetItem(py_addr, py_iname, py_ivalue) < 0) { + Py_XDECREF(py_iname); + Py_XDECREF(py_ivalue); + goto error; + } + if ((py_iname = libvirt_constcharPtrWrap("type")) == NULL || + (py_ivalue = libvirt_intWrap(addr->type)) == NULL || + PyDict_SetItem(py_addr, py_iname, py_ivalue) < 0) { + Py_XDECREF(py_iname); + Py_XDECREF(py_ivalue); + goto error; + } + } + } + +cleanup: + if (ifaces && ifaces_count > 0) { + for (i = 0; i < ifaces_count; i++) { + virDomainInterfaceFree(ifaces[i]); + } + } + VIR_FREE(ifaces); + + return py_retval; + +error: + Py_XDECREF(py_retval); + py_retval = NULL; + goto cleanup; +} +#endif /* LIBVIR_CHECK_VERSION(1, 2, 14) */ + + /******************************************* * Helper functions to avoid importing modules * for every callback @@ -6620,6 +6901,58 @@ } #endif /* VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE */ +#ifdef VIR_DOMAIN_EVENT_ID_DEVICE_ADDED +static int +libvirt_virConnectDomainEventDeviceAddedCallback(virConnectPtr conn ATTRIBUTE_UNUSED, + virDomainPtr dom, + const char *devAlias, + 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*)"_dispatchDomainEventDeviceAddedCallback", + (char*)"OsO", + pyobj_dom, devAlias, 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_DEVICE_ADDED */ static PyObject * libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, @@ -6718,6 +7051,11 @@ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventAgentLifecycleCallback); break; #endif /* VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE */ +#ifdef VIR_DOMAIN_EVENT_ID_DEVICE_ADDED + case VIR_DOMAIN_EVENT_ID_DEVICE_ADDED: + cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventDeviceAddedCallback); + break; +#endif /* VIR_DOMAIN_EVENT_ID_DEVICE_ADDED */ case VIR_DOMAIN_EVENT_ID_LAST: break; } @@ -8483,6 +8821,10 @@ {(char *) "virDomainGetEmulatorPinInfo", libvirt_virDomainGetEmulatorPinInfo, METH_VARARGS, NULL}, {(char *) "virDomainPinEmulator", libvirt_virDomainPinEmulator, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(0, 10, 0) */ +#if LIBVIR_CHECK_VERSION(1, 2, 14) + {(char *) "virDomainGetIOThreadInfo", libvirt_virDomainGetIOThreadInfo, METH_VARARGS, NULL}, + {(char *) "virDomainPinIOThread", libvirt_virDomainPinIOThread, METH_VARARGS, NULL}, +#endif /* LIBVIR_CHECK_VERSION(1, 2, 14) */ {(char *) "virConnectListStoragePools", libvirt_virConnectListStoragePools, METH_VARARGS, NULL}, {(char *) "virConnectListDefinedStoragePools", libvirt_virConnectListDefinedStoragePools, METH_VARARGS, NULL}, #if LIBVIR_CHECK_VERSION(0, 10, 2) @@ -8590,6 +8932,9 @@ #if LIBVIR_CHECK_VERSION(1, 2, 11) {(char *) "virDomainGetFSInfo", libvirt_virDomainGetFSInfo, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(1, 2, 11) */ +#if LIBVIR_CHECK_VERSION(1, 2, 14) + {(char *) "virDomainInterfaceAddresses", libvirt_virDomainInterfaceAddresses, METH_VARARGS, NULL}, +#endif /* LIBVIR_CHECK_VERSION(1, 2, 14) */ {NULL, NULL, 0, NULL} }; diff -Nru libvirt-python-1.2.12/libvirt-override-virConnect.py libvirt-python-1.2.15/libvirt-override-virConnect.py --- libvirt-python-1.2.12/libvirt-override-virConnect.py 2014-12-13 02:42:57.000000000 +0000 +++ libvirt-python-1.2.15/libvirt-override-virConnect.py 2015-05-04 03:28:00.000000000 +0000 @@ -207,6 +207,15 @@ cb(self, virDomain(self, _obj=dom), state, reason, opaque) return 0 + def _dispatchDomainEventDeviceAddedCallback(self, dom, devAlias, cbData): + """Dispatches event to python user domain device added event callbacks + """ + cb = cbData["cb"] + opaque = cbData["opaque"] + + cb(self, virDomain(self, _obj=dom), devAlias, 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 """ diff -Nru libvirt-python-1.2.12/libvirt-python.spec libvirt-python-1.2.15/libvirt-python.spec --- libvirt-python-1.2.12/libvirt-python.spec 2015-01-27 08:04:11.000000000 +0000 +++ libvirt-python-1.2.15/libvirt-python.spec 2015-05-04 03:40:33.000000000 +0000 @@ -6,7 +6,7 @@ Summary: The libvirt virtualization API python2 binding Name: libvirt-python -Version: 1.2.12 +Version: 1.2.15 Release: 1%{?dist}%{?extra_release} Source0: http://libvirt.org/sources/python/%{name}-%{version}.tar.gz Url: http://libvirt.org diff -Nru libvirt-python-1.2.12/PKG-INFO libvirt-python-1.2.15/PKG-INFO --- libvirt-python-1.2.12/PKG-INFO 2015-01-27 08:04:13.000000000 +0000 +++ libvirt-python-1.2.15/PKG-INFO 2015-05-04 03:40:33.000000000 +0000 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: libvirt-python -Version: 1.2.12 +Version: 1.2.15 Summary: The libvirt virtualization API Home-page: http://www.libvirt.org Author: Libvirt Maintainers @@ -8,3 +8,9 @@ License: UNKNOWN Description: UNKNOWN Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+) +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 3 diff -Nru libvirt-python-1.2.12/sanitytest.py libvirt-python-1.2.15/sanitytest.py --- libvirt-python-1.2.12/sanitytest.py 2015-01-21 07:24:08.000000000 +0000 +++ libvirt-python-1.2.15/sanitytest.py 2015-05-04 03:28:00.000000000 +0000 @@ -5,18 +5,31 @@ import lxml.etree import string -# Munge import path to insert build location for libvirt mod -sys.path.insert(0, sys.argv[1]) +if len(sys.argv) >= 2: + # Munge import path to insert build location for libvirt mod + sys.path.insert(0, sys.argv[1]) import libvirt if sys.version > '3': long = int +def get_libvirt_api_xml_path(): + import subprocess + args = ["pkg-config", "--variable", "libvirt_api", "libvirt"] + proc = subprocess.Popen(args, stdout=subprocess.PIPE) + stdout, _ = proc.communicate() + if proc.returncode: + sys.exit(proc.returncode) + return stdout.splitlines()[0] + # Path to the libvirt API XML file -xml = sys.argv[2] +if len(sys.argv) >= 3: + xml = sys.argv[2] +else: + xml = get_libvirt_api_xml_path() -f = open(xml, "r") -tree = lxml.etree.parse(f) +with open(xml, "r") as fp: + tree = lxml.etree.parse(fp) verbose = False fail = False @@ -142,6 +155,12 @@ if name[0:19] == "virDomainFSInfoFree": continue + if name[0:25] == "virDomainIOThreadInfoFree": + continue + + if name[0:22] == "virDomainInterfaceFree": + continue + if name[0:21] == "virDomainListGetStats": name = "virConnectDomainListGetStats" @@ -276,6 +295,8 @@ func = "nwfilter" + func[8:] if func[0:8] == "fSFreeze" or func[0:6] == "fSThaw" or func[0:6] == "fSInfo": func = "fs" + func[2:] + if func[0:12] == "iOThreadInfo": + func = "ioThreadInfo" if klass == "virNetwork": func = func.replace("dHCP", "DHCP") diff -Nru libvirt-python-1.2.12/setup.py libvirt-python-1.2.15/setup.py --- libvirt-python-1.2.12/setup.py 2015-01-21 07:24:08.000000000 +0000 +++ libvirt-python-1.2.15/setup.py 2015-05-04 03:28:00.000000000 +0000 @@ -309,7 +309,7 @@ _c_modules, _py_modules = get_module_lists() setup(name = 'libvirt-python', - version = '1.2.12', + version = '1.2.15', url = 'http://www.libvirt.org', maintainer = 'Libvirt Maintainers', maintainer_email = 'libvir-list@redhat.com', @@ -325,4 +325,13 @@ 'sdist': my_sdist, 'rpm': my_rpm, 'test': my_test - }) + }, + classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3", + ] +) diff -Nru libvirt-python-1.2.12/tox.ini libvirt-python-1.2.15/tox.ini --- libvirt-python-1.2.12/tox.ini 1970-01-01 00:00:00.000000000 +0000 +++ libvirt-python-1.2.15/tox.ini 2015-05-04 03:28:00.000000000 +0000 @@ -0,0 +1,10 @@ +[tox] +envlist = py26,py27,py34 + +[testenv] +deps= + lxml + nose +commands= + python sanitytest.py + nosetests