]> git.ipfire.org Git - thirdparty/libvirt.git/commit
python: return dictionary without value in case of no blockjob
authorGuannan Ren <gren@redhat.com>
Fri, 17 May 2013 06:30:10 +0000 (14:30 +0800)
committerGuannan Ren <gren@redhat.com>
Mon, 15 Jul 2013 10:20:42 +0000 (18:20 +0800)
commit0f9e67bfad96c4a2e69769d8a5908ee145a86766
treed5b75260818d0e518ff9b2e7d49d5fbf589afc96
parent47a01895fbd5e9ec03b88b6f995850dd247d711a
python: return dictionary without value in case of no blockjob

Currently, when there is no blockjob, dom.blockJobInfo('vda')
still reports error because it doesn't distinguish return value 0 from -1.
libvirt.libvirtError: virDomainGetBlockJobInfo() failed

virDomainGetBlockJobInfo() API return value:
 -1 in case of failure, 0 when nothing found, 1 found.

And use PyDict_SetItemString instead of PyDict_SetItem when key is
of string type. PyDict_SetItemString increments key/value reference
count, so call Py_DECREF() for value. For key, we don't need to
do this, because PyDict_SetItemString will handle it internally.
python/libvirt-override.c