[libvirt] [PATCH] Fix messages using VIR_ERR_XML_ERROR

Eric Blake eblake at redhat.com
Wed May 18 14:03:50 UTC 2011


On 05/12/2011 03:47 PM, Cole Robinson wrote:
> This error code has existed since the dawn of time, yet the messages it
> generates are almost universally busted. Here's a small sampling:
> 
> src/conf/domain_conf.c:4889 : XML description for missing root element is not well formed or invalid
> src/conf/domain_conf.c:4951 : XML description for unknown device type is not well formed or invalid
> src/conf/domain_conf.c:5460 : XML description for maximum vcpus must be an integer is not well formed or invalid
> src/conf/domain_conf.c:5468 : XML description for invalid maxvcpus %(count)lu is not well formed or invalid
> 
> Fix up the error code to instead be
> 
> XML error: <msg>
> 
> Adjust the few locations that we using the original correctly (or shouldn't

s/we/were/

> have been using the error code at all).
> 
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  src/test/test_driver.c |   21 ++++++++++++++-------
>  src/util/virterror.c   |    4 ++--
>  src/xen/xm_internal.c  |    5 +++--
>  3 files changed, 19 insertions(+), 11 deletions(-)

ACK; even if we further improve things later, this patch is a definite
improvement on its own merits.

> +++ b/src/util/virterror.c
> @@ -925,9 +925,9 @@ virErrorMsg(virErrorNumber error, const char *info)
>              break;
>          case VIR_ERR_XML_ERROR:
>              if (info == NULL)
> -                errmsg = _("XML description not well formed or invalid");
> +                errmsg = _("XML description is not well formed or invalid");

The placement of "not" makes this a bit ambiguous; is it worth using:

"XML description is invalid or not well formed"

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110518/d25e4ed6/attachment-0001.sig>


More information about the libvir-list mailing list