[libvirt] [PATCH 6/6] Implement python binding for virDomainGetBlockInfo
Daniel P. Berrange
berrange at redhat.com
Wed Apr 28 14:24:18 UTC 2010
On Wed, Apr 28, 2010 at 04:19:48PM +0200, Daniel Veillard wrote:
> On Wed, Apr 28, 2010 at 01:54:50PM +0100, Daniel P. Berrange wrote:
> > This binds the virDomainGetBlockInfo API to python's blockInfo
> > method on the domain object
> [...]
> > static PyObject *
> > +libvirt_virDomainGetBlockInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
> [...]
> > + c_retval = virDomainGetBlockInfo(domain, path, &info, flags);
> > + LIBVIRT_END_ALLOW_THREADS;
> > + if (c_retval < 0)
> > + return VIR_PY_NONE;
> > + py_retval = PyList_New(3);
> > + PyList_SetItem(py_retval, 0, libvirt_ulonglongWrap((int) info.capacity));
> > + PyList_SetItem(py_retval, 1, libvirt_ulonglongWrap((int) info.allocation));
> > + PyList_SetItem(py_retval, 2, libvirt_ulonglongWrap((int) info.physical));
>
> aye aye aye, isn't the (int) cast loosing data in most cases ?
> 4GB is small for a virtual disk partition ...
Opps, you're right ! No need for a cast at all there
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list