diff options
author | Zhou Yimin <zhouyimin@huawei.com> | 2014-08-11 20:59:49 +0800 |
---|---|---|
committer | Michal Privoznik <mprivozn@redhat.com> | 2014-08-11 16:28:26 +0200 |
commit | 86ee51ce97525fd474d3a155d67bf0730597c23a (patch) | |
tree | 0b59d266e6072f0ebb57357064889b2b474efc86 /typewrappers.c | |
parent | cffaeb075ee50c9911b7c15bf06b6e1914f1d10b (diff) | |
download | libvirt-python-86ee51ce97525fd474d3a155d67bf0730597c23a.tar.gz |
Fix libvirt_longlongWrap returning a very large value
If hypervisor is not Xen, the errs in struct _virDomainBlockStats will be -1.
But in KVM when we call domain.blockStats(), errs is 18446744073709551615.
To fix that, this patch has two changes:
1. Replace use of the PyLong_FromUnsignedLongLong with PyLong_FromLongLong
in function libvirt_longlongWrap
2. If the paramemter of libvirt_longlongWrap is unsigned long long,
use libvirt_ulonglongWrap instead because of above change.
After this patch, errs is -1 which is consistent with virDomainBlockStats api.
Signed-off-by: Zhou Yimin <zhouyimin@huawei.com>
Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
Diffstat (limited to 'typewrappers.c')
-rw-r--r-- | typewrappers.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/typewrappers.c b/typewrappers.c index a5b562d..5399fb7 100644 --- a/typewrappers.c +++ b/typewrappers.c @@ -79,7 +79,7 @@ PyObject * libvirt_longlongWrap(long long val) { PyObject *ret; - ret = PyLong_FromUnsignedLongLong((unsigned long long) val); + ret = PyLong_FromLongLong(val); return ret; } |