[libvirt] [PATCH 4/8] Fix up the error message if we can't parse the snapshot XML.

Chris Lalancette clalance at redhat.com
Tue Apr 27 18:11:53 UTC 2010

On 04/27/2010 02:08 PM, Matthias Bolte wrote:
>> XML description for %s is not well formed or invalid
> Ah, sorry. I missed the fact that VIR_ERR_XML_ERROR results in this
> format string. I'm fine with the original patch then.
> ACK.
> If you grep the codebase for VIR_ERR_XML_ERROR then you'll find that
> in most cases VIR_ERR_XML_ERROR is used in the wrong way, resulting in
> a broken error message:
>                 virInterfaceReportError(VIR_ERR_XML_ERROR,
>                                         "%s", _("bridge interface
> misses the bridge element"));
> Just reporting that the XML in not well formed (the string for
> VIR_ERR_XML_ERROR implies this usage) is not that helpful. So we
> include the relevant details in the error message, ignoring that the
> string associated with VIR_ERR_XML_ERROR indicates a different usage.
> Maybe we should unify the structure of the error code strings to a
> format that expects the additional error message as a more detailed
> description of the error. For example VIR_ERR_NO_DOMAIN or
> VIR_ERR_INVALID_MAC or VIR_ERR_AUTH_FAILED already have this format.

Yeah, I've noticed this as well.  I think your suggestion is a good idea.
I've pushed this patch for now, and hopefully we can do a better job in a 
follow-up patch.

Chris Lalancette

More information about the libvir-list mailing list