[libvirt] [PATCH 2/3] rbd: Simplify opening RADOS IoCTX
Ján Tomko
jtomko at redhat.com
Fri Feb 21 14:04:01 UTC 2014
On 02/12/2014 03:11 PM, Wido den Hollander wrote:
> Reduces code and brings logging back to one function.
> ---
> src/storage/storage_backend_rbd.c | 43 ++++++++++++++-----------------------
> 1 file changed, 16 insertions(+), 27 deletions(-)
>
> diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
> index bd21873..8d1e320 100644
> --- a/src/storage/storage_backend_rbd.c
> +++ b/src/storage/storage_backend_rbd.c
> @@ -221,6 +221,17 @@ cleanup:
> return ret;
> }
>
> +static int virStorageBackendRBDOpenIoCTX(virStorageBackendRBDStatePtr ptr, virStoragePoolObjPtr pool)
> +{
> + int r = rados_ioctx_create(ptr->cluster, pool->def->source.name, &ptr->ioctx);
> + if (r < 0) {
> + virReportError(VIR_ERR_INTERNAL_ERROR,
> + _("failed to create the RBD IoCTX. Does the pool '%s' exist?: %d"),
> + pool->def->source.name, r);
Looking at the documentation [1], librados returns -errno.
It would be more user-friendly to report it as a string instead of a number.
I'd suggest using:
virReportSystemError(-r,
_("failed to create the RBD IoCTX. "
"Does the pool '%s' exist?'),
pool->def->source.name);
Also, putting this patch first would reduce the number of error messages that
need to be changed.
Jan
[1] http://ceph.com/docs/master/rados/api/librados/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140221/4e03b94e/attachment-0001.sig>
More information about the libvir-list
mailing list