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

Ján Tomko jtomko at redhat.com
Wed Feb 11 07:45:31 UTC 2015


On Wed, Feb 11, 2015 at 11:02:36AM +0800, Shanzhi Yu wrote:
> 
> 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
> 

I meant:
virReportSystemError(-r, "%s", _("failed to create the RBD IoCTX"));

How do you want to wrap it?

Jan


> > 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
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150211/6f0189fe/attachment-0001.sig>


More information about the libvir-list mailing list