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

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

 



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@xxxxxxxxxx>
> >> ---
> >>   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@xxxxxxxxxx
> >> https://www.redhat.com/mailman/listinfo/libvir-list
> 
> -- 
> Regards
> shyu
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]