Bug #47002
closedpython-rados: connection error
0%
Description
When using ceph and ceph-iscsi from chacra repositories, I not able to start rbd-target-api anymore (it was working fine few days ago) on a non containerized environment.
# rpm -qa | egrep '(ceph|rados)' libcephfs2-16.0.0-4355.g4fa1eaf.el8.x86_64 python3-cephfs-16.0.0-4355.g4fa1eaf.el8.x86_64 python3-ceph-common-16.0.0-4355.g4fa1eaf.el8.x86_64 ceph-common-16.0.0-4355.g4fa1eaf.el8.x86_64 ceph-iscsi-3.4-27.g6193889.el8.noarch librados2-16.0.0-4355.g4fa1eaf.el8.x86_64 python3-rados-16.0.0-4355.g4fa1eaf.el8.x86_64 python3-ceph-argparse-16.0.0-4355.g4fa1eaf.el8.x86_64 libradosstriper1-16.0.0-4355.g4fa1eaf.el8.x86_64
The rbd-target-api log ouput shows that there's a permission denied when trying to connect the ceph cluster even if every requirement are present (ceph config, pool, keyring, etc...).
2020-08-12 17:42:32,786 ERROR [rbd-target-api:2993:<module>()] - Unable to connect to the cluster (keyring missing?) - [errno 13] RADOS permission denied (error connecting to the cluster) 2020-08-12 17:42:32,787 CRITICAL [rbd-target-api:2764:halt()] - Unable to open/read the configuration object
I'm using the ceph admin keyring for this and I'm able to run some ceph commands with that keyring.
# ls -hl /etc/ceph/ total 16K -rw-------. 1 ceph ceph 151 Aug 12 14:43 ceph.client.admin.keyring -rw-r--r--. 1 ceph ceph 455 Aug 12 14:43 ceph.conf -rw-------. 1 root root 1012 Aug 12 16:59 iscsi-gateway.cfg -rw-r--r--. 1 root root 92 Aug 12 09:14 rbdmap
When trying the cluster connection manually via python (which is what is current implemented in ceph-iscsi [1]) we can see that the error is coming from rados.pyx [2].
>>> import rados >>> cluster = rados.Rados(conffile='/etc/ceph/ceph.conf', name='client.admin') >>> cluster.connect() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "rados.pyx", line 1003, in rados.Rados.connect rados.PermissionDeniedError: [errno 13] RADOS permission denied (error connecting to the cluster)
It's not clear for me what changed in the rados python binding recently that could explain this failure.
When adding the clustername parameter to the Rados class then it works again.
>>> import rados >>> cluster = rados.Rados(clustername='ceph', conffile='/etc/ceph/ceph.conf', name='client.admin') >>> cluster.connect() >>>
[1] https://github.com/ceph/ceph-iscsi/blob/master/ceph_iscsi_config/common.py#L37-L49
[2] https://github.com/ceph/ceph/blob/master/src/pybind/rados/rados.pyx