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

Ján Tomko jtomko at redhat.com
Fri Feb 6 12:55:56 UTC 2015


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

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

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
-------------- 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/20150206/8f340107/attachment-0001.sig>


More information about the libvir-list mailing list