[SOLVED] Mapping image fails with error: rbd: sysfs write failed

cmonty14

Well-Known Member
Mar 4, 2014
343
5
58
Hi,
I have created a pool + image using this commands:
rbd create --size 500G backup/gbs

Then I modified the features:
rbd feature disable backup/gbs exclusive-lock object-map fast-diff deep-flatten

Latest step was to create a client to get access to the cluster:
ceph auth get-or-create client.gbsadm mon 'allow r' osd 'allow rw pool=backup' -o ceph.client.gbsadm.keyring

On the client ld7581 I can display the current settings of image gbs:
root@ld7581:~# rbd info backup/gbs
rbd image 'gbs':
size 500GiB in 128000 objects
order 22 (4MiB objects)
block_name_prefix: rbd_data.18102d6b8b4567
format: 2
features: layering
flags:
create_timestamp: Thu Jan 24 16:01:55 2019


The issue is that I cannot map this image gbs as user gbsadmin. This is the error displayed:
ld7581:~ # rbd map backup/gbs --user gbsadm -k /etc/ceph/ceph.client.gbsadm.keyring -c /etc/ceph/ceph.conf
rbd: sysfs write failed
2019-01-25 10:23:59.814095 7f846bfff700 -1 librbd::image::OpenRequest: failed to retrieve image id: (1) Operation not permitted
2019-01-25 10:23:59.814330 7f846b7fe700 -1 librbd::ImageState: 0x556b6b40f6e0 failed to open image: (1) Operation not permitted
rbd: error opening image gbs: (1) Operation not permitted
In some cases useful info is found in syslog - try "dmesg | tail".
rbd: map failed: (1) Operation not permitted


I can map the image as admin w/o issues.
Therefore I assume this is an authorization issue.

Can you please advise?

THX
 
The client requires the following caps to work as expected where block_name_prefix must be retrieved with rbd info backup/gbs.

root@ld4257:/etc/ceph# ceph auth get client.gbsadm
exported keyring for client.gbsadm
[client.gbsadm]
key = AQBd0klcFknvMRAAwuu30bNG7L7PHk5d8cSVvg==
caps mon = "allow r"
caps osd = "allow pool backup object_prefix rbd_data.18102d6b8b4567; allow rwx pool backup object_prefix rbd_header.18102d6b8b4567; allow rx pool backup object_prefix rbd_id.gbs"