[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] qemu: Improve some qemu.conf error reporting



On 07/01/2010 06:11 AM, Daniel P. Berrange wrote:
> On Wed, Jun 30, 2010 at 04:38:36PM -0400, Cole Robinson wrote:
>> Log some info if we can't find a config file. Make parse failures
>> fatal, and actually raise an error message.
>>
>> Signed-off-by: Cole Robinson <crobinso redhat com>
>> ---
>>  src/qemu/qemu_conf.c |   13 +++++++++----
>>  1 files changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
>> index ce42bd6..e2f7b31 100644
>> --- a/src/qemu/qemu_conf.c
>> +++ b/src/qemu/qemu_conf.c
>> @@ -133,16 +133,21 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
>>      /* Just check the file is readable before opening it, otherwise
>>       * libvirt emits an error.
>>       */
>> -    if (access (filename, R_OK) == -1) return 0;
>> +    if (access (filename, R_OK) == -1) {
>> +        VIR_INFO("Could not read qemu config file %s", filename);
>> +        return 0;
>> +    }
>>  
>>      conf = virConfReadFile (filename, 0);
>> -    if (!conf) return 0;
>> +    if (!conf) {
>> +        return -1;
>> +    }
>>  
>>  
>>  #define CHECK_TYPE(name,typ) if (p && p->type != (typ)) {               \
>>          qemuReportError(VIR_ERR_INTERNAL_ERROR,                         \
>> -                         "remoteReadConfigFile: %s: %s: expected type " #typ, \
>> -                         filename, (name));                             \
>> +                        "%s: %s: %s: expected type " #typ,              \
>> +                        __func__, filename, (name));                    \
>>          virConfFree(conf);                                              \
>>          return -1;                                                      \
> 
> Including the function name in the error message is dubious behaviour,
> not in line with the rest of libvirt. We should just kill it. For the
> user only the config filename and parameter are relevant
> 

Thanks, I dropped that bit and pushed.

- Cole


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]