On 01/19/2012 02:20 PM, Daniel P. Berrange wrote:
On Thu, Jan 19, 2012 at 02:13:59PM +0100, Michal Novotny wrote:
> This patch introduces a new structure called virErrorsPtr which can get all
> the errors that occurred since the connection open. The error callback function
> is being used as many times as necessary. The new public function called
> virGetAllErrors() has been introduced to get all the errors that occurred.
This impl is effectively an unbounded memory leak, if you consider
that applications will keep the same virConnectPtr open more or
less forever.
In addition any libvirt API that raises multiple errors should be
considered broken, so I don't think we should have any such API
for querying multiple errors.
What is the situation that motivated this new API ?
This is simple. When you have situation with e.g. disk or domain
creation. It fails but you don't know why. Sometimes the disk creation
may fail on insufficient permissions and sometimes there may be not
enough space etc... The same for domain creation.
Also, we've been discussing this with Peter and we've both agreed that
it would be a nice feature of libvirt to have some API like this. I'm
CCing Peter for his feedback on this (not the patch rather than the
reason of implementation) as I have to admit that this patch would like
some tweaking most likely but the issue here is not different as you're
asking whether we really need this.
Peter, could you please provide Daniel any other example why you would
like this implemented?
Thanks,
Michal
--
Michal Novotny <minovotn(a)redhat.com>, RHCE, Red Hat
Virtualization | libvirt-php bindings |
php-virt-control.org