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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

    libvirt_ulonglongWrap((unsigned long long) info.capacity));

should just work I guess, and we actually probably don't need any cast,
right ?

Daniel

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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]