[libvirt] [PATCH] Fix messages using VIR_ERR_XML_ERROR

Cole Robinson crobinso at redhat.com
Wed May 18 15:19:06 UTC 2011


On 05/18/2011 10:03 AM, Eric Blake wrote:
> 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"
> 

Thanks, pushed with those 2 recommended tweaks.

- Cole




More information about the libvir-list mailing list