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/
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list