On Thu, Apr 10, 2008 at 02:56:36PM +0530, ajishrao wrote:
Hi,
I am little confused about these api's such as
virConnCopyLastError and virCopyLastError. Please correct my
understanding.
1. virConnCopyLastError expects 2 parameter connection and virErrorPtr,
This is used only after getting successful connection, If i call this
without connection say it is NULL, I hope it will return -1 if no what
will it return?
yes, see the code
...
virConnCopyLastError(virConnectPtr conn, virErrorPtr to)
{
if (conn == NULL)
return (-1);
...
2. virCopyLastError expects on 1 parameter virErrorPtr, this can be
used
any time, even before getting connection, If it is No. Then when will i
use virCopyLastError api?
Also some errors may happen at a place where we don't have a connection
pointer handy to report them, in that case the data is still saved but in a
global variable. It's not just if a connection was successful or not.
3. If virConnectOpen/virConnectOpenReadOnly fails which api should
be
called to know the error code?
virCopyLastError
Note that you don't have to do things asynchronously like this, see
http://libvirt.org/html/libvirt-virterror.html#virSetErrorFunc
allowing to provide a callback called on error if no connection
is available and
http://libvirt.org/html/libvirt-virterror.html#virConnSetErrorFunc
to set such callback in a context with a connection
i have tried to detail all this in the documentation at
http://libvirt.org/errors.html
Daniel
--
Red Hat Virtualization group
http://redhat.com/virtualization/
Daniel Veillard | virtualization library
http://libvirt.org/
veillard(a)redhat.com | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine
http://rpmfind.net/