From b064910361e758627346d3be13d4103694327444 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 19 2015 03:40:26 +0000 Subject: import libvirt-python-1.2.17-2.el7 --- diff --git a/.gitignore b/.gitignore index 285516b..04001dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/libvirt-python-1.2.8.tar.gz +SOURCES/libvirt-python-1.2.17.tar.gz diff --git a/.libvirt-python.metadata b/.libvirt-python.metadata index 5f4cfee..378d077 100644 --- a/.libvirt-python.metadata +++ b/.libvirt-python.metadata @@ -1 +1 @@ -becf2db2ec452bdd27530139020b2499bf7ae6bf SOURCES/libvirt-python-1.2.8.tar.gz +c1f066dc710e172099d8401ec205d1e59eff950c SOURCES/libvirt-python-1.2.17.tar.gz diff --git a/SOURCES/libvirt-python-Check-return-value-of-PyList_Append.patch b/SOURCES/libvirt-python-Check-return-value-of-PyList_Append.patch new file mode 100644 index 0000000..8f4a3bc --- /dev/null +++ b/SOURCES/libvirt-python-Check-return-value-of-PyList_Append.patch @@ -0,0 +1,98 @@ +From 13ba25fa006ae1af1b3a7507cefc9fb433859803 Mon Sep 17 00:00:00 2001 +Message-Id: <13ba25fa006ae1af1b3a7507cefc9fb433859803@dist-git> +From: Jiri Denemark +Date: Mon, 3 Aug 2015 10:26:26 +0200 +Subject: [PATCH] Check return value of PyList_Append + +libvirt_virDomainGetSecurityLabelList called PyList_Append without +checking its return value. While looking at it I noticed the function +did not properly check several other return values either so I fixed +them all. + +https://bugzilla.redhat.com/show_bug.cgi?id=1249511 + +Signed-off-by: Jiri Denemark +(cherry picked from commit 5a6b2c98390a2344c9c3cc10a1c346a4838f0d58) +Signed-off-by: Jiri Denemark +--- + libvirt-override.c | 46 ++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 38 insertions(+), 8 deletions(-) + +diff --git a/libvirt-override.c b/libvirt-override.c +index 2398228..4dfe332 100644 +--- a/libvirt-override.c ++++ b/libvirt-override.c +@@ -3144,32 +3144,62 @@ libvirt_virDomainGetSecurityLabel(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg + + #if LIBVIR_CHECK_VERSION(0, 10, 0) + static PyObject * +-libvirt_virDomainGetSecurityLabelList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { ++libvirt_virDomainGetSecurityLabelList(PyObject *self ATTRIBUTE_UNUSED, ++ PyObject *args) ++{ + PyObject *py_retval; + int c_retval; + virDomainPtr dom; + PyObject *pyobj_dom; +- virSecurityLabel *labels; ++ virSecurityLabel *labels = NULL; + size_t i; + + if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetSecurityLabel", &pyobj_dom)) + return NULL; ++ + dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom); + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virDomainGetSecurityLabelList(dom, &labels); + LIBVIRT_END_ALLOW_THREADS; ++ + if (c_retval < 0) + return VIR_PY_NONE; +- py_retval = PyList_New(0); ++ ++ if (!(py_retval = PyList_New(0))) ++ goto error; ++ + for (i = 0 ; i < c_retval ; i++) { +- PyObject *entry = PyList_New(2); +- PyList_SetItem(entry, 0, libvirt_constcharPtrWrap(&labels[i].label[0])); +- PyList_SetItem(entry, 1, libvirt_boolWrap(labels[i].enforcing)); +- PyList_Append(py_retval, entry); ++ PyObject *entry; ++ PyObject *value; ++ ++ if (!(entry = PyList_New(2)) || ++ PyList_Append(py_retval, entry) < 0) { ++ Py_XDECREF(entry); ++ goto error; ++ } ++ ++ if (!(value = libvirt_constcharPtrWrap(&labels[i].label[0])) || ++ PyList_SetItem(entry, 0, value) < 0) { ++ Py_XDECREF(value); ++ goto error; ++ } ++ ++ if (!(value = libvirt_boolWrap(labels[i].enforcing)) || ++ PyList_SetItem(entry, 1, value) < 0) { ++ Py_XDECREF(value); ++ goto error; ++ } + } +- free(labels); ++ ++ cleanup: ++ VIR_FREE(labels); + return py_retval; ++ ++ error: ++ Py_XDECREF(py_retval); ++ py_retval = NULL; ++ goto cleanup; + } + #endif /* LIBVIR_CHECK_VERSION(0, 10, 0) */ + +-- +2.5.0 + diff --git a/SOURCES/libvirt-python-Check-return-value-of-libvirt_uintUnwrap.patch b/SOURCES/libvirt-python-Check-return-value-of-libvirt_uintUnwrap.patch deleted file mode 100644 index 24c5045..0000000 --- a/SOURCES/libvirt-python-Check-return-value-of-libvirt_uintUnwrap.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 8a896123e4162dfca23834023f2bb50ffa618f55 Mon Sep 17 00:00:00 2001 -Message-Id: <8a896123e4162dfca23834023f2bb50ffa618f55@dist-git> -From: Jiri Denemark -Date: Thu, 6 Nov 2014 10:20:40 +0100 -Subject: [PATCH] Check return value of libvirt_uintUnwrap - -libvirt_virDomainSendKey didn't check whether libvirt_uintUnwrap -succeeded or not. - -https://bugzilla.redhat.com/show_bug.cgi?id=1161039 -Signed-off-by: Jiri Denemark -(cherry picked from commit 8dcdc7f2b4d8ebe7c892a2f92c23f77c59106189) -Signed-off-by: Jiri Denemark ---- - libvirt-override.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/libvirt-override.c b/libvirt-override.c -index f528100..1a91c7f 100644 ---- a/libvirt-override.c -+++ b/libvirt-override.c -@@ -7149,7 +7149,8 @@ libvirt_virDomainSendKey(PyObject *self ATTRIBUTE_UNUSED, - } - - for (i = 0; i < nkeycodes; i++) { -- libvirt_uintUnwrap(PyList_GetItem(pyobj_list, i), &(keycodes[i])); -+ if (libvirt_uintUnwrap(PyList_GetItem(pyobj_list, i), &keycodes[i]) < 0) -+ return NULL; - } - - LIBVIRT_BEGIN_ALLOW_THREADS; --- -2.1.3 - diff --git a/SOURCES/libvirt-python-Fix-parsing-of-flags-argument-for-bulk-stats-functions.patch b/SOURCES/libvirt-python-Fix-parsing-of-flags-argument-for-bulk-stats-functions.patch deleted file mode 100644 index d914cfd..0000000 --- a/SOURCES/libvirt-python-Fix-parsing-of-flags-argument-for-bulk-stats-functions.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 803928d78f90b4a045a4682ee0c692bbf9f5c89d Mon Sep 17 00:00:00 2001 -Message-Id: <803928d78f90b4a045a4682ee0c692bbf9f5c89d@dist-git> -From: Luyao Huang -Date: Wed, 22 Oct 2014 09:55:14 +0200 -Subject: [PATCH] Fix parsing of 'flags' argument for bulk stats functions - -https://bugzilla.redhat.com/show_bug.cgi?id=1155016 - -When 'flags' is set to -'libvirt.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, -python will report a error: - -OverflowError: signed integer is greater than maximum - -as VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS is defined as 1<<31. -This happens as PyArg_ParseTuple's formatting string containing 'i' as a -modifier expects a signed integer. - -With python >= 2.3, 'I' means unsigned int and 'i' means int so we -should use 'I' in the formatting string. - -See: https://docs.python.org/2/c-api/arg.html - -Signed-off-by: Luyao Huang -Signed-off-by: Peter Krempa -(cherry picked from commit b3aa7da4bbc5f44f34cde8a9b719c5c2ecbf7f8b) -Signed-off-by: Jiri Denemark ---- - libvirt-override.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libvirt-override.c b/libvirt-override.c -index 872e33b..e072602 100644 ---- a/libvirt-override.c -+++ b/libvirt-override.c -@@ -8024,7 +8024,7 @@ libvirt_virConnectGetAllDomainStats(PyObject *self ATTRIBUTE_UNUSED, - unsigned int flags; - unsigned int stats; - -- if (!PyArg_ParseTuple(args, (char *)"Oii:virConnectGetAllDomainStats", -+ if (!PyArg_ParseTuple(args, (char *)"OII:virConnectGetAllDomainStats", - &pyobj_conn, &stats, &flags)) - return NULL; - conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn); -@@ -8060,7 +8060,7 @@ libvirt_virDomainListGetStats(PyObject *self ATTRIBUTE_UNUSED, - unsigned int flags; - unsigned int stats; - -- if (!PyArg_ParseTuple(args, (char *)"OOii:virDomainListGetStats", -+ if (!PyArg_ParseTuple(args, (char *)"OOII:virDomainListGetStats", - &pyobj_conn, &py_domlist, &stats, &flags)) - return NULL; - --- -2.1.3 - diff --git a/SOURCES/libvirt-python-RHEL-change-version-checking-from-1.2.9-to-1.2.8-for-tunable-event.patch b/SOURCES/libvirt-python-RHEL-change-version-checking-from-1.2.9-to-1.2.8-for-tunable-event.patch deleted file mode 100644 index c2e94c7..0000000 --- a/SOURCES/libvirt-python-RHEL-change-version-checking-from-1.2.9-to-1.2.8-for-tunable-event.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 354f605b3a8925b9525c1b2a2a8e5702d7a9cb94 Mon Sep 17 00:00:00 2001 -Message-Id: <354f605b3a8925b9525c1b2a2a8e5702d7a9cb94@dist-git> -From: Pavel Hrdina -Date: Wed, 1 Oct 2014 11:58:07 +0200 -Subject: [PATCH] RHEL: change version checking from 1.2.9 to 1.2.8 for tunable - event - -We will keep the original commit to make the future rebase easy that -just this patch will be dropped. - -RHEL only -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1147639 - -Signed-off-by: Pavel Hrdina -Signed-off-by: Jiri Denemark ---- - libvirt-override.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/libvirt-override.c b/libvirt-override.c -index d94c292..f528100 100644 ---- a/libvirt-override.c -+++ b/libvirt-override.c -@@ -6506,7 +6506,7 @@ libvirt_virConnectDomainEventDeviceRemovedCallback(virConnectPtr conn ATTRIBUTE_ - } - #endif /* LIBVIR_CHECK_VERSION(1, 1, 1) */ - --#if LIBVIR_CHECK_VERSION(1, 2, 9) -+#if LIBVIR_CHECK_VERSION(1, 2, 8) - static int - libvirt_virConnectDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED, - virDomainPtr dom, -@@ -6564,7 +6564,7 @@ libvirt_virConnectDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED - return ret; - - } --#endif /* LIBVIR_CHECK_VERSION(1, 2, 9) */ -+#endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */ - - static PyObject * - libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, -@@ -6653,11 +6653,11 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, - cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventDeviceRemovedCallback); - break; - #endif /* LIBVIR_CHECK_VERSION(1, 1, 1) */ --#if LIBVIR_CHECK_VERSION(1, 2, 9) -+#if LIBVIR_CHECK_VERSION(1, 2, 8) - case VIR_DOMAIN_EVENT_ID_TUNABLE: - cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventTunableCallback); - break; --#endif /* LIBVIR_CHECK_VERSION(1, 2, 9) */ -+#endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */ - case VIR_DOMAIN_EVENT_ID_LAST: - break; - } --- -2.1.3 - diff --git a/SOURCES/libvirt-python-RHEL-only-downgrade-version-check-for-agent-lifecycle-event.patch b/SOURCES/libvirt-python-RHEL-only-downgrade-version-check-for-agent-lifecycle-event.patch deleted file mode 100644 index e0b405b..0000000 --- a/SOURCES/libvirt-python-RHEL-only-downgrade-version-check-for-agent-lifecycle-event.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 997c203b6ae6cbf5dcb627d373a614bbe7d6e694 Mon Sep 17 00:00:00 2001 -Message-Id: <997c203b6ae6cbf5dcb627d373a614bbe7d6e694@dist-git> -From: Peter Krempa -Date: Mon, 24 Nov 2014 17:59:42 +0100 -Subject: [PATCH] RHEL-only: downgrade version check for agent lifecycle event - -https://bugzilla.redhat.com/show_bug.cgi?id=1167336 - -Makes the agent lifecycle event work. - -Signed-off-by: Jiri Denemark ---- - libvirt-override.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/libvirt-override.c b/libvirt-override.c -index c5d1478..3faddaa 100644 ---- a/libvirt-override.c -+++ b/libvirt-override.c -@@ -6566,7 +6566,7 @@ libvirt_virConnectDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED - } - #endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */ - --#if LIBVIR_CHECK_VERSION(1, 2, 11) -+#if LIBVIR_CHECK_VERSION(1, 2, 8) - static int - libvirt_virConnectDomainEventAgentLifecycleCallback(virConnectPtr conn ATTRIBUTE_UNUSED, - virDomainPtr dom, -@@ -6618,7 +6618,7 @@ libvirt_virConnectDomainEventAgentLifecycleCallback(virConnectPtr conn ATTRIBUTE - return ret; - - } --#endif /* LIBVIR_CHECK_VERSION(1, 2, 11) */ -+#endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */ - - - static PyObject * -@@ -6713,11 +6713,11 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, - cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventTunableCallback); - break; - #endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */ --#if LIBVIR_CHECK_VERSION(1, 2, 11) -+#if LIBVIR_CHECK_VERSION(1, 2, 8) - case VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE: - cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventAgentLifecycleCallback); - break; --#endif /* LIBVIR_CHECK_VERSION(1, 2, 11) */ -+#endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */ - case VIR_DOMAIN_EVENT_ID_LAST: - break; - } --- -2.1.3 - diff --git a/SOURCES/libvirt-python-event-Add-bindings-for-agent-lifecycle-event.patch b/SOURCES/libvirt-python-event-Add-bindings-for-agent-lifecycle-event.patch deleted file mode 100644 index 1a46814..0000000 --- a/SOURCES/libvirt-python-event-Add-bindings-for-agent-lifecycle-event.patch +++ /dev/null @@ -1,163 +0,0 @@ -From 863a09898c215294d9e54ce7daf5f17e7956f7fd Mon Sep 17 00:00:00 2001 -Message-Id: <863a09898c215294d9e54ce7daf5f17e7956f7fd@dist-git> -From: Peter Krempa -Date: Mon, 24 Nov 2014 17:59:41 +0100 -Subject: [PATCH] event: Add bindings for agent lifecycle event - -https://bugzilla.redhat.com/show_bug.cgi?id=1167336 - -Also add the example. - -(cherry picked from commit acc47bcb71dd523264ba7e626624746017a052bc) - -Conflicts: - libvirt-override.c - -Signed-off-by: Jiri Denemark ---- - examples/event-test.py | 11 ++++++++ - libvirt-override-virConnect.py | 10 +++++++ - libvirt-override.c | 60 ++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 81 insertions(+) - mode change 100644 => 100755 examples/event-test.py - -diff --git a/examples/event-test.py b/examples/event-test.py -old mode 100644 -new mode 100755 -index be7a7d4..6cc33ce ---- a/examples/event-test.py -+++ b/examples/event-test.py -@@ -464,6 +464,14 @@ def blockJobStatusToString(status): - blockJobStatus = ( "Completed", "Failed", "Canceled", "Ready", ) - return blockJobStatus[status] - -+def agentLifecycleStateToString(state): -+ agentStates = ( "unknown", "connected", "disconnected", ) -+ return agentStates[state] -+ -+def agentLifecycleReasonToString(reason): -+ agentReasons = ( "unknown", "domain started", "channel event", ) -+ return agentReasons[reason] -+ - def myDomainEventCallback1 (conn, dom, event, detail, opaque): - print("myDomainEventCallback1 EVENT: Domain %s(%s) %s %s" % (dom.name(), dom.ID(), - domEventToString(event), -@@ -517,6 +525,8 @@ 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))) - def myDomainEventTunableCallback(conn, dom, params, opaque): - 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))) - - ########################################################################## - # Network events -@@ -627,6 +637,7 @@ def main(): - 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.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_TUNABLE, myDomainEventTunableCallback, None) -+ vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE, myDomainEventAgentLifecycleCallback, None) - - vc.networkEventRegisterAny(None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE, myNetworkEventLifecycleCallback, None) - -diff --git a/libvirt-override-virConnect.py b/libvirt-override-virConnect.py -index ffb6d6b..88c864c 100644 ---- a/libvirt-override-virConnect.py -+++ b/libvirt-override-virConnect.py -@@ -197,6 +197,16 @@ - cb(self, virDomain(self, _obj=dom), params, opaque) - return 0 - -+ def _dispatchDomainEventAgentLifecycleCallback(self, dom, state, reason, cbData): -+ """Dispatches event to python user domain agent lifecycle event callback -+ """ -+ -+ cb = cbData["cb"] -+ opaque = cbData["opaque"] -+ -+ cb(self, virDomain(self, _obj=dom), state, reason, 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 --git a/libvirt-override.c b/libvirt-override.c -index 1a91c7f..c5d1478 100644 ---- a/libvirt-override.c -+++ b/libvirt-override.c -@@ -6566,6 +6566,61 @@ libvirt_virConnectDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED - } - #endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */ - -+#if LIBVIR_CHECK_VERSION(1, 2, 11) -+static int -+libvirt_virConnectDomainEventAgentLifecycleCallback(virConnectPtr conn ATTRIBUTE_UNUSED, -+ virDomainPtr dom, -+ int state, -+ int reason, -+ 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*)"_dispatchDomainEventAgentLifecycleCallback", -+ (char*)"OiiO", -+ pyobj_dom, state, reason, 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 /* LIBVIR_CHECK_VERSION(1, 2, 11) */ -+ -+ - static PyObject * - libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, - PyObject *args) -@@ -6658,6 +6713,11 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, - cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventTunableCallback); - break; - #endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */ -+#if LIBVIR_CHECK_VERSION(1, 2, 11) -+ case VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE: -+ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventAgentLifecycleCallback); -+ break; -+#endif /* LIBVIR_CHECK_VERSION(1, 2, 11) */ - case VIR_DOMAIN_EVENT_ID_LAST: - break; - } --- -2.1.3 - diff --git a/SOURCES/libvirt-python-examples-Introduce-nodestats-example.patch b/SOURCES/libvirt-python-examples-Introduce-nodestats-example.patch new file mode 100644 index 0000000..d761f52 --- /dev/null +++ b/SOURCES/libvirt-python-examples-Introduce-nodestats-example.patch @@ -0,0 +1,145 @@ +From 3d040733d21991fb8141b6a32dca2eca29652ace Mon Sep 17 00:00:00 2001 +Message-Id: <3d040733d21991fb8141b6a32dca2eca29652ace@dist-git> +From: Michal Privoznik +Date: Fri, 17 Jul 2015 11:45:33 +0200 +Subject: [PATCH] examples: Introduce nodestats example + +https://bugzilla.redhat.com/show_bug.cgi?id=1051494 + +So, this is an exercise to show libvirt capabilities. Firstly, for +each host NUMA nodes some statistics are printed out, i.e. total +memory and free memory. Then, for each running domain, that has memory +strictly bound to certain host nodes, a small statistics of how much +memory it takes is printed out too. For instance: + + # ./examples/nodestats.py + NUMA stats + NUMA nodes: 0 1 2 3 + MemTotal: 3950 3967 3937 3943 + MemFree: 66 56 42 41 + Domain 'fedora': + Overall memory: 1536 MiB + Domain 'fedora22': + Overall memory: 2048 MiB + Domain 'fedora21': + Overall memory: 1024 MiB nodes 0-1 + Node 0: 1024 MiB nodes 0-1 + Domain 'gentoo': + Overall memory: 4096 MiB nodes 0-3 + Node 0: 1024 MiB nodes 0 + Node 1: 1024 MiB nodes 1 + Node 2: 1024 MiB nodes 2 + Node 3: 1024 MiB nodes 3 + +We can see 4 host NUMA nodes, all of them having roughly 4GB of RAM. +Yeah, all of them has nearly all the memory consumed. Then, there are +four domains running. For instance, domain 'fedora' has 1.5GB memory +which is not pinned onto any specific host NUMA node. Domain 'gentoo' on +the other hand has 4GB memory and has 4 NUMA nodes which are pinned 1:1 +to host nodes. + +Signed-off-by: Michal Privoznik +(cherry picked from commit fa21f3d927b29991741e2d7a8ebc2a920778ecba) +Signed-off-by: Michal Privoznik +Signed-off-by: Jiri Denemark +--- + examples/nodestats.py | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 87 insertions(+) + create mode 100755 examples/nodestats.py + +diff --git a/examples/nodestats.py b/examples/nodestats.py +new file mode 100755 +index 0000000..c01dead +--- /dev/null ++++ b/examples/nodestats.py +@@ -0,0 +1,87 @@ ++#!/usr/bin/env python ++# Print some host NUMA node statistics ++# ++# Authors: ++# Michal Privoznik ++ ++import libvirt ++import sys ++from xml.dom import minidom ++import libxml2 ++ ++def xpath_eval(ctxt, path): ++ res = ctxt.xpathEval(path) ++ if res is None or len(res) == 0: ++ value = None ++ else: ++ value = res[0].content ++ return value ++ ++try: ++ conn = libvirt.openReadOnly(None) ++except libvirt.libvirtError: ++ print("Failed to connect to the hypervisor") ++ sys.exit(1) ++ ++try: ++ capsXML = conn.getCapabilities() ++except libvirt.libvirtError: ++ print("Failed to request capabilities") ++ sys.exit(1) ++ ++caps = minidom.parseString(capsXML) ++cells = caps.getElementsByTagName("cells")[0] ++ ++nodesIDs = [ int(proc.getAttribute("id")) ++ for proc in cells.getElementsByTagName("cell") ] ++ ++nodesMem = [ conn.getMemoryStats(int(proc)) ++ for proc in nodesIDs] ++ ++doms = conn.listAllDomains(libvirt.VIR_CONNECT_LIST_DOMAINS_ACTIVE) ++ ++domsStrict = [ proc ++ for proc in doms ++ if proc.numaParameters()["numa_mode"] == libvirt.VIR_DOMAIN_NUMATUNE_MEM_STRICT ] ++ ++domsStrictCfg = {} ++for dom in domsStrict: ++ xmlStr = dom.XMLDesc() ++ doc = libxml2.parseDoc(xmlStr) ++ ctxt = doc.xpathNewContext() ++ ++ domsStrictCfg[dom] = {} ++ ++ pin = ctxt.xpathEval("string(/domain/numatune/memory/@nodeset)") ++ memsize = ctxt.xpathEval("string(/domain/memory)") ++ domsStrictCfg[dom]["memory"] = {"size": int(memsize), "pin": pin} ++ ++ for memnode in ctxt.xpathEval("/domain/numatune/memnode"): ++ ctxt.setContextNode(memnode) ++ cellid = xpath_eval(ctxt, "@cellid") ++ nodeset = xpath_eval(ctxt, "@nodeset") ++ ++ nodesize = xpath_eval(ctxt, "/domain/cpu/numa/cell[@id='%s']/@memory" % cellid) ++ domsStrictCfg[dom][cellid] = {"size": int(nodesize), "pin": nodeset} ++ ++ ++print("NUMA stats") ++print("NUMA nodes:\t" + "\t".join(str(node) for node in nodesIDs)) ++print("MemTotal:\t" + "\t".join(str(i.get("total") // 1024) for i in nodesMem)) ++print("MemFree:\t" + "\t".join(str(i.get("free") // 1024) for i in nodesMem)) ++ ++for dom, v in domsStrictCfg.items(): ++ print("Domain '%s':\t" % dom.name()) ++ ++ toPrint = "\tOverall memory: %d MiB" % (v["memory"]["size"] // 1024) ++ if v["memory"]["pin"] is not None and v["memory"]["pin"] is not "": ++ toPrint = toPrint + " nodes %s" % v["memory"]["pin"] ++ print(toPrint) ++ ++ for k, node in sorted(v.items()): ++ if k is "memory": ++ continue ++ toPrint = "\tNode %s:\t%d MiB" % (k, node["size"] // 1024) ++ if node["pin"] is not None and node["pin"] is not "": ++ toPrint = toPrint + " nodes %s" % node["pin"] ++ print(toPrint) +-- +2.5.0 + diff --git a/SOURCES/libvirt-python-flags-cannot-get-right-value-for-blockCopy-function.patch b/SOURCES/libvirt-python-flags-cannot-get-right-value-for-blockCopy-function.patch deleted file mode 100644 index c56e098..0000000 --- a/SOURCES/libvirt-python-flags-cannot-get-right-value-for-blockCopy-function.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 541abb79fe046a69c7a9970259363ea7fabaa916 Mon Sep 17 00:00:00 2001 -Message-Id: <541abb79fe046a69c7a9970259363ea7fabaa916@dist-git> -From: Pavel Hrdina -Date: Wed, 22 Oct 2014 11:48:58 +0200 -Subject: [PATCH] flags cannot get right value for blockCopy function - -When use blockCopy, flags cannot get a right value, because -PyArg_ParseTuple want to get 6 parameters and blockCopy only -pass 5. Flags will get a unpredictable value, this will make -the function fail with error: - -unsupported flags (0x7f6c) in function qemuDomainBlockCopy - -Signed-off-by: Luyao Huang -(cherry picked from commit a7303a56b5e55c29cb5336c84a89b8347a355770) - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1155484 - -Signed-off-by: Pavel Hrdina - -Conflicts: - libvirt-override.c: commit 7aaa02b4 updated formatting string so - follow the new format in this backport -Signed-off-by: Jiri Denemark ---- - libvirt-override.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/libvirt-override.c b/libvirt-override.c -index e072602..1aa3bf2 100644 ---- a/libvirt-override.c -+++ b/libvirt-override.c -@@ -8108,9 +8108,8 @@ libvirt_virDomainBlockCopy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) - unsigned int flags; - int c_retval; - -- if (!PyArg_ParseTuple(args, (char *) "Ozz|Oi:virDomainBlockCopy", -- &pyobj_dom, &disk, &destxml, &pyobj_dict, ¶ms, -- &flags)) -+ if (!PyArg_ParseTuple(args, (char *) "Ozz|OI:virDomainBlockCopy", -+ &pyobj_dom, &disk, &destxml, &pyobj_dict, &flags)) - return VIR_PY_INT_FAIL; - - if (PyDict_Check(pyobj_dict)) { --- -2.1.3 - diff --git a/SOURCES/libvirt-python-generator-Free-strings-after-libvirt_charPtrWrap.patch b/SOURCES/libvirt-python-generator-Free-strings-after-libvirt_charPtrWrap.patch deleted file mode 100644 index 1cb4854..0000000 --- a/SOURCES/libvirt-python-generator-Free-strings-after-libvirt_charPtrWrap.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0963646091f392aa04493f426306572bc8bfa41d Mon Sep 17 00:00:00 2001 -Message-Id: <0963646091f392aa04493f426306572bc8bfa41d@dist-git> -From: Michal Privoznik -Date: Tue, 16 Sep 2014 13:00:38 +0200 -Subject: [PATCH] generator: Free strings after libvirt_charPtrWrap - -https://bugzilla.redhat.com/show_bug.cgi?id=1140998 - -Up till bb3301ba the wrapper was freeing the passed strings for us. -However that changed after the commit. So now we don't free any -strings which results in memory leaks as reported upstream [1]: - -==14265== 2,407 bytes in 1 blocks are definitely lost in loss record 1,457 of 1,550 -==14265== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) -==14265== by 0x5C46624: xdr_string (in /usr/lib64/libc-2.17.so) -==14265== by 0xCFD9FCD: xdr_remote_nonnull_string (remote_protocol.c:31) -==14265== by 0xCFDC2C8: xdr_remote_domain_get_xml_desc_ret (remote_protocol.c:1617) -==14265== by 0xCFF0811: virNetMessageDecodePayload (virnetmessage.c:407) -==14265== by 0xCFE68FB: virNetClientProgramCall (virnetclientprogram.c:379) -==14265== by 0xCFBE8B1: callFull.isra.2 (remote_driver.c:6578) -==14265== by 0xCFC7F04: remoteDomainGetXMLDesc (remote_driver.c:6600) -==14265== by 0xCF8167C: virDomainGetXMLDesc (libvirt.c:4380) -==14265== by 0xCC2C4DF: libvirt_virDomainGetXMLDesc (libvirt.c:1141) -==14265== by 0x4F12B93: PyEval_EvalFrameEx (in /usr/lib64/libpython2.7.so.1.0) -==14265== by 0x4F141AC: PyEval_EvalCodeEx (in /usr/lib64/libpython2.7.so.1.0) - -The python documentation clearly advise us to call free() [2]. From -an example in their docs: - - PyObject *res; - char *buf = (char *) malloc(BUFSIZ); /* for I/O */ - - if (buf == NULL) - return PyErr_NoMemory(); - ...Do some I/O operation involving buf... - res = PyString_FromString(buf); - free(buf); /* malloc'ed */ - return res; - -Moreover, instead of using VIR_FREE() (which we are not exporting), -I'll just go with bare free(). - -1: https://www.redhat.com/archives/libvir-list/2014-September/msg00736.html -2: https://docs.python.org/2/c-api/memory.html - -Signed-off-by: Michal Privoznik -(cherry picked from commit 4acfb169400497da2a82a849dc8aaa65f88ac6d1) -Signed-off-by: Jiri Denemark ---- - generator.py | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/generator.py b/generator.py -index a798274..8ee046a 100755 ---- a/generator.py -+++ b/generator.py -@@ -708,12 +708,16 @@ def print_function_wrapper(module, name, output, export, include): - else: - c_call = "\n c_retval = %s(%s);\n" % (name, c_call) - ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c) -+ if n == "charPtr": -+ ret_convert = ret_convert + " free(c_retval);\n" - ret_convert = ret_convert + " return py_retval;\n" - elif ret[0] in py_return_types: - (f, t, n, c) = py_return_types[ret[0]] - c_return = " %s c_retval;\n" % (ret[0]) - c_call = "\n c_retval = %s(%s);\n" % (name, c_call) - ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c) -+ if n == "charPtr": -+ ret_convert = ret_convert + " free(c_retval);\n" - ret_convert = ret_convert + " return py_retval;\n" - else: - if ret[0] in skipped_types: --- -2.1.0 - diff --git a/SOURCES/libvirt-python-implement-new-tunable-event.patch b/SOURCES/libvirt-python-implement-new-tunable-event.patch deleted file mode 100644 index 1c896e5..0000000 --- a/SOURCES/libvirt-python-implement-new-tunable-event.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 0f7171da1be3b37613bb284789697888c2aef7bd Mon Sep 17 00:00:00 2001 -Message-Id: <0f7171da1be3b37613bb284789697888c2aef7bd@dist-git> -From: Pavel Hrdina -Date: Tue, 30 Sep 2014 19:25:05 +0200 -Subject: [PATCH] implement new tunable event - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1147639 - -Signed-off-by: Pavel Hrdina -(cherry picked from commit 714aa155e84c4b55e37b5554c9dbc5e7ddd61cd3) -Signed-off-by: Jiri Denemark ---- - examples/event-test.py | 3 ++ - libvirt-override-virConnect.py | 9 ++++++ - libvirt-override.c | 64 ++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 76 insertions(+) - -diff --git a/examples/event-test.py b/examples/event-test.py -index cd85de3..be7a7d4 100644 ---- a/examples/event-test.py -+++ b/examples/event-test.py -@@ -515,6 +515,8 @@ def myDomainEventDeviceRemovedCallback(conn, dom, dev, opaque): - 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))) -+def myDomainEventTunableCallback(conn, dom, params, opaque): -+ print("myDomainEventTunableCallback: Domain %s(%s) %s" % (dom.name(), dom.ID(), params)) - - ########################################################################## - # Network events -@@ -624,6 +626,7 @@ def main(): - 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.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_TUNABLE, myDomainEventTunableCallback, None) - - vc.networkEventRegisterAny(None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE, myNetworkEventLifecycleCallback, None) - -diff --git a/libvirt-override-virConnect.py b/libvirt-override-virConnect.py -index 218f266..ffb6d6b 100644 ---- a/libvirt-override-virConnect.py -+++ b/libvirt-override-virConnect.py -@@ -188,6 +188,15 @@ - cb(self, virDomain(self, _obj=dom), devAlias, opaque) - return 0 - -+ def _dispatchDomainEventTunableCallback(self, dom, params, cbData): -+ """Dispatches event to python user domain tunable event callbacks -+ """ -+ cb = cbData["cb"] -+ opaque = cbData["opaque"] -+ -+ cb(self, virDomain(self, _obj=dom), params, 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 --git a/libvirt-override.c b/libvirt-override.c -index 2dbe339..d94c292 100644 ---- a/libvirt-override.c -+++ b/libvirt-override.c -@@ -6506,6 +6506,65 @@ libvirt_virConnectDomainEventDeviceRemovedCallback(virConnectPtr conn ATTRIBUTE_ - } - #endif /* LIBVIR_CHECK_VERSION(1, 1, 1) */ - -+#if LIBVIR_CHECK_VERSION(1, 2, 9) -+static int -+libvirt_virConnectDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED, -+ virDomainPtr dom, -+ virTypedParameterPtr params, -+ int nparams, -+ void *opaque) -+{ -+ PyObject *pyobj_cbData = (PyObject*)opaque; -+ PyObject *pyobj_dom; -+ PyObject *pyobj_ret = NULL; -+ PyObject *pyobj_conn; -+ PyObject *dictKey; -+ PyObject *pyobj_dict = NULL; -+ int ret = -1; -+ -+ LIBVIRT_ENSURE_THREAD_STATE; -+ -+ pyobj_dict = getPyVirTypedParameter(params, nparams); -+ if (!pyobj_dict) -+ goto cleanup; -+ -+ 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*)"_dispatchDomainEventTunableCallback", -+ (char*)"OOO", -+ pyobj_dom, pyobj_dict, pyobj_cbData); -+ -+ Py_DECREF(pyobj_cbData); -+ Py_DECREF(pyobj_dom); -+ -+ cleanup: -+ if (!pyobj_ret) { -+ DEBUG("%s - ret:%p\n", __FUNCTION__, pyobj_ret); -+ PyErr_Print(); -+ Py_XDECREF(pyobj_dict); -+ } else { -+ Py_DECREF(pyobj_ret); -+ ret = 0; -+ } -+ -+ LIBVIRT_RELEASE_THREAD_STATE; -+ return ret; -+ -+} -+#endif /* LIBVIR_CHECK_VERSION(1, 2, 9) */ - - static PyObject * - libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, -@@ -6594,6 +6653,11 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject *self, - cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventDeviceRemovedCallback); - break; - #endif /* LIBVIR_CHECK_VERSION(1, 1, 1) */ -+#if LIBVIR_CHECK_VERSION(1, 2, 9) -+ case VIR_DOMAIN_EVENT_ID_TUNABLE: -+ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventTunableCallback); -+ break; -+#endif /* LIBVIR_CHECK_VERSION(1, 2, 9) */ - case VIR_DOMAIN_EVENT_ID_LAST: - break; - } --- -2.1.3 - diff --git a/SOURCES/libvirt-python-iothread-Fix-crash-if-virDomainGetIOThreadInfo-returns-error.patch b/SOURCES/libvirt-python-iothread-Fix-crash-if-virDomainGetIOThreadInfo-returns-error.patch new file mode 100644 index 0000000..d9a68d0 --- /dev/null +++ b/SOURCES/libvirt-python-iothread-Fix-crash-if-virDomainGetIOThreadInfo-returns-error.patch @@ -0,0 +1,37 @@ +From 6971993051ba16c374d7385e7ab65fa7f3b57e0c Mon Sep 17 00:00:00 2001 +Message-Id: <6971993051ba16c374d7385e7ab65fa7f3b57e0c@dist-git> +From: Peter Krempa +Date: Thu, 30 Jul 2015 10:04:02 +0200 +Subject: [PATCH] iothread: Fix crash if virDomainGetIOThreadInfo returns error + +The cleanup portion of libvirt_virDomainGetIOThreadInfo would try to +clean the returned structures but the count of iothreads was set to -1. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1248295 +(cherry picked from commit 0a59630a341f73f716e635a8635c053861695cf1) + +Signed-off-by: Jiri Denemark +--- + libvirt-override.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/libvirt-override.c b/libvirt-override.c +index 45c8afc..2398228 100644 +--- a/libvirt-override.c ++++ b/libvirt-override.c +@@ -2104,8 +2104,10 @@ libvirt_virDomainGetIOThreadInfo(PyObject *self ATTRIBUTE_UNUSED, + py_iothrinfo = NULL; + + cleanup: +- for (i = 0; i < niothreads; i++) +- virDomainIOThreadInfoFree(iothrinfo[i]); ++ if (niothreads > 0) { ++ for (i = 0; i < niothreads; i++) ++ virDomainIOThreadInfoFree(iothrinfo[i]); ++ } + VIR_FREE(iothrinfo); + Py_XDECREF(py_iothrinfo); + return py_retval; +-- +2.5.0 + diff --git a/SOURCES/libvirt-python-libvirt-override-fix-some-build-warnings.patch b/SOURCES/libvirt-python-libvirt-override-fix-some-build-warnings.patch deleted file mode 100644 index 00905f1..0000000 --- a/SOURCES/libvirt-python-libvirt-override-fix-some-build-warnings.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 4174f8e8cc4d4cc044330ddfb8eef94339f0d158 Mon Sep 17 00:00:00 2001 -Message-Id: <4174f8e8cc4d4cc044330ddfb8eef94339f0d158@dist-git> -From: Pavel Hrdina -Date: Tue, 2 Sep 2014 11:44:25 +0200 -Subject: [PATCH] libvirt-override: fix some build warnings - -Remove unused label 'cleanup' in 'libvirt_virConnectGetAllDomainStats' -function and remove unused variable 'conn' in function -'libvirt_virDomainListGetStats'. - -Signed-off-by: Pavel Hrdina -(cherry picked from commit bc6da3214c1e49789dcb0062f8b175895bb6f20d) - -https://bugzilla.redhat.com/show_bug.cgi?id=1116978 - -Signed-off-by: Jiri Denemark ---- - libvirt-override.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/libvirt-override.c b/libvirt-override.c -index dfbe9d3..17ea042 100644 ---- a/libvirt-override.c -+++ b/libvirt-override.c -@@ -8039,7 +8039,6 @@ libvirt_virConnectGetAllDomainStats(PyObject *self ATTRIBUTE_UNUSED, - if (!(py_retval = convertDomainStatsRecord(records, nrecords))) - py_retval = VIR_PY_NONE; - -- cleanup: - virDomainStatsRecordListFree(records); - - return py_retval; -@@ -8053,7 +8052,6 @@ libvirt_virDomainListGetStats(PyObject *self ATTRIBUTE_UNUSED, - PyObject *pyobj_conn; - PyObject *py_retval; - PyObject *py_domlist; -- virConnectPtr conn; - virDomainStatsRecordPtr *records = NULL; - virDomainPtr *doms = NULL; - int nrecords; -@@ -8065,7 +8063,6 @@ libvirt_virDomainListGetStats(PyObject *self ATTRIBUTE_UNUSED, - if (!PyArg_ParseTuple(args, (char *)"OOii:virDomainListGetStats", - &pyobj_conn, &py_domlist, &stats, &flags)) - return NULL; -- conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn); - - if (PyList_Check(py_domlist)) { - ndoms = PyList_Size(py_domlist); --- -2.1.0 - diff --git a/SOURCES/libvirt-python-override-Fix-two-uninitialized-variables-in-convertDomainStatsRecord.patch b/SOURCES/libvirt-python-override-Fix-two-uninitialized-variables-in-convertDomainStatsRecord.patch deleted file mode 100644 index 131f822..0000000 --- a/SOURCES/libvirt-python-override-Fix-two-uninitialized-variables-in-convertDomainStatsRecord.patch +++ /dev/null @@ -1,37 +0,0 @@ -From feb429c6829912ea2680bb65ca41f90c90d8cefe Mon Sep 17 00:00:00 2001 -Message-Id: -From: Peter Krempa -Date: Tue, 2 Sep 2014 14:47:24 +0200 -Subject: [PATCH] override: Fix two uninitialized variables in - convertDomainStatsRecord - -py_record_domain and py_record_stats would be accessed uninitialized if -an out-of-memory condition would happen in the first loop. Unlikely, but -coverity complained. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1136354 -(cherry picked from commit 23e22c2df148a402a0221c475e139b8ea19fbbd5) - -Signed-off-by: Jiri Denemark ---- - libvirt-override.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libvirt-override.c b/libvirt-override.c -index 17ea042..872e33b 100644 ---- a/libvirt-override.c -+++ b/libvirt-override.c -@@ -7963,8 +7963,8 @@ convertDomainStatsRecord(virDomainStatsRecordPtr *records, - { - PyObject *py_retval; - PyObject *py_record; -- PyObject *py_record_domain; -- PyObject *py_record_stats; -+ PyObject *py_record_domain = NULL; -+ PyObject *py_record_stats = NULL; - size_t i; - - if (!(py_retval = PyList_New(nrecords))) --- -2.1.0 - diff --git a/SOURCES/libvirt-python-virDomainBlockCopy-initialize-flags-to-0.patch b/SOURCES/libvirt-python-virDomainBlockCopy-initialize-flags-to-0.patch deleted file mode 100644 index b4fb30c..0000000 --- a/SOURCES/libvirt-python-virDomainBlockCopy-initialize-flags-to-0.patch +++ /dev/null @@ -1,34 +0,0 @@ -From d18f479ec152d42fbc4bd8dd5861adb932737337 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Pavel Hrdina -Date: Wed, 22 Oct 2014 14:38:13 +0200 -Subject: [PATCH] virDomainBlockCopy: initialize flags to 0 - -An optional argument if not passed isn't modified by the -PyArg_ParseTuple function. - -Signed-off-by: Pavel Hrdina -(cherry picked from commit 309be0a148a7d3abc0beca5fd14b24f05bb938f0) - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1155484 -Signed-off-by: Jiri Denemark ---- - libvirt-override.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libvirt-override.c b/libvirt-override.c -index 1aa3bf2..2dbe339 100644 ---- a/libvirt-override.c -+++ b/libvirt-override.c -@@ -8105,7 +8105,7 @@ libvirt_virDomainBlockCopy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) - char *destxml = NULL; - virTypedParameterPtr params = NULL; - int nparams = 0; -- unsigned int flags; -+ unsigned int flags = 0; - int c_retval; - - if (!PyArg_ParseTuple(args, (char *) "Ozz|OI:virDomainBlockCopy", --- -2.1.3 - diff --git a/SPECS/libvirt-python.spec b/SPECS/libvirt-python.spec index bf179d0..bbe7b44 100644 --- a/SPECS/libvirt-python.spec +++ b/SPECS/libvirt-python.spec @@ -6,27 +6,19 @@ Summary: The libvirt virtualization API python2 binding Name: libvirt-python -Version: 1.2.8 -Release: 7%{?dist}.1%{?extra_release} +Version: 1.2.17 +Release: 2%{?dist}%{?extra_release} Source0: http://libvirt.org/sources/python/%{name}-%{version}.tar.gz -Patch1: libvirt-python-libvirt-override-fix-some-build-warnings.patch -Patch2: libvirt-python-override-Fix-two-uninitialized-variables-in-convertDomainStatsRecord.patch -Patch3: libvirt-python-generator-Free-strings-after-libvirt_charPtrWrap.patch -Patch4: libvirt-python-Fix-parsing-of-flags-argument-for-bulk-stats-functions.patch -Patch5: libvirt-python-flags-cannot-get-right-value-for-blockCopy-function.patch -Patch6: libvirt-python-virDomainBlockCopy-initialize-flags-to-0.patch -Patch7: libvirt-python-implement-new-tunable-event.patch -Patch8: libvirt-python-RHEL-change-version-checking-from-1.2.9-to-1.2.8-for-tunable-event.patch -Patch9: libvirt-python-Check-return-value-of-libvirt_uintUnwrap.patch -Patch10: libvirt-python-event-Add-bindings-for-agent-lifecycle-event.patch -Patch11: libvirt-python-RHEL-only-downgrade-version-check-for-agent-lifecycle-event.patch +Patch1: libvirt-python-examples-Introduce-nodestats-example.patch +Patch2: libvirt-python-iothread-Fix-crash-if-virDomainGetIOThreadInfo-returns-error.patch +Patch3: libvirt-python-Check-return-value-of-PyList_Append.patch Url: http://libvirt.org License: LGPLv2+ Group: Development/Libraries BuildRequires: git -BuildRequires: libvirt-devel >= 1.2.8-16.el7_1.1 +BuildRequires: libvirt-devel >= 1.2.17-3%{?dist} BuildRequires: python-devel BuildRequires: python-nose BuildRequires: python-lxml @@ -140,8 +132,33 @@ rm -f %{buildroot}%{_libdir}/python*/site-packages/*egg-info %endif %changelog -* Wed Feb 25 2015 Jiri Denemark - 1.2.8-7.el7_1.1 -- Rebuild libvirt python bindings for COPY_DEV flag (rhbz#1196067) +* Tue Aug 4 2015 Jiri Denemark - 1.2.17-2 +- examples: Introduce nodestats example (rhbz#1051494) +- iothread: Fix crash if virDomainGetIOThreadInfo returns error (rhbz#1248295) +- Check return value of PyList_Append (rhbz#1249511) + +* Thu Jul 2 2015 Jiri Denemark - 1.2.17-1 +- Rebased to libvirt-python-1.2.17 (rhbz#1194594) +- The rebase also fixes the following bugs: + rhbz#1194594, rhbz#1222795 + +* Thu Jun 4 2015 Jiri Denemark - 1.2.16-1 +- Rebased to libvirt-python-1.2.16 (rhbz#1194594) + +* Mon May 4 2015 Jiri Denemark - 1.2.15-1 +- Rebased to libvirt-python-1.2.15 (rhbz#1194594) +- The rebase also fixes the following bugs: + rhbz#1212168 + +* Thu Apr 2 2015 Jiri Denemark - 1.2.14-1 +- Rebased to libvirt-python-1.2.14 (rhbz#1194594) +- The rebase also fixes the following bugs: + rhbz#1198518 + +* Thu Mar 26 2015 Jiri Denemark - 1.2.13-1 +- Rebased to libvirt-python-1.2.13 (rhbz#1194594) +- The rebase also fixes the following bugs: + rhbz#1154918, rhbz#1175795, rhbz#1195848 * Wed Dec 17 2014 Jiri Denemark - 1.2.8-7 - Rebuild libvirt-python to pick up the new flag for fetching backing chain statistics (rhbz#1175276)