Re: [PATCH] storage_backend_rbd: check the return value of rados_conf_set

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

 



On Fri, Nov 11, 2016 at 16:33:18 +0800, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao@xxxxxxxxx>
> 
> We forget to check the return value of rados_conf_set.
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxx>
> ---
>  src/storage/storage_backend_rbd.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
> index 718c4d6..58bcb9a 100644
> --- a/src/storage/storage_backend_rbd.c
> +++ b/src/storage/storage_backend_rbd.c
> @@ -162,10 +162,20 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
>      rados_conf_set(ptr->cluster, "client_mount_timeout", client_mount_timeout);

Right in this context is one instance that is not changed ^^^.

>  
>      VIR_DEBUG("Setting RADOS option rados_mon_op_timeout to %s", mon_op_timeout);
> -    rados_conf_set(ptr->cluster, "rados_mon_op_timeout", mon_op_timeout);
> +    if (rados_conf_set(ptr->cluster, "rados_mon_op_timeout", mon_op_timeout) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("failed to set RADOS option: %s"),
> +                       "rados_mon_op_timeout");
> +        goto cleanup;
> +    }

Did you have any problems with this? The documentation mentions only one
error code (ENOENT) if the given config option does not exist in
librados. This would point to us something doing wrong rather than a
random failure and we should address the primary cause.

Peter

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]