[libvirt] [PATCH 1/4] Fix error messages codes when TypeFromString fails

Michal Prívozník mprivozn at redhat.com
Fri Apr 29 07:25:15 UTC 2011


On 04/29/2011 09:07 AM, Jiri Denemark wrote:
> On Wed, Apr 27, 2011 at 16:57:43 +0200, Michal Privoznik wrote:
>> ---
>>   src/conf/cpu_conf.c                |    4 +-
>>   src/conf/domain_conf.c             |  100 ++++++++++++++++++-----------------
>>   src/conf/interface_conf.c          |    2 +-
>>   src/conf/network_conf.c            |    2 +-
>>   src/conf/node_device_conf.c        |    4 +-
>>   src/conf/nwfilter_conf.c           |    6 +-
>>   src/conf/secret_conf.c             |    2 +-
>>   src/conf/storage_conf.c            |    2 +-
>>   src/conf/storage_encryption_conf.c |    4 +-
>>   9 files changed, 64 insertions(+), 62 deletions(-)
>>
>> diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
>> index ad49916..db8b4bb 100644
>> --- a/src/conf/cpu_conf.c
>> +++ b/src/conf/cpu_conf.c
>> @@ -156,7 +156,7 @@ virCPUDefParseXML(const xmlNodePtr node,
>>               VIR_FREE(match);
>>
>>               if (def->match<  0) {
>> -                virCPUReportError(VIR_ERR_INTERNAL_ERROR,
>> +                virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>>                           "%s", _("Invalid match attribute for CPU specification"));
>>                   goto error;
>>               }
> ...
>
> I think all of these errors should really be changed to the new
> VIR_ERR_XML_CONFIG. This is not the case that a driver doesn't support
> particular value, it's that the value is not know to libvirt at all, i.e., it
> is an error in XML configuration file.
>
> Jirka

I don't agree. If we add support for new value and somebody'll give 
older libvirt XML with new interface type, I think libvirt should say 
VIR_ERR_CONFIG_UNSUPPORTED.

Michal



More information about the libvir-list mailing list