|
|
b79911 |
From 803928d78f90b4a045a4682ee0c692bbf9f5c89d Mon Sep 17 00:00:00 2001
|
|
|
b79911 |
Message-Id: <803928d78f90b4a045a4682ee0c692bbf9f5c89d@dist-git>
|
|
|
b79911 |
From: Luyao Huang <lhuang@redhat.com>
|
|
|
b79911 |
Date: Wed, 22 Oct 2014 09:55:14 +0200
|
|
|
b79911 |
Subject: [PATCH] Fix parsing of 'flags' argument for bulk stats functions
|
|
|
b79911 |
|
|
|
b79911 |
https://bugzilla.redhat.com/show_bug.cgi?id=1155016
|
|
|
b79911 |
|
|
|
b79911 |
When 'flags' is set to
|
|
|
b79911 |
'libvirt.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS,
|
|
|
b79911 |
python will report a error:
|
|
|
b79911 |
|
|
|
b79911 |
OverflowError: signed integer is greater than maximum
|
|
|
b79911 |
|
|
|
b79911 |
as VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS is defined as 1<<31.
|
|
|
b79911 |
This happens as PyArg_ParseTuple's formatting string containing 'i' as a
|
|
|
b79911 |
modifier expects a signed integer.
|
|
|
b79911 |
|
|
|
b79911 |
With python >= 2.3, 'I' means unsigned int and 'i' means int so we
|
|
|
b79911 |
should use 'I' in the formatting string.
|
|
|
b79911 |
|
|
|
b79911 |
See: https://docs.python.org/2/c-api/arg.html
|
|
|
b79911 |
|
|
|
b79911 |
Signed-off-by: Luyao Huang <lhuang@redhat.com>
|
|
|
b79911 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
b79911 |
(cherry picked from commit b3aa7da4bbc5f44f34cde8a9b719c5c2ecbf7f8b)
|
|
|
b79911 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
b79911 |
---
|
|
|
b79911 |
libvirt-override.c | 4 ++--
|
|
|
b79911 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
b79911 |
|
|
|
b79911 |
diff --git a/libvirt-override.c b/libvirt-override.c
|
|
|
b79911 |
index 872e33b..e072602 100644
|
|
|
b79911 |
--- a/libvirt-override.c
|
|
|
b79911 |
+++ b/libvirt-override.c
|
|
|
b79911 |
@@ -8024,7 +8024,7 @@ libvirt_virConnectGetAllDomainStats(PyObject *self ATTRIBUTE_UNUSED,
|
|
|
b79911 |
unsigned int flags;
|
|
|
b79911 |
unsigned int stats;
|
|
|
b79911 |
|
|
|
b79911 |
- if (!PyArg_ParseTuple(args, (char *)"Oii:virConnectGetAllDomainStats",
|
|
|
b79911 |
+ if (!PyArg_ParseTuple(args, (char *)"OII:virConnectGetAllDomainStats",
|
|
|
b79911 |
&pyobj_conn, &stats, &flags))
|
|
|
b79911 |
return NULL;
|
|
|
b79911 |
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
|
|
|
b79911 |
@@ -8060,7 +8060,7 @@ libvirt_virDomainListGetStats(PyObject *self ATTRIBUTE_UNUSED,
|
|
|
b79911 |
unsigned int flags;
|
|
|
b79911 |
unsigned int stats;
|
|
|
b79911 |
|
|
|
b79911 |
- if (!PyArg_ParseTuple(args, (char *)"OOii:virDomainListGetStats",
|
|
|
b79911 |
+ if (!PyArg_ParseTuple(args, (char *)"OOII:virDomainListGetStats",
|
|
|
b79911 |
&pyobj_conn, &py_domlist, &stats, &flags))
|
|
|
b79911 |
return NULL;
|
|
|
b79911 |
|
|
|
b79911 |
--
|
|
|
b79911 |
2.1.3
|
|
|
b79911 |
|