On 11/09/2009 07:57 AM, Daniel P. Berrange wrote:
> On Thu, Nov 05, 2009 at 01:17:41PM -0500, Cole Robinson wrote:
>> In testing migration, I was hitting an error in the Perform step, but this
>> was being returned as 'Unknown Error' via virsh. The reason is that even
>> a failed Perform will call MigrateFinish to do cleanup, but Finish will
>> always return an NULL == error in that case, overwriting the original 
>> message.
>>
>> I've added internal APIs which allow temporarily disabling error reporting:
>> any ReportError calls will log the error message, but will not overwrite the
>> previous error and will not trigger the error callback. These APIs are then
>> used in a few places where they are needed.
> 
> I don't particularly like this as a concept. Could we do this the other
> way around, whereby we call  virSaveLastError() before the bit of code
> which might clobber the error we want, and then add a new method to set
> it back afterwards.
> 
> Daniel

Tried that originally. Problem is it doesn't easily work for virsh. If a
libvirt call errors, virsh doesn't print the last error from GetLastError, it
prints the last error that triggered the error callback. So for the end result
to be reached, we would need to fire error callback twice for the same msg:
once when the msg is raised, again when we reraise it after it was squashed.
That would muddle up debug output at least.

Maybe virsh just needs to be fixed.

- Cole

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

Reply via email to