On Thu, Apr 10, 2008 at 02:56:36PM +0530, ajishrao wrote:
3. If virConnectOpen/virConnectOpenReadOnly fails which api should
be
called to know the error code?
You might find some example code useful. Look at the definition of
CHECK_ERROR macro, used here:
http://hg.et.redhat.com/applications/virt/applications/virt-top--devel?f=...
(eg line 63)
and defined here:
http://hg.et.redhat.com/applications/virt/applications/virt-top--devel?f=...
(line 45)
and the _raise_virterror function which gets the virterror defined
here:
http://hg.et.redhat.com/applications/virt/applications/virt-top--devel?f=...
(line 66)
errp = conn ? virConnGetLastError (conn) : virGetLastError ();
Note that actually copying the virterror may not be such a good idea.
The lifetime of that structure and the strings / pointers contained
within it is a little bit undefined, and the virCopy* functions don't
do a deep copy IIRC. So you should take copies of anything you need
yourself, and make sure you don't refer to the conn/dom/net structure
fields if you can possibly avoid it.
Rich.
--
Richard Jones, Emerging Technologies, Red Hat
http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top