Skip to content

Inconsistent user name format between NewConnWithUser() and NewConnWithClusterAndUser() #244

@BenoitKnecht

Description

@BenoitKnecht

rados.NewConnWithUser(user string) expects user to be a simple user ID (e.g. admin), while rados.NewConnWithClusterAndUser(clusterName string, userName string) expects userName in the form client.<ID> (e.g. client.admin). Omitting the client. prefix in rados.NewConnWithClusterAndUser() results in a rather obscure rados: ret=22, Invalid argument.

This expectation isn't made clear in the documentation, and would require users to know that rados.NewConnWithUser() uses C.rados_create() while rados.NewConnWithClusterAndUser() uses C.rados_create2(). And even then, the documentation for rados_create2() states:

Like rados_create, but don’t assume ‘client.’+id; allow full specification of name.

which sounds like both formats would be valid.

So I think either

  1. Documentation should be updated to make it clear which user name format is valid for each function;
  2. rados.NewConnWithUser() and rados.NewConnWithClusterAndUser() should be made to accept both user name formats, i.e. with or without the client. prefix;
  3. Both functions should use C.rados_create2() under the hood, meaning both would require user names to include the client. prefix (that would be a breaking change though).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions