[libvirt] [PATCH 6/6] Implement python binding for virDomainGetBlockInfo

Daniel Veillard veillard at redhat.com
Wed Apr 28 14:19:48 UTC 2010


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 ...

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list