[libvirt] [PATCH] storage: rbd: Improve the error when start a pool based on non-exist rados object

Shanzhi Yu shyu at redhat.com
Wed Feb 11 03:02:36 UTC 2015


On 02/06/2015 08:55 PM, Ján Tomko wrote:
> On Fri, Feb 06, 2015 at 07:45:37PM +0800, Shanzhi Yu wrote:
>> When start/create a pool based on non-exist rados object, the error will be like
>> $virsh pool-start p-c
>> error: Failed to start pool p-c
>> error: failed to create the RBD IoCTX. Does the pool 'libvirt-pool-clone' exist?: No such file or directory
>>
>> update it to
>>
>> error: Failed to start pool p-c
>> error: internal error: failed to create the RBD IoCTX. the rados pool 'libvirt-pool-clone' is not available
> This message is missing the actual error: 'no such file or directory'
> returned by rados_ioctx_create. This return value has been added
> to the error message by commit 761491eb

Indeed. Just catch that commit

> Maybe we could just drop the hint about the pool existence?
> error: failed to create the RBD IoCTX: No such file or directory

Would it be better to wrap the error returned by librados? Returning a 
libvirt error will be more friendly to a libvirt user

>
> Jan
>> Signed-off-by: Shanzhi Yu <shyu at redhat.com>
>> ---
>>   src/storage/storage_backend_rbd.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
>> index 57182de..98e7fe7 100644
>> --- a/src/storage/storage_backend_rbd.c
>> +++ b/src/storage/storage_backend_rbd.c
>> @@ -236,8 +236,10 @@ static int virStorageBackendRBDOpenIoCTX(virStorageBackendRBDStatePtr ptr, virSt
>>   {
>>       int r = rados_ioctx_create(ptr->cluster, pool->def->source.name, &ptr->ioctx);
>>       if (r < 0) {
>> -        virReportSystemError(-r, _("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
>> -                             pool->def->source.name);
>> +        virReportError(VIR_ERR_INTERNAL_ERROR,
>> +			_("failed to create the RBD IoCTX. "
>> +			"the rados pool '%s' is not available"),
>> +			pool->def->source.name);
>>       }
>>       return r;
>>   }
>> -- 
>> 2.1.0
>>
>> --
>> libvir-list mailing list
>> libvir-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/libvir-list

-- 
Regards
shyu




More information about the libvir-list mailing list